-
Book Overview & Buying
-
Table Of Contents
OpenSceneGraph 3.0: Beginner's Guide
As already mentioned in earlier chapters, OSG supports vertex arrays and VBO to speed up the rendering process. To manage the vertex data used in these two mechanisms, OSG defines a basic osg::Array class and a few derived classes for commonly used array and index array types.
The osg::Array class can't be instantiated, but it declares interfaces to exchange with OpenGL calls and buffer data modifiers. Its subclasses (osg::Vec2Array, osg::Vec3Array, osg::UIntArray, etc.) inherit the characteristics of the Standard Template Library vector class, and can thus make use of all of the std::vector members, including push_back(), pop_back(), size(), and STL algorithms and iterators.
The following code will add a three-element vector to an existing osg::Vec3Array object named vertices:
vertices->push_back( osg::Vec3(1.0f, 0.0f, 0.0f) );
The OSG built-in array classes should be allocated from heap and managed by smart pointers. However, it is not necessary for the array elements...
Change the font size
Change margin width
Change background colour