Increasing brightness of texture in OpenGL

Nibbie
Posts: 4
Joined: 2009.06
Post: #1
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?
Quote this message in a reply
Sage
Posts: 1,232
Joined: 2002.10
Post: #2
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.
Quote this message in a reply
Member
Posts: 35
Joined: 2009.01
Post: #3
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.
Quote this message in a reply
Sage
Posts: 1,232
Joined: 2002.10
Post: #4
For uniform brightness, that's a terrible waste of resources. Use TexEnv ADD/SUBTRACT or INTERPOLATE and a vertex color instead.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  opengl es strange 16bit texture scale problem spuckfunkel 6 8,617 Aug 14, 2011 10:44 PM
Last Post: headkaze
  how to draw to OpenGL texture Gillissie 7 6,738 Apr 24, 2009 06:35 AM
Last Post: AnotherJake
  OpenGl ES Texture Problems jhbau1000 4 4,043 Mar 24, 2009 02:41 PM
Last Post: AnotherJake
  Does anyone have any texture loader or library (c++ and opengl)? riruilo 1 3,171 Jan 1, 2009 04:17 PM
Last Post: smallstepforman