Chapter 4

Results of different primitive types

The OpenGL documentation and some web tutorials can explain them clearly: http://www.opengl.org/sdk/docs/man/xhtml/glBegin.xml.

There is also an osggeometry example in the OSG source code, located at examples\osggeometry.

Optimizing indexed geometries

If you are drawing in GL_TRIANGLES mode without indexing, there will be up to 24 vertices allocated. GL_TRIANGLE_STRIPS works fine while triangles are connected in groups. For the case of representing an octahedron, we could use a triangle strip primitive set (2, 5, 3, 4, 1, 0, 2, 3, as shown in the figure in the Drawing an octahedron section) and two single triangles (4, 0, 3, and 5, 2, 1) to implement the same result.

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.