Hello,
I’m currently making a sailboat game using JME.
I have made shaders in order to animate some parts of the scene like flags and boat sails.
As I wanted the flags and the sails to have different behavior when the wind changes, I modify some material parameters in the update loop (in a custom control to be more precise).
I have carefully followed the shaders video tutorial and my shaders are working well until all the memory is exhausted…
I realized that the problem was also present in the video tutorials.
In the video, some parameters are passed to the shader via the material in the update loop in order to control the shader.
If you carefully look at the video, you will see that the stats show a growing number of OpenGL memory objects (the Shaders (M) line). The problem is visible at 12m41s.
[video]http://youtu.be/XO8y6cmGiFM?t=12m41s[/video]
I have the same problem, and when the number of shaders in memory is around 35000 then the memory usage is about 2GB for the process and the game stops.
I understand that modifying material parameters in the update loop is causing a recompilation of the shader and it’s slow and causes memory problems, but after searching the forum and the documentation, I couldn’t find a solution.
So my question is: how can I modify variables of the shaders in the update loop like the engine does with attributes instead of modifying uniform variables.
Thanks in advance.
Eric.