Login  Register

Multithreaded drawing in multiple PBuffers

Posted by Mi5ke on Nov 15, 2012; 6:01pm
URL: https://forum.jogamp.org/Multithreaded-drawing-in-multiple-PBuffers-tp4026974.html

Hi,

Context:

I have a problem creating a highly parallel drawing application. It attempts to draw on multiple PBuffers using multiple contexts in separate threads, one each. Specifically:

I have created eight GLPbuffers and obtained a separate GLContext for each of them.

I have eight threads, each is given a context to draw with, into the separate GLPbuffers.

But... some of the drawing works (the first three or four GLPbuffers are drawn correctly, but the remainder are blank (all zero data), as if no drawing had occurred. There are no errors from glGetError, no exceptions, no context locking problems.....

If I make it single threaded, or if I synchronize on almost any global object, everything works fine (just slooowww). I have traced the code in various ways, all the drawing code is being executed, using the correct contexts. The problem lies in the JOGL/OpenGL code, I am certain - and I am *very* familiar with conventional multi-threading issues. Identical code (but drawing with Java2D instead) works fine under heavy load.

Result: the Java2D code is out-performing the JOGL code by a factor of eight. The JOGL gives a nicer result - per-vertex shading etc. which is my only reason to use it.

Question: Is there a trick to allowing simultaneous independent drawing on separate GLPBuffers with separate GLContexts, or is it simply not supported?

Thanks for your help,

Mi5ke