views:

468

answers:

2

Various examples of view frustum calculations are using glGetFloatv() to get the current projection and modelview matrices (GL_PROJECTION_MATRIX, GL_MODELVIEW_MATRIX), and based of that do some view frustum culling.

I have read that glGet* is something you do not want in your main render loop;

"Using "Get" or "Is" functions slows down render performance. These commands force the graphic system to execute all queued OpenGL calls before it can answer the "Get" or "Is" query."

So my question is. How do I create a solid Frustum culling algorithm in my code and where do I put it in order to ensure that this stalling never happens?

+5  A: 

You could always store the current matrices in your app so that when you want them you don't need to make a glGet call, you can just grab them ...

Goz
+2  A: 

http://www.lighthouse3d.com/opengl/viewfrustum/

visor