Hi this is an GLSL blender question…
Well I would like to know if I can set more than one uniform floats/ints that are controlled from inside of blender…which aren’t specifically timers…? Here are 2 code snippets
the first one from the beginning of the vertex shader:
VertexShader = """ <b> uniform float time;</b> <b> uniform float scale;</b>
the part of the blender script that should hook the two togethor…
shader = mat.getShader() if shader != None: if not shader.isValid(): shader.setSource(VertexShader, FragmentShader,1) <b>shader.setUniform1f('time', obj.time)</b> <b>shader.setUniform1f('scale', obj.scale)</b> shader.setSampler('color', 0) print time()
okay the (‘time’, obj.time) gets the timer property from the object the script is attached to… so I’m assuming that shader.setUniform1f(‘scale’, obj.scale) should get the property called “scale”… which is also attached to the object… note the timer one works.
when I do this, I get a syntax error? Which makes no sense to me… I can’t see any problems with the syntax… maybe I’m missing something…? Can anyone help with this please…:eyebrowlift2: Can you only use time properties with the GE and GLSL?
SyntaxError: invalid syntax PYTHON SCRIPT ERROR: File "GLSL_Swave_Plight",148 shader.setUniform1f('scale',obj.scale) ^
I want to be able to pass information from blender to the GLSL shader to control it… say you press a key and the shader changes…?:evilgrin: This would be so cool if I could get it working…