How can I set uniforms of shader dynamicly in Python VTK?
I want to change the value of some uniforms in vertex and fragment shader dynamicly, but I couldn't find a solution in Python VTK. I read this example(https://gitlab.kitware.com/vtk/vtk/blob/v7.0.0.rc2/Rendering/OpenGL2/Testing/Cxx/TestUserShader2.cxx), and tried to get the shader program or vtkOpenGLHelper
, but found that there isn't additional arguments, such as below:
my_mapper = vtk.vtkOpenGLPolyDataMapper()
# my_mapper.AddShaderReplacement .......
def onUpdateShader(the_mapper, event, *arguments):
print(arguments) // length is 0
my_mapper.AddObserver("UpdateShaderEvent", onUpdateShader)
And I read the emails, documents and so on but found nothing. So could you tell me how can I set the uniform value dynamicly when I interact with my renderwindow or using a timer? Thanks a lot.
My platform: windows10, anaconda, vtk8.2.0