Threading in JOGL/Java2D interop

Hey Ken,

From your demo that uses ‘Java2D’s new Single-Threaded Rendering OpenGL pipeline’
to showcase JOGL/Java2D interop, I’m wonder if it is possible to drive the GLJPanel
with a separate thread while the rest of the Swing stuff happens on the EDT?

Will the GLJPanel still show its content correctly (without redrawing) if there’re overlapping
light-weight components?

My current use case:

  • A GLJPanel that runs at 60fps, driven by a separate ‘engine’ thread.
  • A JPanel on top of it that shows other stuff. e.g. chat window etc.

Is this threading model even possible? Will it cause visual artefacts since
both components are driven by separate threads?

Thanks mate!

.rex

Sorry, this is not possible. The Java 2D / JOGL bridge is predicated on the rendering work being initiated from the EDT. The GLJPanel rendering is then performed on a separate thread, called the Queue Flusher Thread, where the Java 2D OpenGL work is done. It’s pretty complicated and doesn’t admit the possibility of other threading models.