Jump to content

  • Log In with Google      Sign In   
  • Create Account

Clearing alpha channel + depth buffer


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 thecoast47   Members   -  Reputation: 255

Like
0Likes
Like

Posted 30 November 2011 - 01:57 AM

Hi can anyone tell me how to add geometry to the depth buffer but at the same time leave the framebuffer untouched?
Right now Im doing this:
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_NEVER);
for(int K = 0; K < ConvexHull_list.size();K++){
 ConvexHull * CH = ConvexHull_list[K];
 CH->Render();
}
glDisable(GL_DEPTH_TEST);

Also,how do I reset the alpha channel(to 0) in the framebuffer without disturbing the rest of the values in the framebuffer?
I was going to render a quad with glColor4f(0,0,0,0);
But I dont think doing that by itself clears only the alpha values in the framebuffer.

Sponsor:

#2 gdmarkou   Members   -  Reputation: 332

Like
1Likes
Like

Posted 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






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS