Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does opengl render objects that are not in view?

Tags:

opengl

For example if I draw a cube and turn my character around so as to face away from the cube does it use CPU/gpu processing to draw it even though it is not on screen? Do I as a programmer need to be smart enough to not make opengl draw calls if an object is not on screen or very far away?

like image 589
Xavier Avatar asked Sep 16 '10 15:09

Xavier


2 Answers

It doesn't render them as such, but it does use resources which I believe is what you're asking. Yes, you do.

You're probably after frustum culling:

  • http://www.flipcode.com/archives/Frustum_Culling.shtml
  • http://cgvr.cs.uni-bremen.de/teaching/cg_literatur/lighthouse3d_view_frustum_culling/
  • https://en.wikipedia.org/wiki/Hidden_surface_determination#Viewing_frustum_culling
like image 168
Rushyo Avatar answered Nov 15 '22 13:11

Rushyo


Yes. All vertex data sent to OpenGL will consume resources, regardless of whether or not the corresponding geometry is in view. As suggested above, frustum culling is an optimization that identifies objects that will not be in the view volume and ignores/culls its vertex data. Thus, if the vertex data is never submitted to the GPU, then it will never be processed by the GPU.

like image 27
Alex Wood Avatar answered Nov 15 '22 11:11

Alex Wood