So, some more use-case details for Yuri:
I have split the various elements of the JOGL callbacks into separate interfaces (from a java POV it was a stupid idea to put them all in one interface!). e.g.
initialiser: init( GLDrawable ) …
renderer: display( GLDrawable, … ) …
reshapelistener: reshape( GLDrawable, width, height … ) …
etc
This has huge benefits in that you now have pluggable init code etc - you neither have to write everything N times for N scenes, nor do you have to manage garbled massive monolithic methods that “do everything”.
With this modular system, to make it useful for GUI’s, I also need to layer multiple renderers on top of each other in one frame - e.g. you have the “drawQuakeLevel” renderer and a “HUDrenderer” and you want to do both every frame. So, the renderer interface is a bit more complex, pulling out the per-frame setup stuff so that you can configure renderers how you like to e.g. not clear the buffers and overwrite the previous renderers’ work - without having to modify the individual renderers’ source.
So, the next question is how to integrate this into Xith. It seems with my current use cases that all I need to do is have a simple way of wrapping these interfaces. E.g. a special “raw OpenGL” interface that contained callbacks for all the different parts of OGL rendering, so that I could implement it and use it to wrap my rendering system.
At the moment, my use cases are such that I’m happy to merely shove all my OGL in a single node in the Xith tree - I’m primarily using it to do menus, HUDs, and other “flat” GUIs that will be rendered atomically on top of everything else, so that render order compared to the rest of the scene is irrelevant - just as long as the opengl node is correctly positioned right in front of the camera and hence always renders on top of everything else.
I am concerned that I may be doing something stupid here - in Xith, I should be building an SG-based GUI and an SG-based menu etc. So, for clarification, my reasons for doing this (or attempting to) are:
-
the UI overlay stuff in Xith simply doesn’t work beyond “toy” examples. It’s full of bugs and has some major performance problems. If it worked, I would probably not have bothered doing any of this - not even the JOGL stuff.
-
I’m building this for JOGL anyway, and if it could work transparently in Xith (with some “write-once” wrapper that doesn’t need recompiling) then Xith would get it “for free” without extra support effort for me. (and there may be other OGL stuff that would easily be ported to Xith again without the need to alter the source, so that Xith could just always plug-in the latest version without alteration)
-
My GUI framework is (or will be) a heck of a lot better than Swing in several key areas - e.g. I’m going to merge in my custom layout system that works much better than Swing’s. But it won’t come with lots of widgets. It is aimed specifically at making in-game GUI’s for games, rather than being a direct competitor for swing. Personally, I think it was a misteak to make Swing/AWT merge widgets with layout and everything else - they should have been separated into different layers. If I provide people with a layout framework, I’d expect someone else would probably implement widgets within that framework, as a separate project.
PS it’ll be open-sourced once working. Although I wouldn’t recommend anyone waiting for it :).