Slow down Update loop

I developed a simple Swing 2d and 2.5d renderer but as it was a software mode (CPU) renderer, it consumed much for few output. So I switched to Jmonkey but it uses much more CPU for redundant updates I have a simple scene with more than 800 fps but it consumes all two threads of my CPU and no room for my main Swing app! Is there any way to prevent reckless update? As far as I know Opengl (C++) has sleep(float) method to do that.

Just enable vsync

you can cap the framerate by using setting.setFrameRate(whatever) or you can enable vsync and that will cap the update loop to whatever refreshrate your monitor has.

Well vsync didn’t work maybe my monitor refresh rate is so high but “setting.setFrameRate(whatever)” worked. Thanks @nehon but is there any method to do that inside the app like “sleep(float var)” that I said? I mean using a variable inside the app to do that.

thats what setFrameRate does, any reason you want to do it manually?

No setFrameRate is sufficient but I just wanted to know. It seems that it could be accessed by native interface! Isn’t it @normen? If I wanted to access native interface, it was better to use C++ instead of jmonkey!

assembler would be even better according to that logic?

Thanks @normen and @nehon for your fast replies. I hope I had searched enough to avoid duplicate question and bothering you. Sorry for my offtopic reply @normen I got my answer don’t want to bother anymore. Thanks again :smile: