Menus and Newt

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Menus and Newt

4nt01n3
Hi all,

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 ?

Does someone has some experience on this ?

Thanks a lot !
Reply | Threaded
Open this post in threaded view
|

Re: Menus and Newt

gouessej
Administrator
Hi

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.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Menus and Newt

4nt01n3
Thanks Julien,

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 ?

Thanks for your time.
Reply | Threaded
Open this post in threaded view
|

Re: Menus and Newt

gouessej
Administrator
The last time an end user tested my game under OSX 10.10, the fullscreen mode was working. Have you written a bug report about that?

I advise you to look at com.jogamp.opengl.test.junit.graph.demos.GPUUISceneGLListener04, it's a good and simple example to start using JOGL Graph UI.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Menus and Newt

4nt01n3
Ok, my bad. I was switching to fullscreen from the EDT. Fullscreen is perfectly working under OSX.

I will look at the demos of the Graph API, thanks !
Reply | Threaded
Open this post in threaded view
|

Re: Menus and Newt

gouessej
Administrator
You're welcome. In the worst case, you can write your own JOGL menu.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Menus and Newt

4nt01n3
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 ;)