-
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
Status of DriftFX integration into LWJGL3 #17
Comments
@mipastgt I can answer the Java11+ Question. Yes there is and we have started working on it already - #18 - The Java-Bits are already in place (we produce an MR-Jar supporting Java8 and Java-11+, we won't support 9 & 10) and there are NO changes to the c/c++ story - but we need to port that to Github-Actions as travis is just to unreliable lately. |
Hi everbody What is the status of the LWJGL3 intergation and Java11? I am very interested to get a pure Java application with JavaFX + DriftFX + LWJGL3 running on Java 11. If it is already possible, am I happy to contribute a sample application to show case the LWJGL3 intergation. |
The LWJGL bindings will be updated when Java 11 support in DriftFX is complete (i.e. when #18 is closed). |
A native OpenGL node is what JavaFX has long been missing. I appreciate your work very much. |
BTW we are actively working on a new version 2.x who will have an improved api and hopefully fix problems we currently face eg with backpressure |
Could we have a progress update on the new version? |
moving the code from an internal dev branches to the public repo is in progress - we expect that the code is available at the end of the month. |
@tomsontom any news? I am happy to support you. |
For those of us not in "high priority" projects where perfect stability and/or performance are of utmost concern, is DriftFX in a usable state for LWJGL 3.2, Java 8, and JavaFX to match? If so, is there a guide beyond this thing from the main page on how to build it into a JavaFX application, or examples showing the same? |
Hi - the last few months we worked hard to get all this stuff into place and we are happy to report success and one can now use the stock lwjgl release together with the lastest nightly builds - https://tomsondev.bestsolution.at/2020/08/28/news-from-dirftfx-approaching-v1-0/ - feel free to give it a spin and report your findings |
I spy an example. I am going to give this a try over the next few days. :) |
Looks like we missed a debug statement somewhere - @redrezo ? |
Happy to See people using drift ;-) |
|
IOSurface is the MacOS mechanism of sharing textures across processes. NVDX is the bridge between d3d and opengl - in windows javafx renders with d3d while and drift allows you to get your opengl texture via nvdx in there. The mode is specified when creating the swap chain - if you copied my sample you should be able to switch it on the fly (i think..) maybe you need to stop, switch and start again |
So I have managed to integrate DriftFX into my actual project, and it renders mostly correctly (and yes, NVDX is seemingly working fine). I will have an image coming when it is more...displayable. However, two things do come up. The first is that the size of the renderer (ie the returned Vec2i in the getSize()) always seems to come out to 0x0 unless the surface is contained in a BorderPane via that pane's The second - and more serious - issue is that now that DFX is creating the GL context, I lose all "setup control" over it. In particular, as far as I can tell, I no longer can choose things like the multisampling level; in a pure GLFW window, that is accomplished by |
Drift reports its current nodes size (with regard to dpi scaling and your coutom user scale on the node). In javafx the nodes are sized by their parents. I dont think that there are Layouts where the surface will be always 0/0 but if there are this would be an issue on the drift side Drift does not create an OpenGL context for you. However it does use your current context and creates the 'to be rendered to' texture for you |
|
This is an internal API call i used for the samples. |
OK, that was not at all clear. I would comment that bit to indicate that such a means of creating the context are not part of the required setup to make DriftFX work, because to someone who has no idea how any of it works, the tendency is to just take a "don't touch anything you do not know is not important" approach. EDIT: |
Yeah the New drift Version removed the context coupling the shared contexts were used to allow sharing texture in Linux, but that only worked because in linux the gl restrictions are not that hard |
I just tested and it indeed works in that my rendered content does appear. An empty GLFW window appears and then closes again (I suspect glfwCreateWindow shows it and glfwHideWindow closes it) alongside the "real" window, but that is not a big deal. However, the multisampling remains nonfunctional; that implies it probably is in the render-to-texture system in the framebuffer. Clearly GLFW does something on its own end that I need to replicate. |
What is multisampling about? As i said you could just Transport your final Image over to drift with a simple blit Operation.. |
Like anti-aliasing. Without it, all my rendered geometry is "pixel exact" and GL_POINTS are square. With the AA on, I get smooth edges and circular dots instead. |
Yeah but that render result could be put in a texture, which you blit over to drift |
It is put into a texture, as far as I can tell; that is what the framebuffer it renders to is. Or do you mean something else? In case you cannot tell, OGL is largely black magic to me, and DFX even more so. |
What i imagine is: |
Ah I see. I can try that. |
It's cool that you got it working! We are happy to take feedback on what you think we have to improve to make it easier to adopt for you and hopefully for the community at large! |
I am sure some of my headaches were the result of my fairly limited experience with the "mechanical" side of OGL (I have a lot of experience with using OGL in general, but only in FFP and "drawing" contexts, plus a little shader code), but the big thing I can think of that would help with both adoption and use is more detailed documentation. For example, as you saw earlier, I had no idea how to actually stick DFX into a JavaFX program, and even once I had a sample, I could not effectively discern what was a necessary step to make it work and what was just part of the example's implementation. Similarly, without said example I would have never guessed as to the actual nature of the framebuffer required in terms of its encoding (ie Finally, I had a bunch of issues along the way that made absolutely no sense, but which might be predictable "gotcha" moments. For example, I had an issue where the texture ID (usually 1) from I also had issues where there seemed to be some kind of behavior dependency on the actual structure of the code, for example where unless the DFX integration code was called from inside my main render loop (and NOT in a function called by said loop), the JFX window would never call its |
First of all: Thanks for using drift and for the feedback! You are right, we indeed need more detailed documentation ;-) The depth component texture has actually nothing to do with drift. Drift provides just a texture which you may use in a framebuffer to draw to. And the sample creates a depth texture and adds it to its framebuffer as The texture you get from drift is created with As for your timing issues there may be a lot of reasons why this could happen. Drift itself needs to hook the QuantumRenderer (the javafx renderer) and your renderer. We hook the QuantumRenderer by implementing the render function within our NGNode. If your drift surface is not visible this render method will be never invoked which could cause issues. Also the reported size in the renderer will always be 0/0 until your surface is added to the scene and layouted. Also if your javafx window does not get initialized it seems to me that you somehow blocked the javafx main thread. |
I have for the most part completed my project; is there somewhere you would like me to post a link to it, either as a "how to use" example, for your own interest, or if you have some sort of "projects using us" page (like some other libraries do)? |
Well probably you want to provide a PR against the README.md, adding an section "Who uses DriftFX" pointing to a blog post, github repo, ... |
Applications should not extend the Node class directly. |
Is there an example somewhere with anti-aliasing? |
On what version of OpenJFX is that? DriftFX has to use internal API hence you need to open/export those internal packages using command-line swiches. |
DriftFX now also used here: https://github.com/markaren/three.kt/blob/master/examples/src/main/kotlin/info/laht/threekt/examples/javafx/HelloDriftFX.kt with LWJGL3. Would be nice if some one could add anti-aliasing :P |
See my "Game Calendar" project: https://github.com/ReikaKalseki/GameCalendar/blob/master/src/Reika/GameCalendar/Rendering/RenderLoop.java |
Hey all, I've finally been able to migrate the LWJGL bindings for DriftFX to the current version. For those that are not aware, there has been a major refactoring to DriftFX and I'm happy to report that based on my testing:
Given the above, DriftFX gains almost nothing from being bundled within LWJGL and the DriftFX bindings will be removed. Vanilla LWJGL + the official DriftFX release work great together and there is no need for tighter integration. The only remaining difficulty will be OpenGL context creation, but LWJGL already provides all the necessary (platform-specific) APIs and users that need more control (compared to I think this issue may be closed now. :) |
Could it be possible for #FXGL to provide a component to support LWJGL integration? Cheers |
@Spasi thanks for the feedback |
I raised this issue already on the LWJGL3 project but was redirected to report it here, so that's what I do.
LWJGL/lwjgl3#522
The main questions are:
I'd love to see that working but it must be stable to be usable.
The text was updated successfully, but these errors were encountered: