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.
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
Al alternative might be to put a glDrawPixels call into a display list; make sure that you use the same format and layout as your color buffer has and it should go quite fast.
Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.