husker-dev / openglfx

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

not working when using module-info.java #46

Closed ponchoboob closed 8 months ago

ponchoboob commented 8 months ago

Hello, actually openglfx is the thing I was looking for. I use JavaFX with module-info.java (jpms). I use the lwjgl library as my prefered opengl wrapper. I've added "requires lwjgl" and "requires core" to the module-info.java.

I got JavaFX and LWJGL working per se. (classic way: offscreen rendering and download framebuffer with two PBOs and fill WritableImage's pixel buffer)

Even when I add the "--add-opens" listed on the project Page I get the error class com.huskerdev.openglfx.OpenGLCanvas (in module core) cannot access class com.sun.javafx.scene.layout.RegionHelper (in module javafx.graphics) because module javafx.graphics does not export com.sun.javafx.scene.layout to module core

What else should I add to the module-info.java to get openglfx working with JavaFX when using modules?

kind regards.

husker-dev commented 8 months ago

Hi, you can get the list of all add-opens on the main page.

https://github.com/husker-dev/openglfx#reflections-opens

husker-dev commented 8 months ago

If all opens are added, then everything should work. Note that —add-opens is command line argument. For module file you need to use it without dashes. (I am not sure how it looks like actually)

ponchoboob commented 8 months ago

Hello, thank you for the quick reply. I've added all of those --add-opens to the VM Options in the configuration settings (VM Options). But still does not work. Any other ideas?

just ofr the record I've 1) created a new javafx project with intellij )maven, language: java 2) used your generator https://huskerdev.com/?page=tools/openglfx (java, maven, lwjgl) 3) added the maven dependencies 4) added all the --add-opens as VM Options

Might there be something that I forgot to do?

kind regards

husker-dev commented 8 months ago

I can not say exactly. It's possible that your JavaFX project is calling the main method without using your arguments. Check your execution target in IntelliJ IDEA. Also it happens when you use JavaFX plugin. Explore this way.

ponchoboob commented 8 months ago

thanks, i will check.

kind regards

ponchoboob commented 8 months ago

Btw, stupid question. But do I need the "real" lwjgl dependencies or only those provided by you?

husker-dev commented 8 months ago

My LWJGL module is just a bridge (addon) to core library, especially for LWJGL (there is also module for JOGL).

So, you need to use both of them.

ponchoboob commented 8 months ago

I downloaded the source code and added the module-info files and configured the requried modules and exports. but the problem remains with sun.prism libraries/modules that are not beeing exported by javafx.graphics. seems to be a problem of javafx per se and how they export or not export modules.

ponchoboob commented 8 months ago

after some time searching the web, i found that the com.sun..... classes are internal classes and that these are not exported by javafx.graphics module. so they are actually not for use. and when using modules that it is not working. i also tried export stuff with maven plugin and also removed the javafx maven plugin. to sum up.. I'cant use it when using javafx with modules. kind regards.

husker-dev commented 8 months ago

I'll close this issue. If you have any questions, please reopen it again.