Login  Register

Re: converting from Sun's jogl to jogamp's jogl -- HELP

Posted by Sven Gothel on Mar 24, 2011; 12:24am
URL: https://forum.jogamp.org/converting-from-Sun-s-jogl-to-jogamp-s-jogl-HELP-tp2715969p2723159.html

On Wednesday, March 23, 2011 20:43:14 Alexandra [via jogamp] wrote:

>
> Thanks for replying.  It's not easy for me to carve out a portion of the
> code. I did modify this program:
>
> http://jogamp.org/git/?p=jogl.git;a=blob;f=src/junit/com/jogamp/test/junit/jogl/acore/TestSharedContextListAWT.java;h=b44158dce98537b7e12e4a354a702d0082f2b4ef;hb=de2a30104098216963132ed02b3dd66acd799d9e
>
> And instead of Gears put in part of my program to test. I got the shared
> context to work. But when I go back to my main app, and follow the same code
> initialization I now get this error:
>
> Exception in thread "AWT-EventQueue-0" javax.media.opengl.GLException: No
> OpenGL context is current on this thread
> at javax.media.opengl.DebugGL2.checkContext(DebugGL2.java:32463)
> at javax.media.opengl.DebugGL2.glDeleteBuffers(DebugGL2.java:13932)
>
> I think the problem is that I am using the mouse to drag in one canvas,
> which sends a message to my 'main' display which then tries to update the
> objects/memory on the GPU.  But I'm not really sure. I will try to separate
> out the code and put it in the above 'TestShared...' and send it to you to
> help debug.

The GLContext is not [guaranteed to be] current when invoking your input event listener.

However you handle your 'signal' which uses GL (deleteBuffers),
you have to ensure it operates within a current GLContext.

Either you encapsulate your code like this:
  if( GLContext.NOT_CURRENT <= ctx.makeCurrent()) {
        fail;
  }
  try {
      gl.do_something
  } finalize {
     ctx.releaseContext();
  }

Or you invoke a GLRunnable on your GLAutoDrawable instance (GLCanvas, GLWindow, ..):

http://jogamp.org/deployment/jogamp-next/javadoc/jogl/javadoc/javax/media/opengl/GLRunnable.html
http://jogamp.org/deployment/jogamp-next/javadoc/jogl/javadoc/javax/media/opengl/GLAutoDrawable.html#invoke%28boolean,%20javax.media.opengl.GLRunnable%29

~Sven

>
> I'm using jogamp 2.0-rc2 build, on a Windows XP machine with NVIDIA Quadro
> FX 4800, driver 190.38 (I can't update my driver because then framebuffers
> completely stop working).
>
> What's frustrating is that my app works with Sun's old jogl.  It's only when
> I update to jogamp that it breaks.
>
> I do appreciate the help!

I concur with Wades statement, as I made it many time - sorry for nagging :)
Please follow bugreport instructions:
  http://jogamp.org/wiki/index.php/Jogl_FAQ#Bugreports_.26_Testing

Of course - we save both our patience, time and miscommunication,
if you provide a little [unit] test - you know the drill :)

BTW - I remember the FBObject bug now, I guess I lost this 'task' :(
If it was you - can you resend me the informations you once provided ?
This is another example why using bugzilla besides these emails is a good thing.

Sorry, didn't mean to scold you - just trying to convince my fellow colleagues
to our tiny little process :)

Cheers, Sven