dynamic GeomVertexData?


I’ve created a primitive of an isocahedron by setting up my vertices in a GeomVertexData-object, assigning that one to a Geom, then assigning the Geom to a GeomNode and finally by assigning that node to the scenegraph.

All these objects are available in references. Imagine the following case: For example i exchange the color in the color-column in the GeomVertexData for three specific vertices (primitive is GeomTriangles) from red to green. how can i make that change visible in the currently rendered scene, so that my red icosahedron highlights one cell to green?

Just a (re)set_data(…) on the color-column doesn’t work.

You have to get the actual modifiable GeomVertexData pointer with geom->modify_vertex_data(). This in turn requires you to get a modifiable Geom from the GeomNode with node->modify_geom().

You can sometimes get away with keeping the same Geom and GeomVertexData that you used to create the node, instead of extracting a new one from the node; but this isn’t reliable because (a) Panda might replicate one or both of these to suit its internal caching requirements, and (b) you need to call the appropriate modify_*() function anyway to tell Panda that you are making changes and it should update its cache.

Note also that using the color column in the GeomVertexData (as opposed to using an overall color inherited from the scene graph) requires you to have a ColorAttrib::make_vertex() attribute applied to the node or to the Geom.


Hi marsuek,

would you mind share some of you code for creating primitives in panda (c++) ?

I have tried but I keep having some problems here
[url]GeomVertexData, Geom, GeomNode]