the depth buffer and transparent polygons

I was wondering if using glReadPixels(…, GL_DEPTH_COMPONENT, …) will work with a transparent polygon.

For example, if I have a cube textured with transparent parts using blending (GL_ONE, GL_ONE for example), parts of the cube are fully transparent so you can see the geometry behind them. However, does the depth buffer still say that the cube is solid? Is there a way to determine whether an object behind the cube is visible?

You will only read a single value back from the depth buffer, that value would be the last depth value written. A depth value will always be written (assuming the fragment is drawn) unless you mask the depth buffer.

There are some things that may work for you depending on your circumstances and requirements. You could read the alpha buffer, you could read the color buffer, or you could read the stencil buffer.

None of these offers a strightforward answer, stencil is probably the best bet if you have limited objects by using a stencil masks.

None of these will give you a depth value unless you mask the depth writes when you draw the transparent stuff.