-
Notifications
You must be signed in to change notification settings - Fork 17
Description
I have returned to using DriftFX to have custom OGL rendering inside JavaFX windows, and have run into some odd behavior that resembles something I described in a past comment.
Before I describe my experience right now, let me describe what I have experienced in the intervening months using DFX, as it may well be relevant:
- There appears to be a very narrow window during which it is valid to initialize DFX relative to JFX, and with these operating largely independently, this is ultimately relying on a race condition. In particular, I have the DriftFXSurface in my GUI Controller class along with the other "named" FXML elements, and it is initialized as that controller is built. The
GLRenderer.getRenderer()call is then performed on that surface, waiting on it to be non-null if the JFX initialization has not yet constructed it. However, delaying or accelerating the JFX initialization nonetheless seems to break this system. This may be related to the next two points. - The surface seems to often initialize with a size of zero if the timing is wrong, resulting in a useless renderer. I can simply defer the
createSwapchaincalls until this is nonzero, but that never appears to occur if it does initialize with zero. - Forcibly recreating new swapchains does not appear to work as expected; intuitively I expected, perhaps wrongly, that I can arbitrarily discard the old chain and request a new one, but while the actual swapchain request does seem to work, the result is an empty renderer. I seem to recall one of your examples having a dropdown to choose the TransferType, the changing of which requires a new swapchain, so I am somewhat puzzled as to what is going wrong here.
At any rate, at the present, I have for the first time tried exporting my project out of eclipse into a standalone jar file. After some pain getting JFX and lwjgl to work, I promptly experienced a functional JFX GUI but with an empty DFX render pane, alongside the warning that the size of the render surface was zero (and thus we should expect point 2 above to apply).
This may all be due to error(s) on my part, or there might be an actual issue here.
Here is my actual render loop, which handles both the DFX initialization (based on the surface in the GuiController) and the drawing on said surface:
https://github.com/ReikaKalseki/GameCalendar/blob/master/src/Reika/GameCalendar/Rendering/RenderLoop.java