Login  Register

Re: Multithreaded drawing in multiple PBuffers

Posted by Sven Gothel on Nov 16, 2012; 10:08am
URL: https://forum.jogamp.org/Multithreaded-drawing-in-multiple-PBuffers-tp4026974p4026993.html

On 11/15/2012 07:01 PM, Mi5ke [via jogamp] wrote:

> 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,
Pls provide your unit test / demo.

You may also looks at Test*Concurrent* and TestFBOOffThreadSharedContextMix2DemosES2NEWT
part of our JOGL unit tests.

The latter shows 2 FBO's being rendered independently and composed in an
onscreen GLAutoDrawable.

Note: The new GLPbuffer is an offscreen GLAutoDrawable using the GLCapabilities
      for selecting the offscreen mode. Instantiated via the factory as usual.

~Sven

>
> Mi5ke


signature.asc (909 bytes) Download Attachment