Skip to content

How to bind arbitrary uniforms from code? #289

Answered by pragma37
panthavma asked this question in Q&A
Discussion options

You must be logged in to vote

You can do:

CustomMaterial.shader['MAIN_PASS'].uniforms['paramLocal'].set_value(5.0)

If you modify the value after binding the material you would have to call GLUniform.bind too:

CustomMaterial.shader['MAIN_PASS'].uniforms['paramLocal'].bind()

Here's the GLUniform class:
https://github.com/bnpr/Malt/blob/Development/Malt/GL/Shader.py#L77

For an example on how to use UBOs, you can check the CommonBuffer:
https://github.com/bnpr/Malt/blob/Development/Malt/Render/Common.py

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@panthavma
Comment options

Answer selected by panthavma
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants