So you may or may not have seen my map editor, which is working nicely now but unfortuately doesn’t seem to work on macs.
The snag seems to be drawing the map areas. Those screenshots don’t show it, but there can be multiple maps open at a time, possibly open next to each other (ie. multiple visible at the same time). Currently what I do is use Slick + LWJGL to share a single opengl context, then actual display that via multiple AWT Canvas objects (via LWJGL’s Display.setParent()), which in turn are embedded in a SWT Composite via SWT’s “awt bridge”. This is pretty ugly but on windows it actually works well.
Unfortunately the swt/awt bridge doesn’t seem to be properly implemented on non-windows platforms, and on OS X it’s Just Plain Broken ™. I’d really like to get it working there, so I’m looking for ways around this.
All I’m after is multiple visible canvases which I can draw onto via OpenGL. I don’t care whether the underlying components are SWT or AWT, I don’t care if it’s via LWGJL, Jogl or org.eclipse.swt.opengl, and I don’t care if it uses one context or multiple contexts.
Possible workarounds I’m thinking about:
-
Switch to org.eclipse.swt.opengl and use one GLCanvas per view. That’ll give multiple opengl contexts though, so I’ll have to load in each image multiple times (once for each view) so the memory usage would be sky high.
-
As for 1, but with some kind of caching for textures so they get loaded and unloaded on demand (but still duplicated across contexts) to try and keep memory usage reasonable. Would probably hurt performance though.
-
Somehow create a single off-screen opengl context and do all texture loading and rendering to this. Copy the final pixel data to a non-opengl swt canvas to display multiple views at the same time.
-
Something else?
Anyone any other suggestions or ideas?
Cheers