Cannot use DebugGL with GLJPanel

I’ve been using a GLCanvas to render my JOGL scenes so far, and wrapping it’s drawable in a DebugGL to catch errors. I’ve never had any OpenGL errors yet, but figured that this would be a good safety practice while I’m still writing and debugging my code.

Recently, I decided to switch to the lightweight GLJPanel so that I can display popup menus over my panel. I wrapped my GLJPanel’s drawable in a DebugGL just as I did for my GLCanvas:

            canvas = GLDrawableFactory.getFactory().createGLJPanel(new GLCapabilities());
            canvas.setGL(new DebugGL(canvas.getGL()));

However, this is throwing the following exception:

java.lang.IllegalArgumentException: null downstreamGL
        at net.java.games.jogl.DebugGL.<init>(DebugGL.java:20)
        at com.pantometrics.display.PantoSceneViewPanel.<init>(PantoSceneViewPanel.java:60)


Any ideas what’s causing this? Can I use a DebugGL with a GLJPanel?

I get the impression that canvas.getGL() returned null.

You can use the DebugGL with the GLJPanel but you need to set it up in the init() method of your GLEventListener. In fact, even with the GLCanvas this is now the correct way to set up the DebugGL.