Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
I want to update a uniform float every frame. And I have put the code below in a "BeforeDrawAll" function. But it sets the value only once and doesnt set the new value after the first time. So the first round Counter is 1, and the shader set the value correctly. Next frame the Counter variable has gotten bigger, but the shader doesnt change, it still has the same original value. I use the shader from the "Custom materials and shaders" tutorial, I only changed the float value into a "uniform float FragmentExtraColor;" value, which I change with the code below.
Is this the wrong way to update Shader variables in realtime, or am I missing something completly? |
||||
|
Ok, silly me, I should have read the documentation more carefully :-) So I found that I have to use the "Material" event to update the variables in the shader. So, in the beginning I save my own function to the Material-event: Engine getRenderer() Material = UpdateShaderVariables And then it will update the shader as it should! |
|