How Does OpenGL Treat Off Screen Items?

Started by
1 comment, last by blizzard999 18 years, 8 months ago
When OpenGL draws, how does it treat item outside of the view. If one uses glortho to define a space of 800x800x0, what happens if one defines a triangle at say 1000, 1000, 1000, 1500, and 1500, 1000. Does OpenGL ignore it, or is it the user's responsibility to remove the triangle from any drawing list/routine. What happens when the part of the triangle is within the view space and part is not? Let say one of the triangle points was at 700, 500 within the view space. Thanks.
Advertisement
OpenGL will 'clip' polygons that are partially offscreen, only rendering the visible part. It will also ignore polygons you draw totally off the screen. So it's not really a problem. However if you have ways of rejecting groups of hidden polygons before sending them to OpenGL (eg. a model which is entirely offscreen doesn't need any of its polys rendering), then you're best off not sending them at all, for the sake of efficiency.
Quote:Original post by Kylotan
OpenGL will 'clip' polygons that are partially offscreen, only rendering the visible part. It will also ignore polygons you draw totally off the screen. So it's not really a problem. However if you have ways of rejecting groups of hidden polygons before sending them to OpenGL (eg. a model which is entirely offscreen doesn't need any of its polys rendering), then you're best off not sending them at all, for the sake of efficiency.


Good advice. You should note that Kylotan wrote groups of hidden polygons.
In practice you should 'cull' invisible geometry if this is efficient and fast (at least test bounding box of complex objects not single triangles).

OpenGL will cull the geometry after vertex transform but before fragment rendering (probably there is also a second cull in screen space but I'm not sure)

This topic is closed to new replies.

Advertisement