husker-dev / openglfx

OpenGL implementation for JavaFX
Apache License 2.0
80 stars 10 forks source link

Sometimes rendering freezes #9

Closed orange451 closed 2 years ago

orange451 commented 2 years ago

On my M1 Macbook, sometimes when the application starts, rendering will halt after a second or two. There are no errors, just the rendering callback is no longer firing.

If I resize the window, rendering is called, but only for the frames it is being resized.

This happens with default LWJGL DIRECT example

orange451 commented 2 years ago

Should note that this is also on Java 17. Using JDK provided by default from Eclipse.

husker-dev commented 2 years ago

How often does this happen? This problem is due to the node's update flags that tell JavaFX that it needs to be redrawn. I thought I fixed it in one of my latest updates... Maybe I’m missing synchronization to change values

orange451 commented 2 years ago

It is hard to gauge how often it happens. It does seem to be related to the app being booted though. I let it run for two hours yesterday and it never froze, then I restarted and it froze after 1 second. It's very intermittent.

orange451 commented 2 years ago

I changed maven to use JavaFX version 17. This seems to reduce how often the application rendering freezes. However it still does rarely occur.

orange451 commented 2 years ago

I have tried this on my intel-based macbook as well. Using JavaFX 17 with JDK17, I am still seeing the freeze issue (though very rare).

Repro: https://github.com/orange451/OpenGLFX-LWJGL-Sample

husker-dev commented 2 years ago

I fixed this problem. But fps is now based on AnimationTimer speed.

orange451 commented 2 years ago

Hello, I tried out the new build. I think getFps() and getDelta() are swapped? Delta is returning whole numbers that seem to match what FPS I have set the application to run at. getFPS() is returning small numbers which look like frame-delta-times.

(Can use Same Repro above to test)

husker-dev commented 2 years ago

Yeah, I didn’t see it. Will fix it now

husker-dev commented 2 years ago

Fixed in the last release