How can I draw the surface to only Z-buffer?
In order to draw the surface to the depth buffer but not the color buffer,
How can I implement the effect?
Re: How can I draw the surface to only Z-buffer?
With glColorMask(r, g, b, a), where r, g, b and a is a boolean value (GL_TRUE or GL_FALSE). If r is GL_FALSE, then no red colorcomponents will be drawn, if g is GL_FALSE, green wont be drawn... and so on.
So calling glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE) will disable ALL writings to the framebuffer.