Login  Register

Re: Rendering without callbacks

Posted by Leigh McRae on Jan 15, 2011; 8:03pm
URL: https://forum.jogamp.org/Rendering-without-callbacks-tp2259774p2263267.html

Thank you for your response but I haven't been successful.  I have verified that my setup is correct by getting SimpleScene found on the wiki to compile and run.  When I try and render outside of the callback I get the following:

Exception in thread "main" javax.media.opengl.GLException: Unable to create temp OpenGL context for device context 0x6d0130a2
        at com.jogamp.opengl.impl.windows.wgl.WindowsWGLContext.createImpl(WindowsWGLContext.java:297)
        at com.jogamp.opengl.impl.GLContextImpl.makeCurrentLocking(GLContextImpl.java:404)
        at com.jogamp.opengl.impl.GLContextImpl.makeCurrent(GLContextImpl.java:350)

What I'm doing is the following (just the main ui thread for now):

GLProfile.initSingleton( true );
               
GLProfile glp  = GLProfile.getDefault();
GLCapabilities caps  = new GLCapabilities( glp );
GLCanvas          canvas = new GLCanvas( caps );

canvas.setFocusable( true );
canvas.requestFocus();
canvas.setSize( width, height );
canvas.setIgnoreRepaint( true );
canvas.setAutoSwapBufferMode( false );

Frame  frame = new Frame();

frame.add( canvas );
frame.pack();
frame.setLocationRelativeTo( null );
frame.setResizable( false );
frame.setVisible( true );
frame.addWindowListener(new WindowAdapter()
{
      public void windowClosing(WindowEvent we)
      {
             System.exit(0);
      }
} );

GLContext context = m_Canvas.getContext();
               
context.makeCurrent();

Crash