View Full Version : When all vertices have the same Z-position the performance drops heavily

10-04-2013, 01:27 PM
Hi there.
I was fooling around with OpenGL a little and was just doing some random performance tests to see how far my hardware can go.
After creating random vertices for about one million triangles I still had a constant 60 frames per second. Which is nice.
However, I once tried to set the Z-coordinate for all vertices to 0.5 (x and y are still random) and suddenly the frame rate dropped like crazy. I hardly got 200 000 triangles until my frame rate started to drop.

The depth buffer function I used was GL_LESS. I use orthogonal projection by the way.

Why is that? What is causing so much trouble if all vertices share the same z position?
Thanks for all your answers.

10-04-2013, 01:50 PM
Since your vertices positions are generated randomly, many of them are huge and completely cover others. In this case, early Z gains huge speed boost because most of the pixels are not drawn. The second test probably blocks early Z and all pixels (or most of them) are drawn. Neither of those test would give you any useful information about your graphics card. Try to make some more realistic ones.