-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Empty DFX pane, maybe depending on exact execution timings #45
Comments
Any info on this one? I saw your sibling comments with calendar app example which I used as a blueprint and it flawesly works in windows context with d3d nxv (don't recall the exact name) swapchain target. However when I use it on Linux with main memory target my results same as yours, empty black pane or sometimes like some race condition ( but code is like yours with two threads and working fine on windows) it shows the content of my gl render calls and flickering with black like crazy, very rare it's good non flicking gl image but in all cases it's stuck, not updating despite thread works, acquire and framebuffers and textures are ok. It seems there is some issue with that surface drift fx texture aquire. Initially I though it could be vbox as I test it there but all other gl apps work fine, I switched to native env - same behavior, I'm on latest arch Linux, Nvidia 1080 ti, tried noveau, Nvidia and Nvidia dkms drivers no change. Fx is forced to GPU usage es2 pipeline is found by prism, when I call same gl commands as with windows I don't have any gl error, logs or exceptions. Will try to debug swapchain aquire method further as I believe the problem somewhere there. I had plenty errors with missing add-opens for fx graphic module but it also was fixed and windows started working (but at that stage I had error logs during runtime, now it's like it should work but pane is dead black in 93%, 6% flickering with such content and 1% good but stuck gl image, I just rerun the program until it shown) I tried your calendar workaround to get gl context with glfw, but it's same, switched back to drift method, tried core and compatibility gl profiles. Starting to get lack of ideas. |
Some new info:
I come to conclusion that in linux there are some rules regarding thread contexts & memory managment, so im trying to find a way to handle it safely. it looks like when you acquire a texture in another thread it gets reallocated by os/fx thread and many issues happen. |
I tried to test dynamic rendering inside javafx thread with delayed callbacks & it works
trying to wrap my head how to make my custom thread work |
Some my findings:
What helped to fix problems / improve things:
Example code: Seems I finished here as vbox glitches I believe are linked to memory hacks done by driftfx implementation & it conflicts with some vbox stuff or timings / threads difference ruin it. At least I could achieve both win & linux native OS result + can test it on vbox with some pain & periodic init segfault crashes. Hope one day vbox also will work stablr
|
Added some fixes to the old calendar app I noted during last days dev:
https://github.com/pavel-ruban/javafx-driftfx-opengl-canvas-example/tree/main I tried to convince team to use this lib but we switched back to SWT unfortunately, 2 main reasons:
Other than that for other cases the lib worked for me perfectly well, hope those issues will be fixed later so it can be used in commercial projects (eg flickering) & vbox for dev purposes. |
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:
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.createSwapchain
calls until this is nonzero, but that never appears to occur if it does initialize with zero.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
The text was updated successfully, but these errors were encountered: