I was looking for a way to create a JME Headless Display by sharing an existing Drawable context. This could be useful in order to integrate JME into other OGL frameworks.
As it seems it can't be possible to do so with the current jme API, I've implemented it by myself. Backwards-compatible, of course.
It would be good to have this feature in the official distribution.
I can post the code here. Just ask for it.
How would you share context with non-LWJGL created contexts? LWJGL has a special drawable interface to make contexts current, doesn't seem like there's a way to bind existing contexts to LWJGL.
Right, LWJGL dependency is the issue. Don't mistake me: LWJGL IS the renderer for JME. I can't see a JOGL renderer as a good idea right now.
To implement the shared context I had to modify the DisplaySystem abstract class, born to be jme-generic and include an "org.lwjgl.opengl.Drawable" class reference there.
OK, the resulting classes are still backwards compatible and all the JME examples work. But I have violated the independence of JME from the GL wrapper.
But as I need to share my LWJGL context with JME, I've been forced to do so.
Maybe you can suggest a better way.
My opinion is to stick to LWJG right now, starting from JME 2.0. I don't think we need a different GL wrapper . LWJGL is proven to be stable, supported, free, complete, simple, widely adopted, cross-platform.
Right now I have a custom made display system so I was looking for a way to share contexts not created by LWJGL. My display system doesn't use the standard jME classes (DisplaySystem, DisplayProvider, and all ***Game classes are obsolete), so there's no dependance on the GL wrapper.
So you're suggesting to create a separate Display system for my uses that mimics the JME Display system but implements my own context sharing… There will be a problem with the concrete (LWJGL/JME)Renderers implementation then.
Curious: how did you implement context sharing ?
Can you share the code? I think anyone who really needs this, will not care much about forced dependence on the GL wrapper.
The thread here shows how to do it with the system.
You just pass in an existing displaysystem/context to the constructor of another and then they become shared.
There’s no concrete problem with the LWJGLRenderer/Renderer, but it requires some hacking around the original displaysystem to make it work, that’s why I don’t want to release the system- at least not until the issues are resolved.
I'm glad that JME2.0 will have some context sharing features.