Skip to main content
GameDev.net gamedev.net
🔒 Locked

glAlphaFunc

Started by saeZ Jun 4, 2002 at 4:08 PM 2 replies 550+ views
Original Post
saeZ
saeZ
I''m working on a isometric game. I know how to achieve transparency by faking colorkey with alphatest (glAlphaFunc(GL_GREATER, 0), but what I want now is to render every alpha value. This is used in Lasersquad Nemesis and it looks great! It makes easy to implement shadows and explosion animations for example. I want to draw every alpha value, 0 being fully transparent, 255 being fully opaque, and everything else between those values accordingly. So, how would I do this? Thank you. saeZ
Fruny
Fruny
Control the blend function with glBlendFunc() and enable/disable GL_BLEND

Documents [ GDNet | MSDN | STL | OpenGL | Formats | RTFM | Asking Smart Questions ]
C++ Stuff [ MinGW | Loki | SDL | Boost. | STLport | FLTK | ACCU Recommended Books ]
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
saeZ
saeZ
Pardon my stupidity, but what values should I use with glBlendFunc()?

I tried GL_SRC_ALPHA and others by random and they didn''t give me the result I wanted. I have no idea which values to use.

saeZ
Fruny
Fruny
If you''re rendering your polygons in back to front order : GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA

Documents [ GDNet | MSDN | STL | OpenGL | Formats | RTFM | Asking Smart Questions ]
C++ Stuff [ MinGW | Loki | SDL | Boost. | STLport | FLTK | ACCU Recommended Books ]
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.