Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!

1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Member Since 01 Jun 2008
Offline Last Active Feb 20 2014 02:38 AM

#4889009 Clearing alpha channel + depth buffer

Posted by gdmarkou on 30 November 2011 - 03:02 AM

You are looking for glColorMask

Drawing to depth buffer only.
Your code should look like :
glColorMask (GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); //disable write to color-buffer

glDepthFunc(GL_LEQUAL); // or whatever

//render everything

glColorMask (GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); //enable write to  color buffer

For resetting the alpha channel only :
glColorMask (GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE); //only write to alpha
glDisable (GL_DEPTH_TEST);

//Render a full-screen quad with alpha=whatever you want