Jump to content
  • Advertisement
Sign in to follow this  
thorpe

Transparent textures

This topic is 5151 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

I have a texture with alpha value 1.0 everywhere. I want to render this texture transparent with a given alpha value. How do I do it? I've tried with:
GLfloat alpha = 0.5;
GLfloat color[4] = {1,1,1,alpha};
glTexEnvfv(GL_TEXTURE_ENV,GL_TEXTURE_ENV_COLOR, color);
glTexEnvi(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE, GL_BLEND);
glBlendFunc(GL_SRC_ALPHA_SATURATE, GL_ONE);
// draw the texture

and lots of other different setup but nothing works =( The GL reference is really cryptical... Thanks in advance

Share this post


Link to post
Share on other sites
Advertisement
I assume no lighting is present(if it is,replace glColor with glMaterial).


GLfloat alpha = 0.5;
glColor4f(1,1,1,alpha);
glTexEnvfi(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_MODULATE);

glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);



Share this post


Link to post
Share on other sites
Lighting is enabled, thanks a billion!!

And the first hour we tested different setups, we had also forgot to enable GL_BLEND =/

Thanks a lot.. I'll re-post if it doesn't work

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!