问题
Ok,
I have a working JOGL application. I use a lot of OpenGL features in it including Textures, VBO's, Ray-Picking, etc. I like working with OpenGL directly and don't want to use any other 3D graphics libraries.
What I want to achieve is two fold:
I want to be able to embed this JOGL application in a subset window of a larger UI window. So alongside the JOGL window will be a photo viewer, text box and scrollable list.
I am designing this application to run on Windows 10, multi touch hardware.
What I have found so far:
Java's Swing toolkit is the only way that I have been able to embed a JOGL window. However, Swing is old and dated looking.
Incorporating multi touch into swing can be done but does require a lot of custom gesture detection. This is fine but maybe options exists that don't reinvent the wheel.
JavaFX looks great and i'd like to use it but I don't see any straightforward way of pairing it with JOGL.
Do any of you have suggestions? Has anyone done this before?
回答1:
You can integrate JOGL into a JavaFX application by using the SwingNode. https://docs.oracle.com/javase/8/javafx/api/javafx/embed/swing/SwingNode.html The opposite (integrating some JavaFX into a Swing application) is also possible but I would not reccomend it.
Doing the JOGL integration this way will not be as performant as a native OpenGL window but for many application it will be sufficient.
来源:https://stackoverflow.com/questions/35608138/jogl-swing-javafx