Advertisement

How to do transparent textures in OpenGL?

Started by September 02, 2000 06:09 PM
2 comments, last by monkeyman 24 years, 2 months ago
I''ve got the alpha values set in my texture..I''ve got the code that enables the alpha test when using a transparent texture..I don''t need to do any blending, I just need to see through certain parts of the texture..I''ve manually set the alpha values in the texture to 1''s and 0''s, so that''s ready to go..I found a good tutorial on NeHe''s site but it illustrates a double-pass system rather than using the alpha channel..I''m sure it''s something specific that I need to set with OpenGL before I can see the results, but I don''t know what...any suggestions? "Like all good things, it starts with a monkey.."
"Like all good things, it starts with a monkey.."
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER,0.5); // whatever

now every texel with a alpha less than 0.5 wont get draw on the screen
note alpha testing is quicker than doing blending
Advertisement
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER,0.5);

this is exactly what I have already..I think I need to rip apart the TGA loader and double check my alpha values..more fun

"Like all good things, it starts with a monkey.."
"Like all good things, it starts with a monkey.."
I’m just a newbie who can barely set up a proper polygon , but nevertheless I hope I can help. You should check out Nehe’s tutorials in the OpenGl section, lesson 8 deals exactly with transparent textures.
--------------------Moo, that’s right, moo!

This topic is closed to new replies.

Advertisement