Jump to content

  • Log In with Google      Sign In   
  • Create Account

Calling all IT Pros from Canada and Australia.. we need your help! Support our site by taking a quick sponsored surveyand win a chance at a $50 Amazon gift card. Click here to get started!


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