Time for action - drawing a geometry dynamically

It is common practice to modify geometries' vertices and primitive attributes dynamically. We can change the position, normal, color, and texture coordinate of each vertex, as well as related primitives per frame, in order to implement kinds of morph animations. During the modifications, it is important to keep an eye on the data variance, because the draw traversal might be running while updating vertices and primitives, which might cause conflicts and even crashes.

In this example, we will make use of the quad geometry that was created in Chapter 4, Building Geometry Models. We will simply alter its last vertex and make it rotate around the X axis, which results in a simple animation effect.

Get OpenSceneGraph 3.0 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.