For example in vtkPolyDataVS.glsl
attribute vec4 vertexMC;
I want to add another attribute like vertexMC;
These operations need to be placed in the shader.
I now call back the code data based on the PloydataMapper-CallBack. I think this processing can add uniform and attribute to the shader in Mapper; how to add attribute I have no clue, I just found these codes,
All the shader replacements happen before any attribute values are passed by the mapper. You should be able add a replacement for one of the Dec tags like:
Thank for your reply.
My idea is similar to what you think. I use mapperViewProp.addShaderReplacements to replace code in shaders.And,Get VAO by using PloydataMapper CallBack, and then call addAttributeArray.
Like this:
But for passing data for the attribute, I did not find the corresponding parameter in addAttributeArray.
Maybe I don’t understand the code well enough. I hope you can give me some clear suggestions.
Looking forward to your reply!
I looked up the definition of VAO (details on how the data is stored and how to use it), if you want to import data you need to use a VBO (the vertex buffer object is responsible for the actual data storage).
The specific details are being advanced. If you have any better suggestions, I hope to share and discuss together!
Looking forward to your reply!
Yes, there are attributes in both the polydata and volume mappers. If you’re asking about adding attributes via replacement shaders, I don’t think there is an existing example of it.