Use of glsl shaders

Hi,

a solution for that is Thread.sleep in the simpleUpdate(). But not a satisfying one, I think.



Andreas

You need to limit the Frames per Second to 60 or something.



in SimpleGame you can do this by calling: display.setVSyncEnabled(true);

For my information does it limit to 60 frames per second or does it adapt the refresh time to the monitor frequency (i.e. 60, 75, 85, 100 frames per second)?

Hi,

display.setVSyncEnabled(true); helps a bit, if the calculations are not too GPU intensive. Thread.sleep also reduces the fps.



Best,

Andreas

Hi,

looking at javadoc, it depends of the monitor and is dependant of the OS.



Andreas

Hi,

I just found out, it's better to use while and not for loops in glsl.



Andreas

Can you give a code example?



If you use while in glsl shader, how can it affect CPU? The shader is run in GPU, right?

Hi,

here is the code example: http://www.jmonkeyengine.com/jmeforum/index.php?topic=8314.0.



And yes, the shader runs at the GPU. You have the same problems at the glsl tutorials. Perhaps the next simpleUpdate() is called before the GPU has finished the calculations of the step before. But, I have no sure explanation. My application runs in JMECanvas which is repainted in a thread with Thread.sleep(1). So, the cpu usage shouldn’t be so high. while is faster at my system. BlackBluegL told be that’s because of the driver. Because the shader is faster now, the cpu usage goes down. Is there a way to ask the gpu, if the calculations are done?



Andreas