Login  Register

Re: How do I create second GL context?

Posted by Sven Gothel on Nov 22, 2011; 8:43am
URL: https://forum.jogamp.org/How-do-I-create-second-GL-context-tp3526076p3527162.html

On Monday, November 21, 2011 10:36:05 PM kitfox [via jogamp] wrote:

>
> I tried adding the following, but am still getting null:
>
> [code]
>         GLContext glCtx = fact.getOrCreateSharedContext(null);
>        
>         GLPbuffer pbuf =
>                 fact.createGLPbuffer(null,
>                 caps, null,
>                 width, height,
>                 glCtx);
> [/code]
>

Please check this commit and the test case I have changed ..

http://jogamp.org/git/?p=jogl.git;a=commit;h=12342c9e6122051fbdc91493c4d63515ad4613d1

getOrCreate...() is not for public use, I removed it from the API, it was a bug.

Just create the pbuffer drawable and force context creation via 1st display:
  http://jogamp.org/git/?p=jogl.git;a=blob;f=src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextNewtAWTBug523.java;h=fbc16953da053f7e0d45f1ba7a3e02c511b43532;hb=bf6504797d4823bc49d0340238dd32cab9f1612e#l122

then you can use the context: pbuf.getContext() for sharing.

~Sven