Reinitializing of UniformControlView when shader changes
GLSL shader prototyping tool based on Eclipse IDE.
Brought to you by:
r-e-v-e-r-s
Please add an option to reinitialize the UniformControlView from an jsx file, so I can update the controls when I change the shader-program. Ideally this should preserve the values changed in the controls for the same uniforms used in the new shader-program.
Do you use GLSLProgram created by ProgramFactory object? (like in this example: program-factory.jsx (sourceforge.net)).
It has convenient methods for setting uniform variables (see GLSLProgram.html (synthclipse.sourceforge.net)). If you would use one of them, Uniform Controls View should be updated automatically.
You can find example of using setUniform methods in: geometry-factory.jsx (sourceforge.net)
I actually used geometry-factory.jsx as an example.
My use-case is having a scene where I can switch the shaders (texture-synthesis algorithms) using the combobox control, but if I use JSSynthclipse.createControls(program) when I recreated the shader program, the changes do not appear in the UniformControlsView.
I checked your source and as far as I understand, it can't change after being initialized and createControls just adds the uniform controls to a list used in initView().
Edit for clarity: I really recreate a ShaderProgram using the ProgramFactory, attach the new .vert and .frag shaders, link and use it in the display callback when the combobox changes...
Last edit: Mathias Henze 2015-01-21
There is 'hidden' event system in the Uniform Controls. When you set some value for an uniform variable (using GLSLProgram.setUniform()) it suppose to trigger an event which should be captured by a Uniform Control Widget. Then the Widget should be updated automatically.
I'll check why this doesn't work and I will try to fix it. Maybe I will also add an method for explicit Uniform Controls View update.
The fix will be available in Synthclipse 0.9.12, which I will release probably on weekend.
I think we still don't get each other. :)
My problem is not, that the values of the uniform won't update. The problem is that I load, link and use a different shader program at runtime with different uniform variables (not only values) and there is no way to change the set of displayed uniform controls, once the view is initialized.
Ok, now I get it. I will add some method to reinitialize Uniform Controls View at runtime.
I've added following methods:
Synthclipse.removeAllControls();
Synthclipse.removeControls(program);
Synthclipse.refreshControls();
and I have made:
Synthclipse.createControls(program);
more dynamic, working on runtime.
Do you think this will fulfill your needs?
Will check, once the release is out - thank you very much!
The release is ready. Please check it out and let me know if it is ok now.
Works great, thanks a lot! Now I can do
it even remembers the values from the last time the uniform was adjusted: GREAT!
Btw. I consider this ticket resolved, so you can close it (I can't)
Nice to hear now everything works as expected :) Ok, I will close this ticket now.