Jump to content
  • Advertisement
Sign in to follow this  
hury

Transparency in Textures

This topic is 3643 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 to change the Transparancy of a texture after it has been bind to a object? For example:
			glEnable(GL_BLEND);
			glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
			glEnable(GL_TEXTURE_2D);
			glBindTexture(GL_TEXTURE_2D, m_MyFileTexture.TextureID);						
			glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
			glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);		

			glCallList(fileDL);

			glDisable(GL_TEXTURE_2D);

Share this post


Link to post
Share on other sites
Advertisement
Depends on how you want to change the alpha. For example, if you want to load a completely new and unrelated alpha channel, your only bet is to reload the entire texture data. If you want to change the alpha by a constant factor, you can set texture combiner mode to GL_MODULATE and set the factor using the primary color's alpha channel.

Explain what you're trying to do and what result you want from it.

Share this post


Link to post
Share on other sites
Hi Brother Bob,

I have quad-objects which are covered with textures. Now when i move one of these objects in the z-Axis, it´s Alpha value should be set to an lower value.

My z-Axis allows 3 positions: front, middle, back.

What I need is no transparency at front, 33% transparency for middle layer, 50% transparency for the back position.

Best regards
Alex

Share this post


Link to post
Share on other sites
Quote:
Original post by larvyde
Sounds like a simple call to glColor4f() should be enough...

Correct, that will set the primary color. That along with the GL_MODULATE texture combiner function for the example I mentioned previously.

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!