Handling rendering order

Before starting to explain how to handle rendering order in OSG, we'd better understand what rendering order is and how it works in OpenGL.

OpenGL stores vertex and primitive data in various buffers, such as the color buffer, depth buffer, stencil buffer, and so on. Apart from this, it doesn't record vertices and triangles already sent to it in any other form. Therefore, OpenGL always renders new geometry primitives regardless of tracing old ones, which means that the order in which these primitives are rendered is significant.

With the help of depth buffer, opaque objects can be rendered correctly and the rendering order of these objects doesn't matter in simple cases, because the default depth test passes the incoming ...

Get OpenSceneGraph 3.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.