• Advertisement

Archived

This topic is now archived and is closed to further replies.

A simple problem with blending

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

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!

Share this post


Link to post
Share on other sites
Advertisement
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

Share this post


Link to post
Share on other sites

  • Advertisement