Jump to content
  • Advertisement
Sign in to follow this  
xelanoimis

OpenGL Alpha channel replicated into the RGB source. Is it possible?

This topic is 4481 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, Is it possible in OpenGL to replicate source alpha into the rgb channels like the DirectX argument value D3DTA_ALPHAREPLICATE ? I have an RGBA texture and I need to display only the alpha value to the screen (like AAAA or AAA). To be more specific, the texture would have a noice in RGB (random colored pixels) and an opaque circle in Alpha. I need to display the circle from alpha, with a red or any other color. So is there a state to set, or I need to make another texture? No pixel shaders, just basic OpenGL. Thanks!

Share this post


Link to post
Share on other sites
Advertisement
It's possible. Check out the ARB_texture_env_combine extension specification for some easily accessible information, although it's a core feature since OpenGL 1.3 so you can check the core specification aswell.

glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
// pass source 0 to the combiner output
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_REPLACE);
// source 0 is the texture
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_TEXTURE);
// the source operand can invert the color or take the color from the (possibly inverted) alpha channel instead
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_ALPHA);

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!