I was thinking to add a menu bar to my GL application that actually uses Newt.
The GLWindow API provides almost everything to be happy with a single frame. However, even if I do not intend to add a complete GUI, I would like to add a menu bar and probably the system open/save dialog and popups to better integrate my application to the desktop (on Linux, OS X and Windows).
I was wondering if there is a preferred path to follow without losing all the goodness of Newt ?
- Just a bare AWT Frame which has the ability to wrap a Newt window ? However how to pass into fullscreen properly ? What about HiDPI screen and menu support ?
- Use SWT ?
- Use Swing alongside the Newt canvas ?
- Maybe JavaFX ?
- Another way ?
If you plan to use the fullscreen mode, forget AWT / Swing as its fullscreen mode is partially broken under GNU Linux with some major window managers.
Maybe you can have a look at JOGL Graph API if it's enough for your needs.
Otherwise, there are several good UI APIs based on JOGL, Unlicense Lib has an excellent UI toolkit, JMonkeyEngine 3 and JogAmp's Ardor3D Continuation has some UI APIs too.
If you use only the windowed mode, you can simply use NewtCanvasAWT in a Swing/AWT GUI and even put it into a SwingNode to make it work with JavaFX, the former works, the latter might have some limitations.
The problem is that I would like to be able to switch between fullscreen and windowed. To give some context, I am trying to do a very simple drawing application working with a stylus like wacom ones for example. Most of the time it is a good thing to have fullscreen but users want also a windowed mode.
That said, the Newt canvas does not want to switch to fullscreen under OSX actually (it freezes the application). It works very well under Windows. I did not tested yet under Linux.
Now I also tested NewtCanvasAWT. It works as expected under OSX but under windows the window cannot gain the focus. The same code works well with a GLCanvas, but if I understood well, Newt has better perfomance (and I definitively prefer the Newt API).
As for GUIs, I only want a very basic menu (mainly to be a good desktop citizen). I do not plan to use a very complicated UI, and I thought I might try to do it using OpenGL directly, but I think JOGL graph UI definitively deserve a look. Is there a better place to start ?
Yes indeed, but my goal here is to work on the "desktop integration" so that the program integrates well under each OS. For example under OS X I would like the menu to appear at the top of the screen, the same under Ubuntu when available.
In the same way I wanted "native" load/save dialogs (and the only way I found actually is to force the use of AWT dialogs :))
Else, having fun with OpenGL/Jogl is always a good option ;)