Does opengl provide objects that are not displayed?

For example, if I draw a cube and rotate my character to look away from the cube, does it use CPU / gpu processing to draw, even if it is not on the screen? Should I, as a programmer, be smart enough not to make opengl call calls if the object is not on the screen or very far away?

+4
source share
4 answers
+3
source

Yes. All vertex data sent to OpenGL will consume resources regardless of whether the corresponding geometry is located. As suggested above, dropping truncation is an optimization that identifies objects that will not be in the scope of the view and ignores / selects its vertex data. Thus, if vertex data is never sent to the GPU, it will never be processed by the GPU.

+2
source

You can enable the 'scissor test' to draw a picture against the scissors rectangle.

However, this does not stop the rest of the code in your drawing, so if your scene is not quite simple, you usually want to learn more complex methods.

Octrees and BSP trees are a good place to start.

+1
source

Yes, GL discards pixels that are out of sight, but which still consumes resources because it is per pixel. Skipping invisible primitive drawing calls is a much better approach.

+1
source

All Articles