Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

opengl frustum culling without glGet* calls

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?

like image 851
Andreas Avatar asked Dec 29 '22 16:12

Andreas


2 Answers

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 ...

like image 54
Goz Avatar answered Jan 12 '23 23:01

Goz


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

like image 44
visor Avatar answered Jan 12 '23 23:01

visor