Updated JOGL canvas classes to fix shutdown bug. Also added frame rate support.#174
Updated JOGL canvas classes to fix shutdown bug. Also added frame rate support.#1743 commits merged into
Conversation
|
@gouessej: Is it fine to merge this? |
|
@shadowislord Thank you for bumping me about this change. Please wait for a few minutes, I have to digest the salad, the tartiflette and the milk chocolate warmed lava cake. |
|
Personally, I would call animator.isAnimating() before calling animator.stop() and keep in mind that the requested frame rate can be different from the chosen frame rate. |
|
From what I can see, the animator is started in startGLCanvas() and then it is never stopped. In what case will animator.isAnimating() return false? The frame rate support I added is basic but it does work, and I thought it would be better to have some frame rate support rather than none. |
|
It's difficult to imagine how the developers use the public APIs. animator.isAnimating() returns false when the animator hasn't been started, is paused or stopped. I understand your position but I just remind you that FPSAnimator doesn't have a consistent cross-platform behaviour. The vertical synchronization is more reliable. Yes, some support is better than nothing. |
|
The animator is not accessible through any public API. This was the reason I needed to modify the source in the first place. If this is an incorrect assumption please explain how I could gain access to the animator without extending any of the canvas classes. It would be great to have vsync support as well. I did not see any easy way to do this so settled for frame rate setting, which is accurate enough (+- 1 fps) on a Windows 7 OS. |
|
The animator can be stopped in JoglCanvas.display() for example. The vertical synchronisation is already handled here: https://github.com/saloisio/jmonkeyengine/blob/master/jme3-jogl/src/main/java/com/jme3/system/jogl/JoglAbstractDisplay.java#L118 |
|
Is this ok now? |
|
@gouessej have you tested vsync on multiple jme contexts with the JOGL canvas? It doesn't work very well. Only one context is vsynced properly, the other has a very low fps. In my case on a 75 Hz screen I have context one refreshing at ~75 fps and context two refreshing at ~18 fps. When I re-run the test using setFramerate(60) both contexts refresh at ~60 fps. Seems my updates to support setting frame rate is more reliable at the moment. |
|
Your change is ok for me. It's valuable and useful, I don't deny it. As I said, FPSAnimator doesn't have a consistent behaviour across platforms and your update doesn't do anything about that. You need to use a swap group (NV_swap_group) to use v-sync on several canvases / windows: You can look at this unit test based on JOGL and NEWT: |
|
Ok good. So can you merge this? |
Updated JOGL canvas classes to fix shutdown bug. Also added frame rate support.
Changes to JOGL canvas classes to fix stalled shutdown, as discussed on the jme forum: http://hub.jmonkeyengine.org/forum/topic/testcanvas-doesnt-shutdown-with-jogl-renderer/