BlinX
02-27-2004, 07:34 AM
I have a problem with masking & depth, if I draw masked triangles/quads behind each and don’t draw them in de right order the masked objects aren’t visible.
I have tried the code from the NEHE masking tutorial and code loading a image to a texture with an alpha channel.
This is how it's supposed to look
http://www.blinx.nl/opengl/good.jpg
This is what happens if the
http://www.blinx.nl/opengl/bad.jpg
As you can see the front object isn’t transparent anymore..
What I have tried is enabling / disabling the following options:
glDepthMask(true);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glBlendFunc(GL_SRC_ALPHA,GL_ONE);
I’ve already found a kind of a solution and that is writing a custom depth testing function, I don’t think that’s the best solution… has anyone got a better way of solving this problem??
I have tried the code from the NEHE masking tutorial and code loading a image to a texture with an alpha channel.
This is how it's supposed to look
http://www.blinx.nl/opengl/good.jpg
This is what happens if the
http://www.blinx.nl/opengl/bad.jpg
As you can see the front object isn’t transparent anymore..
What I have tried is enabling / disabling the following options:
glDepthMask(true);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glBlendFunc(GL_SRC_ALPHA,GL_ONE);
I’ve already found a kind of a solution and that is writing a custom depth testing function, I don’t think that’s the best solution… has anyone got a better way of solving this problem??