iDevGames Forums

Full Version: Increasing brightness of texture in OpenGL
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I ran into a problem that I need to dynamically change texture brightness in OpenGL ES. Running color filter with values more then 1.0f did not yield any result. Seams like OGL is clamping the values of glColor4f.

Is there any other way, then screen-adding texture on top of itself several times?
Vertex colors are clamped to [0..1] in the fixed function pipeline.
Generic attributes are not clamped, in the programmable pipeline.

If you want to change the brightness of a texture arbitrarily in the fixed function pipeline, you can do it by using the TexEnv COMBINE operators-- a single texture unit is enough to scale the brightness arbitrarily from [0..2], so it's no slower than drawing the texture normally. The recently posted GLImageProcessing sample code shows how to do this in exhaustive detail.
Depending on usage, this idea may or may not make sense.

Try creating a white "mask" of the texture you are brightening. Using Photoshop's magic wand tool with anti-aliasing enabled and 0 tolerance, select the texture you want to brighten and hit delete after setting the background color to white.

Then, draw this mask over the texture you want to brighten, with alpha 0 corresponding to normal brightness and alpha 1 corresponding to infinity brightness.

For more control, use partial transparency in the mask itself.
For uniform brightness, that's a terrible waste of resources. Use TexEnv ADD/SUBTRACT or INTERPOLATE and a vertex color instead.
Reference URL's