some minor fixes in the handling of FBOs

This commit is contained in:
codeanticode
2012-06-21 16:51:32 +00:00
parent 80ac5f856c
commit 548e795cdf
3 changed files with 46 additions and 29 deletions
@@ -654,6 +654,10 @@ public class PGL {
// to update the screenFramebuffer object so when the framebuffer
// is popped back to the screen, the correct id is set.
PGraphicsOpenGL.screenFramebuffer.glFboID = colorFBO[0];
} else {
// To make sure that the default screen buffer is used, specially after
// doing screen rendering on an FBO (the OSX 10.7+ above).
PGraphicsOpenGL.screenFramebuffer.glFboID = 0;
}
}
@@ -1434,7 +1434,9 @@ public class PGraphicsOpenGL extends PGraphics {
if (primarySurface) {
pgl.updatePrimary();
pgl.glDrawBuffer(PGL.GL_BACK);
if (pgl.primaryIsDoubleBuffered()) {
pgl.glDrawBuffer(PGL.GL_BACK);
}
} else {
if (!pgl.initialized) {
initOffscreen();
@@ -1630,6 +1632,7 @@ public class PGraphicsOpenGL extends PGraphics {
offscreenFramebufferMultisample.copy(offscreenFramebuffer);
}
/*
// Make the offscreen color buffer opaque so it doesn't show
// the background when drawn on the main surface.
if (offscreenMultisample) {
@@ -1643,7 +1646,8 @@ public class PGraphicsOpenGL extends PGraphics {
if (offscreenMultisample) {
popFramebuffer();
}
*/
if (!pgl.initialized || !pgPrimary.pgl.initialized || parent.frameCount == 0) {
// If the primary surface is re-initialized, this offscreen
// surface needs to save its contents into the pixels array
@@ -1661,10 +1665,10 @@ public class PGraphicsOpenGL extends PGraphics {
popFramebuffer();
pgl.endOffscreenDraw(pgPrimary.clearColorBuffer0);
pgPrimary.restoreGL();
}
// Done!
drawing = false;
if (pgCurrent == pgPrimary) {
@@ -1727,7 +1731,9 @@ public class PGraphicsOpenGL extends PGraphics {
pgl.glDepthMask(true);
}
pgl.glDrawBuffer(PGL.GL_BACK);
if (pgl.primaryIsDoubleBuffered()) {
pgl.glDrawBuffer(PGL.GL_BACK);
}
}