How can i find out which surfaces are visible?

Hello,

i want to use opengl (the z-buffer solution)
to find out which surfaces of my 3D building model are visible.
But i’m not expert in openGL.
So do you have any ideas which openGL-function
has to be used to solve this problem?
The surfaces are all polygons. Some of them have polygon holes inside.
How can i tell openGL my polygons?
How can openGL give me a list of polygons that are visible
in the view frustum? It should be just a list with
the polygon ID, not the exact polygon excerpt which
is visible.
Thank you very much for helping!

There are a number of ways to do this, but here’s one that works for 100% opaque objects.

Render them all with depth testing (standard LEQUAL depth testing) and writing. Then go back and re-render them one at a time with EQUAL depth testing and no depth writing. On the 2nd pass, around each polygon render, do an occlusion query. Then at the and collect the occlusion queries and it will tell you the number of samples that PASSED (GL_SAMPLES_PASSED) the occlusion test. That tells you which polygons were visible.

This is just one option, and not necessarily the fastest (but is fairly simple to implement). What are you trying to accomplish with this? Does performance matter or is this all about getting a list for some off-line processing?