Jump to content
  • Advertisement
Sign in to follow this  
Rotekita

OpenGL simple clamping question please help...

This topic is 5150 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!