Jump to content

  • Log In with Google      Sign In   
  • Create Account


gdmarkou

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
glDepthMask(GL_TRUE);

glEnable(GL_DEPTH_TEST);
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);
glDepthMask(GL_FALSE);

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




PARTNERS