Posted by
Sven Gothel on
Feb 16, 2012; 1:47am
URL: https://forum.jogamp.org/OpenGL-error-1282-at-GLContext-release-tp3742304p3749025.html
On 02/15/2012 09:12 PM, ac [via jogamp] wrote:
>
>
> Ok, with the debug and trace options enabled, I get the following:
>
<snip/>
> glFlush()
> glGetError()Exception in thread "Animation Thread"
> javax.media.opengl.GLException: No OpenGL context is current on this thread
> at javax.media.opengl.DebugGL4bc.checkContext(DebugGL4bc.java:25888)
> at javax.media.opengl.DebugGL4bc.glGetError(DebugGL4bc.java:9485)
> at javax.media.opengl.TraceGL4bc.glGetError(TraceGL4bc.java:6434)
> at processing.opengl.PGL.glGetError(PGL.java:465)
> at processing.opengl.PGraphicsOpenGL.report(PGraphicsOpenGL.java:4342)
> at processing.opengl.PGraphicsOpenGL.endDraw(PGraphicsOpenGL.java:1523)
> at processing.core.PApplet.handleDraw(PApplet.java:1936)
> at processing.core.PApplet.run(PApplet.java:1812)
> at java.lang.Thread.run(Unknown Source)
>
very good!
> So, the first time the renderer tries to release the context, at the end of
> the first frame, it turns out that it is not current, but... I can assure
> that we call context.makeCurrent() at the beginning, so it is not clear to
> me why the context is not current.
It depends, w/o seeing source code, how can we tell?
>
> On the other hand, until now in Processing we were using a rendering
> mechanism where the opengl context was manually created inside Processing's
> animation thread (so we didn't use any GLCanvas object)...
I was just about to get the idea, that you have left the 'save' and 'sane'
path and doing your own GLAutoDrawable logic - here we are :)
> this approach was
> working (although with the error in windows),
Well, it's 'just' a bug in your code.
Impl. the GLAutoDrawable is not easy.
do a:
draw_a_thing:
makeCurrent()
try {
lalal
} finalize {
release()
}
that should always work.
> but from what I read it is
> recommended that OpenGL runs within AWT's EDT thread.
If you use AWT, yes. But have a look at NEWT and our drop-in NEWT Applets
(applet test site -> unit tests etc).
> I just changed the
> rendering logic in Processing, this time using GLCanvas, GLEventListener and
> no explicit GLContext, and everything appears to work fine, this time
> without any error.
yup, see above.
writing your own 'sane' path (GLAutoDrawable) is not that easy, but doable.
~Sven