Multiple windows and OpenGL

Hi everyone,

I’m kind of at a crossroads in my game and I’m looking for input from people who’ve been here before.

My game is a cross between RPG and RTS strategy and the main panel uses an lwjgl display for performance reasons. Ultimately, there will be several quite complicated windows required. For example: a window to manage the party’s inventory or one to buy and sell items between a trading caravan and a city’s marketplace. A good portion of this game will be heavily economy-based i.e. lots of data and I foresee the need to use sophisticated GUI elements including collapsible trees and tables.

To prevent myself from having to re-implement a full windowing system in OpenGL I’ve decided to use a mixture of Swing and an lwjgl display. Thus the game will have a MDI (multiple-document interface) i.e. multiple windows.


+--------------------+
| main window        |   
|  (lwjgl)           |   
|                    |     +-----------+
|                    |     | inventory |
|                    |     |  (swing)  |   
+--------------------+     |           |   
                           |           |   
            +---------+    |           |   
            | status  |    |           |   
            |         |    |           |   
            +---------+    +-----------+

Now I’m wondering if I’ll regret this later on. Would it be better to do everything in a single lwjgl frame? That is either use a pre-existing OpenGL windowing lib or create a custom one for my game. The graphical style is quite simple and I’d like to keep it that way.

What are your thoughts and/or experiences going down either path?

I’d keep it all within one window personally. How many games do you see with floating sub windows? Plus Swing tends to look and behave like crap for games, even after heavy reskinning.

There’s plenty of OpenGL gui toolkits out there if you don’t want to write your own, maybe start with TWL? http://wiki.l33tlabs.org/bin/view/TWL/

I’ve taken a look at TWL and it looks pretty sweet. However there are a few concerns I have. It doesn’t integrate properly with the rest of the system e.g. the system clipboard etc. And while the existing UI elements look good they’re pretty simple compared to their Swing counterparts.

If I went with the MDI version and needed some very basic UI elements in the main lwjgl window then how tricky is it to write a UI toolkit? I suppose there’s nothing stopping me from using both TWL and other Swing windows…

I don’t think there is any OpenGL gui that will integrate nicely with the system, besides you probably don’t want that for game gui, if you do you could have a look at SWT.

Another nice option is Nifty GUI which takes a slightly different approach to TWL for GUI design.

TWL doesn’t have a pre-built UI. It is a GUI toolkit, extremely flexible and completely customizable. You supply the looks, it creates the widgets :slight_smile:

Swing doesn’t mix very well with OpenGL – it’s really only useful for editors/toolsets IMO.

Writing your own GUI library is always an option, but if you need things like complex text widgets, lists/trees, tables, layout managers, animations, etc. it will amount to a lot of work. Unless you have good reason to reinvent the wheel, you should just use something like TWL. It’s efficient, highly flexible and includes a very useful theme/widget/font editor.

Does NiftyGUI still have an high memory footprint?