Obtaining external GL context in Android

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Obtaining external GL context in Android

Marc Kurtz
I have an existing Android GLSurfaceView class that draws a map to the screen. I also have an existing OpenGL rendering library written that uses JOGL bindings to do it's drawing that I'd like to use with my GLSurfaceView. I'd like to obtain the JOGL GL instance object for my GLSurfaceView so I can pass that to my rendering library and allow it to draw to my map.

For a desktop GL context I can do GLDrawableFactory.getDesktopFactory().createExternalGLContext() which I can call getGL() on to get the GL object instance. However, when I do GLDrawableFactory.getEGLFactory().createExternalGLContext() on Android I get a null exception. I think the EGLExternalContext is not actually implemented. Looking at the code:

public class EGLExternalContext extends EGLContext {
    public EGLExternalContext(AbstractGraphicsScreen var1) {
        super((GLDrawableImpl)null, (GLContext)null);
passing in nulls to the super class will trigger a IllegalArgumentException("Null drawable") so this class is unusable as-is. I've looked into some of the NEWT stuff but that seems to always be centered around creating it's own window rather than using an existing GLSurfaceView.

So to reiterate - I am trying to integrate JOGL to integrate with Android's GLSurfaceView. I think what I need is to be able to instantiate a JOGL instance using an externally created GL context. Thank you!