Skip to content

Mesh Dynamic

App: apps/mesh_dynamic/

Demonstrates a dynamic mesh: a circle built as a trianglestrip whose vertices are updated every frame (radius and colors animated), then flush() is called so the GPU sees the changes.

Terminal window
% ./plume3d mesh_dynamic

or

Terminal window
% ./../plume3d .
  • Creates a trianglestrip with 50 vertices forming a circle (initial radius 0.5).
  • Each frame: recomputes position (radius = 0.5 + wave) and color per vertex, then:
    • _mesh.setVertexAttribute(i, "px", x), "py", "r", "g", "b".
    • _mesh.flush() to upload changes to the GPU.
  • Draw mode: "trianglestrip".
  • GraphicsloadShader, newMesh, drawMesh.
  • MeshsetVertexAttribute, flush.
  • Mathcos, sin.