How to change the color of a Quad created with vsg::Builder #1211
-
Hello everyone, Thanks for your help. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Changing the colour will require updating the material uniform or the colour vertex array, in each case there is a data object that you'll need to change on the CPU side and then have this transferred to the buffer on the GPU that the rendering uses. The VSG will setup the GPU side for you in the initial compile traversal setting up vsg::BufferInfo that associate the CPU side vsg::Data with the GPU side vk/vsg::Buffer and the location in the buffer that the data is mapped to. When you want to dynamically update the data after it's been transferred to the GPU you need to tell the VSG that the the data is dynamic upfront via the vsg::Data::properites.dataVariance setting it to vsg::DYNAMIC_DATA or with recent versions of the VSG you can leave the data as as it's default STATIC_DATA and assign the BufferInfo to the vsg::TransferTask after it's been updated. It's worth reading the vsgTutorial, in particular the section on dynamic data. I haven't had a chance to add the new details of using the vsg::TransferTask for one off updates, so you'll need to read my post that I wrote on implementing this new feature: #1142 |
Beta Was this translation helpful? Give feedback.
Changing the colour will require updating the material uniform or the colour vertex array, in each case there is a data object that you'll need to change on the CPU side and then have this transferred to the buffer on the GPU that the rendering uses. The VSG will setup the GPU side for you in the initial compile traversal setting up vsg::BufferInfo that associate the CPU side vsg::Data with the GPU side vk/vsg::Buffer and the location in the buffer that the data is mapped to.
When you want to dynamically update the data after it's been transferred to the GPU you need to tell the VSG that the the data is dynamic upfront via the vsg::Data::properites.dataVariance setting it to vsg::DYNAMIC_…