@@ -68,14 +68,14 @@ public class FrameBuffer implements PConstants {
6868
6969
7070 FrameBuffer () {
71- pgl = PGraphicsOpenGL .pgl ;
71+ pgl = PGraphicsOpenGL .pgPrimary . pgl ;
7272 context = pgl .createEmptyContext ();
7373 }
7474
7575
7676 FrameBuffer (int w , int h , int samples , int colorBuffers ,
77- int depthBits , int stencilBits , boolean packedDepthStencil ,
78- boolean screen ) {
77+ int depthBits , int stencilBits , boolean packedDepthStencil ,
78+ boolean screen ) {
7979 this ();
8080
8181 glFbo = 0 ;
@@ -141,7 +141,7 @@ public class FrameBuffer implements PConstants {
141141 }
142142
143143
144- FrameBuffer (int w , int h , boolean screen ) {
144+ FrameBuffer (PGraphicsOpenGL pg , int w , int h , boolean screen ) {
145145 this (w , h , 1 , 1 , 0 , 0 , false , screen );
146146 }
147147
@@ -345,7 +345,7 @@ protected void allocate() {
345345 glFbo = 0 ;
346346 } else {
347347 //create the FBO object...
348- glFbo = PGraphicsOpenGL .createFrameBufferObject (context );
348+ glFbo = PGraphicsOpenGL .createFrameBufferObject (context , pgl );
349349
350350 // ... and then create the rest of the stuff.
351351 if (multisample ) {
@@ -423,7 +423,7 @@ protected void createColorBufferMultisample() {
423423 PGraphicsOpenGL .pushFramebuffer ();
424424 PGraphicsOpenGL .setFramebuffer (this );
425425
426- glMultisample = PGraphicsOpenGL .createRenderBufferObject (context );
426+ glMultisample = PGraphicsOpenGL .createRenderBufferObject (context , pgl );
427427 pgl .bindRenderbuffer (PGL .RENDERBUFFER , glMultisample );
428428 pgl .renderbufferStorageMultisample (PGL .RENDERBUFFER , nsamples ,
429429 PGL .RGBA8 , width , height );
@@ -444,7 +444,7 @@ protected void createPackedDepthStencilBuffer() {
444444 PGraphicsOpenGL .pushFramebuffer ();
445445 PGraphicsOpenGL .setFramebuffer (this );
446446
447- glDepthStencil = PGraphicsOpenGL .createRenderBufferObject (context );
447+ glDepthStencil = PGraphicsOpenGL .createRenderBufferObject (context , pgl );
448448 pgl .bindRenderbuffer (PGL .RENDERBUFFER , glDepthStencil );
449449
450450 if (multisample ) {
@@ -474,7 +474,7 @@ protected void createDepthBuffer() {
474474 PGraphicsOpenGL .pushFramebuffer ();
475475 PGraphicsOpenGL .setFramebuffer (this );
476476
477- glDepth = PGraphicsOpenGL .createRenderBufferObject (context );
477+ glDepth = PGraphicsOpenGL .createRenderBufferObject (context , pgl );
478478 pgl .bindRenderbuffer (PGL .RENDERBUFFER , glDepth );
479479
480480 int glConst = PGL .DEPTH_COMPONENT16 ;
@@ -510,7 +510,7 @@ protected void createStencilBuffer() {
510510 PGraphicsOpenGL .pushFramebuffer ();
511511 PGraphicsOpenGL .setFramebuffer (this );
512512
513- glStencil = PGraphicsOpenGL .createRenderBufferObject (context );
513+ glStencil = PGraphicsOpenGL .createRenderBufferObject (context , pgl );
514514 pgl .bindRenderbuffer (PGL .RENDERBUFFER , glStencil );
515515
516516 int glConst = PGL .STENCIL_INDEX1 ;
0 commit comments