Independent JOGL applications on same JVM

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

Independent JOGL applications on same JVM

alicana
Hi all,

I have an serious issue with usage of GLContext (I guess). I ran two different and independent applications.

But one of them throws an exception when it calls GLContext's release method.  Any ideas ?


Console output:
-----------------------------------------------------

Exception in thread "Thread-6" java.lang.RuntimeException: com.jogamp.opengl.GLException: Error freeing OpenGL context, werr: 0
    at com.jogamp.common.util.awt.AWTEDTExecutor.invoke(AWTEDTExecutor.java:58)
    at jogamp.opengl.awt.AWTThreadingPlugin.invokeOnOpenGLThread(AWTThreadingPlugin.java:103)
    at jogamp.opengl.ThreadingImpl.invokeOnOpenGLThread(ThreadingImpl.java:201)
    at com.jogamp.opengl.Threading.invokeOnOpenGLThread(Threading.java:202)
    at com.jogamp.opengl.Threading.invoke(Threading.java:221)
    at com.jogamp.opengl.awt.GLCanvas.display(GLCanvas.java:526)
    at graph.display.drawObject(GraphEngine.java:75)    
    at graph.display.DisplayThread.run(DisplayThread.java:157)
Caused by: com.jogamp.opengl.GLException: Error freeing OpenGL context, werr: 0
    at jogamp.opengl.windows.wgl.WindowsWGLContext.releaseImpl(WindowsWGLContext.java:422)
    at jogamp.opengl.GLContextImpl.release(GLContextImpl.java:411)
    at jogamp.opengl.GLContextImpl.release(GLContextImpl.java:376)
    at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1256)
    at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:1131)
    at com.jogamp.opengl.awt.GLCanvas$12.run(GLCanvas.java:1435)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:302)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:745)
    at java.awt.EventQueue.access$300(EventQueue.java:103)
    at java.awt.EventQueue$3.run(EventQueue.java:706)
    at java.awt.EventQueue$3.run(EventQueue.java:704)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:715)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)

ReleaseExceptionConsoleOutput.ReleaseExceptionConsoleOutput

Reply | Threaded
Open this post in threaded view
|

Re: Independent JOGL applications on same JVM

gouessej
Administrator
Sorry but the link points to an obsolete version of JOGL, please use JOGL 2:
http://jogamp.org/deployment/jogamp-next/javadoc/jogl/javadoc/com/jogamp/opengl/GLContext.html#release()

Please ensure that you use the very latest version first as we don't maintain older versions.

Do you reproduce your problem with any JOGL program? Please give us a mean of reproducing your problem.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Independent JOGL applications on same JVM

gouessej
Administrator
In reply to this post by alicana
You probably don't have to release the context by yourself if you use an animator and a GLEventListener. Don't try to release a context that isn't current.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Independent JOGL applications on same JVM

alicana
I do not use animator class, instead I have my own thread that invokes whole display sequence. I have bunch
of class that implements GLEventListener interface. These classes added and removed from GLDrawable object in an order.

By the way, this problem occurs between my project (jogl-2.3.1) and NASA World Wind (jogl-2.1.5) under OSGI container.


Reply | Threaded
Open this post in threaded view
|

Re: Independent JOGL applications on same JVM

Sven Gothel
Administrator
On 11/18/2015 07:43 PM, alicana [via jogamp] wrote:
> I do not use animator class, instead I have my own thread that invokes whole
> display sequence. I have bunch
> of class that implements GLEventListener interface. These classes added and
> removed from GLDrawable object in an order.
>
> By the way, this problem occurs between my project (jogl-2.3.1) and NASA World
> Wind <http://worldwind.arc.nasa.gov/java/> (jogl-2.1.5) under *OSGI* container.

Then pls create a most _small_ [j]unit test
(best if using on of our junit tests as a template),
which reproduces the issue at hand.

(No megabyte zip file of a project, etc.
 See our Wiki FAQ).

File a bug report.

Then attach the unit test (git email format) or make a git pull req.

Thank you!

~Sven



signature.asc (828 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Independent JOGL applications on same JVM

gouessej
Administrator
In reply to this post by alicana
I agree with Sven. Moreover, don't mix projects relying on different versions of JOGL, it will only lead to troubles as the constants might have different values. Finally, maybe the problem is in your own code, please don't try to release a context that isn't current.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Independent JOGL applications on same JVM

gouessej
Administrator
In reply to this post by alicana
What do you do in graph.display.drawObject()? If I don't see the source code, I can't help.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Independent JOGL applications on same JVM

alicana
Finally, I've found the root cause of the problem. I may forgot to say that having multiple canvas. . drawObject() method adds GLEventListeners to canvas sequentially(I admit its already complicated). At the Init() method of one of the GLEventListener object makeCurrent() and does not release the context. Adding release() method solved the problem. So, It's not a JOGL issue. Thank you for your considerations.
Reply | Threaded
Open this post in threaded view
|

Re: Independent JOGL applications on same JVM

gouessej
Administrator
Hi

Thank you for the feedback. Sorry but you mustn't call GLContext.makeCurrent() and GLContext.release() in GLEventListener.init(GLAutoDrawable) as the OpenGL context is guaranteed to be current during this call.

You should look at the scenegraph APIs based on JOGL at least as correct examples of JOGL use to draw complicated objects rather than reinventing the wheel in worse.
Julien Gouesse | Personal blog | Website