Jump to content
  • Advertisement
Sign in to follow this  
breenan

OpenGL transparent quad help???

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

Please can someone help... I need to texture map a quad with a pic of a man, and need the parts surounding to be transparent, so he doesnt look like he is standing in a black square, I can get this to work if i use masking from lesson 20, but as you disable depth testing, he is always at the front, even if he is behind a building, you can still see him... lessons 20 only seems to be for 2d... someone had sugested to make the black area white, but that does nothing... The nearest example i can think of is doom 1, as the game is 3d, but the monsters are 2d... can anyone help???? Using VC++ and OpenGL. Thank you for anyhelp.

Share this post


Link to post
Share on other sites
Advertisement
Just use alpha testing.
Use a RGBA texture and set alpha=0 on the regions you want to be transparent and alpha=1 on the regions you want to show.

The do the following:
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER,0);

That will discard all the fragments with alpha=0

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!