No OpenGL context current on this thread

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

No OpenGL context current on this thread

Martin
Hi,
In a GLEventListener init(GLAutoDrawable) method, I have an error when trying to instanciate a GLU(), that says it has no current GL context. That's weird because in init() there IS a current GL context given by input. What may be the reason of such error?
Thanks for your help,
Martin
in case of: jogl2 rc5

public void init(GLAutoDrawable drawable) {
        if(!autoSwapBuffer)
                drawable.setAutoSwapBufferMode(false);
        GL2 gl = drawable.getGL().getGL2();

        // Allocate render targets first
        try {
                dualPeelingPolicy.InitDualPeelingRenderTargets(gl, width, height);
        } catch (GLException e) {
                System.err.println(e1.getStackTrace());
        }
        dualPeelingPolicy.InitFrontPeelingRenderTargets(gl, width, height);
        dualPeelingPolicy.InitAccumulationRenderTargets(gl, width, height);
        gl.glBindFramebuffer(GL2.GL_FRAMEBUFFER, 0);
        dualPeelingPolicy.buildShaders(gl);
       
        mountGLBindedResources(gl); //  Load an OBJ file
        dualPeelingPolicy.makeFullScreenQuad(gl, new GLU());


        gl.glDisable(GL2.GL_CULL_FACE);
        gl.glDisable(GL2.GL_LIGHTING);
        gl.glDisable(GL2.GL_NORMALIZE);
        gl.glGenQueries(1, dualPeelingPolicy.g_queryId, 0);
}

When reaching makeFullScreenQuad() I got an exception on GLU.gluOrtho2D(...):

Exception in thread "main-AWTAnimator-1" javax.media.opengl.GLException: javax.media.opengl.GLException: No OpenGL context current on this thread
        at jogamp.opengl.awt.AWTThreadingPlugin.invokeOnOpenGLThread(AWTThreadingPlugin.java:98)
        at jogamp.opengl.ThreadingImpl.invokeOnOpenGLThread(ThreadingImpl.java:197)
        at javax.media.opengl.Threading.invokeOnOpenGLThread(Threading.java:164)
        at javax.media.opengl.awt.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:830)
        at javax.media.opengl.awt.GLCanvas.display(GLCanvas.java:419)
        at com.jogamp.opengl.util.AWTAnimatorImpl.display(AWTAnimatorImpl.java:74)
        at com.jogamp.opengl.util.AnimatorBase.display(AnimatorBase.java:142)
        at com.jogamp.opengl.util.Animator$MainLoop.run(Animator.java:176)
        at java.lang.Thread.run(Unknown Source)
Caused by: javax.media.opengl.GLException: No OpenGL context current on this thread
        at javax.media.opengl.glu.GLU.getCurrentGL(GLU.java:175)
        at javax.media.opengl.glu.GLU.gluOrtho2D(GLU.java:1344)
        at org.jzy3d.plot3d.rendering.ddp.DepthPeelingRendereringPolicy.makeFullScreenQuad(DepthPeelingRendereringPolicy.java:279)
        at org.jzy3d.plot3d.rendering.ddp.RawPeelingRenderer.init(RawPeelingRenderer.java:103)
        at org.jzy3d.plot3d.rendering.ddp.DepthPeelingRenderer.init(DepthPeelingRenderer.java:40)
        at jogamp.opengl.GLDrawableHelper.init(GLDrawableHelper.java:143)
        at jogamp.opengl.GLDrawableHelper.init(GLDrawableHelper.java:162)
        at javax.media.opengl.awt.GLCanvas$InitAction.run(GLCanvas.java:922)
        at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:392)
        at javax.media.opengl.awt.GLCanvas$DisplayOnEventDispatchThreadAction.run(GLCanvas.java:956)
        at java.awt.event.InvocationEvent.dispatch(Unknown Source)
        at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
        at java.awt.EventQueue.access$000(Unknown Source)
        at java.awt.EventQueue$1.run(Unknown Source)
        at java.awt.EventQueue$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
        at java.awt.EventQueue.dispatchEvent(Unknown Source)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.run(Unknown Source)


    public void makeFullScreenQuad(GL2 gl, GLU glu) {
        //GLU glu = GLU.createGLU(gl);

        g_quadDisplayList = gl.glGenLists(1);
        gl.glNewList(g_quadDisplayList, GL2.GL_COMPILE);

        gl.glMatrixMode(GL2.GL_MODELVIEW);
        gl.glPushMatrix();
        gl.glLoadIdentity();
        glu.gluOrtho2D(0.0f, 1.0f, 0.0f, 1.0f);
        gl.glBegin(GL2.GL_QUADS);
        {
            gl.glVertex2f(0.0f, 0.0f);
            gl.glVertex2f(1.0f, 0.0f);
            gl.glVertex2f(1.0f, 1.0f);
            gl.glVertex2f(0.0f, 1.0f);
        }
        gl.glEnd();
        gl.glPopMatrix();

        gl.glEndList();
    }
Reply | Threaded
Open this post in threaded view
|

Re: No OpenGL context current on this thread

gouessej
Administrator
Anyway you should use GLUgl2 if you don't want to get some exceptions with the message "method not implemented".
Julien Gouesse | Personal blog | Website