Jump to content
  • Advertisement


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


A simple problem with blending

This topic is 6519 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
The glDepthMask function enables or disables writing into the depth buffer.

void glDepthMask(
GLboolean 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.
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.

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

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!