Sign in to follow this  
Rotekita

OpenGL simple clamping question please help...

Recommended Posts

Hi everybody, I get a GL_LUMINANCE_ALPHA internal format texture, which has values outside the range of [0 1] and I see that the OpenGL is clamping the values and I get the wrong resualt... is there a way to use OpenGL to scale the values into the range [0 1] correctly? thanks...

Share this post


Link to post
Share on other sites
Well, you could do something like this before the glTexImage* call.
glPixelTransferf(GL_ALPHA_SCALE,0.5);

That would mean the alpha is scaled by 0.5 before clamping. The same can be done for colors with GL_RED_SCALE, GL_GREEN_SCALE and GL_BLUE_SCALE.

However, for this to work, you'd have to know what scale the values are at to begin with.
If you don't know the scale, you'll just have to loop through the values and check, before uploading the texture. There is, as far as I know, no way to get OpenGL to "normalize" the values.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this