Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - aeron

Pages: [1]
1
Graphics / Inverting a sprite
« on: July 13, 2011, 03:03:42 am »
Hello, I'm trying to invert the colors for a single sprite and I can't seem to get it right. How do I receive the current pixel's color (from the sprite) in the shader? At first I tried gl_Color to no avail:
Code: [Select]

uniform bool invert;

void main()
{
    if(invert)
        gl_FragColor = vec4(255.0 - gl_Color.r, 255.0 - gl_Color.g, 255.0 - gl_Color.b, 1.0);
    else
        gl_FragColor = gl_Color;
}


I also tried another google-inspired solution:
Code: [Select]

uniform bool invert;
uniform sampler2D screenColorBuffer;

void main()
{
    vec4 color =  gl_TexCoord[0];
    if(invert)
    {
        gl_FragColor = 1.0-texture2D(screenColorBuffer,gl_TexCoord[0].st);
        gl_FragColor.a = 1.0;
    }
    else
        gl_FragColor = color;
}


Maybe I'm just not sure what to search for... this GLSL stuff is impossible to sort out for some reason. Is there a certain variable I should use in this scenario?

Thanks

2
Graphics / Shaders don't work when running as a screensaver
« on: May 12, 2011, 03:42:03 pm »
I'm writing a screensaver using SFML 2.0, however I am running into some problems with shaders.

I should state that I haven't written a "formal" windows api screensaver, I am using the normal main and only renaming the screensaver from .exe to .scr while I am testing. This is legal and in fact works in setting up the display/drawing, but for some reason shaders fail to work.

At first I thought there might have been a problem with the execution directory but even when hard-coding the shader location it was failing. After some debugging I discovered SFML was simply unable to use shaders when the extension was changed to .scr.

Also, slightly off-topic, but has anyone had any success with screensavers in SFML in the past? Did you use <screensaver.h> and go through the "proper" windows protocol? I'm trying to decide if I should even bother with the winapi or just stick with main and command line switches. I also can't decide if I really need SFML or not... I'm really only using it to get an opengl context and load the fragment shaders which could easily be done the old-fashioned way.

3
General discussions / Problem compiling SFML 2.0 program
« on: February 03, 2011, 11:28:24 pm »
I followed the instructions to build SFML 2.0 with CMake and it seemed to work without a problem. So now I try to compile against the library but I keep getting errors:
Code: [Select]
obj\Debug\Game.o: In function `Game':
C:/Users/Mitchell/Programming/Projects/Demise/Game.cpp:13: undefined reference to `_imp___ZN2sf9VideoModeC1Ejjj'
C:/Users/Mitchell/Programming/Projects/Demise/Game.cpp:13: undefined reference to `_imp___ZN2sf12RenderWindowC1ENS_9VideoModeERKSsmRKNS_15ContextSettingsE'
C:/Users/Mitchell/Programming/Projects/Demise/Game.cpp:14: undefined reference to `_imp___ZN2sf6Window17SetFramerateLimitEj'
C:/Users/Mitchell/Programming/Projects/Demise/Game.cpp:27: undefined reference to `_imp___ZN2sf5ImageC1Ev'
C:/Users/Mitchell/Programming/Projects/Demise/Game.cpp:28: undefined reference to `_imp___ZN2sf5Image12LoadFromFileERKSs'
C:/Users/Mitchell/Programming/Projects/Demise/Game.cpp:30: undefined reference to `_imp___ZN2sf5Image9SetSmoothEb'
C:/Users/Mitchell/Programming/Projects/Demise/Game.cpp:13: undefined reference to `_imp___ZN2sf9VideoModeC1Ejjj'
C:/Users/Mitchell/Programming/Projects/Demise/Game.cpp:13: undefined reference to `_imp___ZN2sf12RenderWindowC1ENS_9VideoModeERKSsmRKNS_15ContextSettingsE'
C:/Users/Mitchell/Programming/Projects/Demise/Game.cpp:14: undefined reference to `_imp___ZN2sf6Window17SetFramerateLimitEj'
C:/Users/Mitchell/Programming/Projects/Demise/Game.cpp:27: undefined reference to `_imp___ZN2sf5ImageC1Ev'
C:/Users/Mitchell/Programming/Projects/Demise/Game.cpp:28: undefined reference to `_imp___ZN2sf5Image12LoadFromFileERKSs'
C:/Users/Mitchell/Programming/Projects/Demise/Game.cpp:30: undefined reference to `_imp___ZN2sf5Image9SetSmoothEb'
obj\Debug\Game.o:C:/Users/Mitchell/Programming/Projects/Demise/Game.cpp:58: undefined reference to `_imp___ZN2sf6Window5CloseEv'
obj\Debug\Game.o:C:/Users/Mitchell/Programming/Projects/Demise/Game.cpp:55: undefined reference to `_imp___ZN2sf6Window8GetEventERNS_5EventE'
obj\Debug\Game.o:C:/Users/Mitchell/Programming/Projects/Demise/Game.cpp:60: undefined reference to `_imp___ZNK2sf6Window8GetInputEv'
obj\Debug\Game.o:C:/Users/Mitchell/Programming/Projects/Demise/Game.cpp:63: undefined reference to `_imp___ZN2sf5Color5BlackE'
obj\Debug\Game.o:C:/Users/Mitchell/Programming/Projects/Demise/Game.cpp:63: undefined reference to `_imp___ZN2sf12RenderTarget5ClearERKNS_5ColorE'
obj\Debug\Game.o:C:/Users/Mitchell/Programming/Projects/Demise/Game.cpp:65: undefined reference to `_imp___ZN2sf6Window7DisplayEv'
obj\Debug\Game.o:C:/Users/Mitchell/Programming/Projects/Demise/Game.cpp:52: undefined reference to `_imp___ZNK2sf6Window8IsOpenedEv'
collect2: ld returned 1 exit status


So yeah, what might cause this? The program is trivially simple, it's just a basic game loop at the moment. I have the compiler/linker search directories set correctly and everything, and I'm using the exact same compiler I used to compile SFML (TDM-GCC). Using SVN revision 1786

Pages: [1]
anything