Indexing primitives
The osg::DrawArrays
works fine when reading vertex data straight through the arrays, without any skipping and hopping. However, it tends to be a little inefficient if there are lots of shared vertices. For example, in order to make osg::DrawArrays
draw a cube with eight vertices in the GL_TRIANGLES
mode, the vertex array should repeat each vertex a couple of times and should increase the array size to 36 (12 triangle faces) at last:
The osg::DrawElementsUInt
class, as well as osg::DrawElementsUByte
and osg::DrawElementsUShort
classes, are used as index arrays in order to solve the above problem. They all derive from osg::PrimitiveSet ...
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.