Replies: 1 comment
-
To dynamically update data, be it vertex arrays, uniforms or texture data you'll need to set the data's properites.dataVaraince to vsg::DYNAMIC, then call data->dirty() after each time you update the data. The vsgdynamicvertex, vsgdynamictexture, vsgdynamictexture_cs and vsgclip examples all illustrate updates of vertex arrays, textures and finally uniforms. Look through these examples so see where the data->properties.dataVariance is set and dirty() are called. None of these examples use vsg::Builder to create their scene graphs, the use of vsg::Builder complicates things a little as it generates all the vertex data for you so you don't have direct access to them. What you'll need to do is traverse the subgraph created by vsg::Builder to find the vsg::Data that they created, you can then change the properties to vsg::DYNAMIC_DATA. The dynamic data update scheme the VSG provides uses the vsg::TransferData class, the the viewer manages for you, to check which dynamic data have updated and need to be transferred to the GPU. The Viewer::compile() traversal finds the dynamic vsg::Data in the scene graph for you so make sure you do the setting of the properties.dataVariance prior to calling viewer.compile(). If are creating your scene graph objects on the fly then you'll need to use the vsg:::CompileManager to compile the objects for you after you create them, this is whole another topic so I won't complicate this post with other info you might not need. For now just know that the VSG has support for this and if you need then you can look this up when you need to. |
Beta Was this translation helpful? Give feedback.
-
Hello everyone, I am currently using vsg to draw a basic geometry and text. For example, I use builder::createBox to draw a white cube, and vsg::Text to draw white text. Now I want to dynamically change the color properties of the cube and text during the rendering loop, but I'm not sure how to achieve this. Can someone provide me with some guidance?
Beta Was this translation helpful? Give feedback.
All reactions