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.

  1. Include ...

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.