views:

156

answers:

3

I would like to increase the brightness on a texture used in OpenGL rendering. Such as making it bright red or white. This is a 2D rendering environment, where every sprite is mapped as a texture to an OpenGL polygon. I know little to nothing on manipulating data, and my engine works with a texture cache, so altering the whole surface would affect everything using the texture. I can simulate the effect by having a "mask" and overlaying it, allowing me to make the sprite having solid colors, but that takes away memory. If there any other solution to this?

A: 

use GL_MODULATE to multiply the texture color by the current color.
see the texture tutorial in this page.

shoosh
It doesn't work too well, and it's the default it seems, so I am using it already. When using a sprite and setting color (1,0,0) (full red) it literally removes green and blue from the sprite. I would like to add actual red instead of removing the other two components.
DalGr
+1  A: 

If your requirement afford it, you can always write a very simple GLSL fragment shader which does this. It's literally a one liner.
Something like:

uniform sampler2d tex;
void main()
{
    gl_FragColor = texture2d(tex, gl_TexCoord[0]) + gl_Color;
}
shoosh
+1 for giving an example. You should probably move to using shaders instead of the fixed pipleline anyway, it's just so much more flexible
John Burton
+1  A: 

Perhaps GL_ADD instead of GL_MODULATE?

genpfault