Hey guys,
I’m pretty new to shaders, so I’m a little bit stuck. What i’m trying to do should be easy. I’m trying to get the current pixel and multiply it by another color to get kind of a blue hue over the entire screen (not including the HUD). The end goal is to kind of have a night type feel to everything by doing this.
It seems like every example I am finding uses the SpriteBatch class with LibGDX or Slick to handle passing texture data to the shader. I already have a large portion of rendering code in place and I’d like to find a way to do something like this:
ARBShaderObjects.glUseProgramObjectARB(shaderProgram);
updatePlayingField(0);
Actor.updateCast();
player.update();
updatePlayingField(1);
Particle.updateAll();
ARBShaderObjects.glUseProgramObjectARB(0);
FloatingText.updateAll();
updateHUD();
That would be in my main game loop. Basically I have a simple shader working now, but all it does is change every pixel to a specific color. All of the individual sprites are drawn in each of those methods in that loop. It doesn’t seem possible that I can just get the “current” pixel color value when the fragment shader is run sadly…
Is there an easy way to handle shaders without re-writing all of my existing rendering code and over-complicating the systems I already have in place? I guess another option might be that I could apply a shader to the entire buffer before rendering the HUD? I don’t know - any and all suggestions are welcome. More code available upon request - didn’t want to overcomplicate things since I have basic shaders already working. ;D
- Steve