Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • VTK VTK
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 829
    • Issues 829
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 239
    • Merge requests 239
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • VTKVTK
  • VTKVTK
  • Issues
  • #17975
Closed
Open
Issue created Aug 05, 2020 by Li Zipei@tmxklzp

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

Edited Aug 05, 2020 by Li Zipei
Assignee
Assign to
Time tracking