A simple problem with blending
I draw my whole 3D sene first, then I add the transparent objects like an explosion wave. But there is an problem: I could disable the depth test, but then you will see this transparent Object throught other solid objects, if you enable it, the other transparent objects behind the blendet object are not drawn because they are clipped by the depth test... Now my question:
- Is there any way to tell OpenGL that it should only check if a pixel is in the z buffer about another pixel and not update that z pixel position if an transparent pixel is drawn?
Please HELP!
glDepthMask
The glDepthMask function enables or disables writing into the depth buffer.
void glDepthMask(
GLboolean flag
);
Parameters
flag
Specifies whether the depth buffer is enabled for writing. If flag is zero, depth-buffer writing is disabled. Otherwise, it is enabled. Initially, depth-buffer writing is enabled.
Remarks
The following function retrieves information related to glDepthMask:
glGet with argument GL_DEPTH_WRITEMASK
Error Codes
The following are the error codes generated and their conditions.
Error Code Condition
GL_INVALID_OPERATION glDepthMask was called between a call to glBegin and the corresponding call to glEnd.
QuickInfo
Windows NT: Use version 3.5 and later.
Windows: Use Windows 95 and later.
Windows CE: Unsupported.
Header: Declared in gl.h.
Import Library: Link with opengl32.lib.
See Also
glBegin, glColorMask, glDepthFunc, glDepthRange, glEnd, glGet, glIndexMask, glStencilMask
that is taken from the msdn-library, wich has a nice opengl sector.. i think this should help you..
but be warned, the function dont work on every gpu correctly.. why ever (i never seen anything wrong, but they sayd in the forum here..)
other way is to sort the transparent objects by depth..
we wanna play, not watch the pictures
The glDepthMask function enables or disables writing into the depth buffer.
void glDepthMask(
GLboolean flag
);
Parameters
flag
Specifies whether the depth buffer is enabled for writing. If flag is zero, depth-buffer writing is disabled. Otherwise, it is enabled. Initially, depth-buffer writing is enabled.
Remarks
The following function retrieves information related to glDepthMask:
glGet with argument GL_DEPTH_WRITEMASK
Error Codes
The following are the error codes generated and their conditions.
Error Code Condition
GL_INVALID_OPERATION glDepthMask was called between a call to glBegin and the corresponding call to glEnd.
QuickInfo
Windows NT: Use version 3.5 and later.
Windows: Use Windows 95 and later.
Windows CE: Unsupported.
Header: Declared in gl.h.
Import Library: Link with opengl32.lib.
See Also
glBegin, glColorMask, glDepthFunc, glDepthRange, glEnd, glGet, glIndexMask, glStencilMask
that is taken from the msdn-library, wich has a nice opengl sector.. i think this should help you..
but be warned, the function dont work on every gpu correctly.. why ever (i never seen anything wrong, but they sayd in the forum here..)
other way is to sort the transparent objects by depth..
we wanna play, not watch the pictures
If that's not the help you're after then you're going to have to explain the problem better than what you have. - joanusdmentia
My Page davepermen.net | My Music on Bandcamp and on Soundcloud
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement