How would I check if an object drawn in openGL-ES is visible?
+1
A:
You don't check IN OpenGL if an object is visible.
You must have your own visibility/culling algorithms to do that. That means BSP Trees, Portals, Octree and others. Depending on the complexity of the world you can get away with an space partitioning based on an grid or something. It really depends on what you are doing.
Remember, OpenGL knowns only to Draw and to Cull.
You can do a loop on all objects in your world and tell GL to draw them all one by one. Each one will be process and discarded if not in view. Of course this is brute force and slow.
Hence the need for more encompassing algorithms for culling.
Why do you think Graphic Engines have all those million lines? :D
Rui
2010-08-05 09:21:31
You _can_ check visibility in OpenGL. People use Occlusion Queries for that. But this is not available in OpenGL ES.
Bahbar
2010-08-05 10:03:25
I think Occlusion Queries are an ARB extension, not GL spec. In any case depending on the application you might not want/can have all of your geometry in the GPU memory.
Rui
2010-08-05 12:06:58
OQ are an extension in openGL, not OpenGLES, even 2.0
Calvin1602
2010-08-05 12:39:56
OQ are core in GL 1.5
Matias Valdenegro
2010-08-05 15:37:50