vertex visibility test

I’m rendering a triangle mesh using opengl.
What I want to know is if each vertex on the mesh is visible (that is, not occluded by any triangles of the mesh) at a given viewpoint. Is there any way (fast or slow) to perform this visibility test?
Any help would be appreciated!

I think you can render it twice right after clearing the depth-buffer. Set stencil-op to inc on depth-fail. If you get any values > 0 in the stencil buffer you have some kind of overdraw, so some part of your mesh is obscured .

Jan

[Edit] Didn’t read that you wanted to test for the vertices only. You could do the second render in GL_POINT-mode. You might need to use polygon-offset though since the rasterizer can create slightly different depth-values for pixels rasterized with GL_POINTS instead of GL_TRIANGLES.

[This message has been edited by jeickmann (edited 02-24-2004).]

Thanks. For it to make work, I think I need to know the 2D position of each vertex in the stencil buffer. Otherwise, I should read the whole stencil buffer after rendering each vertex (using glReadPixels which is very slow). Any suggenstion?

gluProject()