Get list of visible vertices


I want to retrieve from my object, the list of its visible vertices.
I find that page which explain the Query object feature:

I don’t know if this feature is usefull for what I want ?
I want to try a simple example, is there a simple c++ example available?

OpenGL is mostly an API geared for rendering, not so much for geometry processing, so you’ll have to find a way to express your problem or rather its solution in terms of the operations the API offers. For example determining visible surfaces (as opposed to vertices) is something that has a clear solution in OpenGL - the depth buffer - since that is what is needed for rendering anyway. Off hand I’m not sure how to best get visible vertices.
The wiki has a links to tutorials with plenty of examples to get you started with OpenGL.

Thank you for the answer. I will take a look to the link.
I tkink I find a solution but I don’t know if I am right.

I have the depth buffer, the list of vertices and the position of my object.
For all pixel on my image I list the potential vertices viewable at that pixel.
Then for each pixel I sort the list at each pixel according to their distance to the camera.
My visible vertice at that pixel is the clothed vertice?

Probably not. If you render the object’s vertices as GL_POINTS, you can use a query object (for GL_SAMPLES_PASSED​) to determine how many of those points were rendered, but it won’t tell you which ones.

But you could use
layout(early_fragment_tests) in;
on the fragment shader then record the current primitive ID in a SSBO, using an atomic counter for the index. The early_fragment_tests option forces the depth test to be performed prior to executing the fragment shader, so if the fragment shader is actually executed then you know that the depth test passed.

You can use glColorMask, glDepthMask and glStencilMask to prevent anything from being written to the framebuffer.