making offscreen surfaces opaque

This commit is contained in:
codeanticode
2012-06-21 04:20:53 +00:00
parent d1fceedd9d
commit 453316cd58
2 changed files with 20 additions and 1 deletions
@@ -1288,6 +1288,11 @@ public class PGL {
gl.glClearStencil(s);
}
public void glColorMask(boolean wr, boolean wg, boolean wb, boolean wa) {
gl.glColorMask(wr, wg, wb, wa);
}
public void glClearColor(float r, float g, float b, float a) {
gl.glClearColor(r, g, b, a);
@@ -1645,7 +1645,21 @@ public class PGraphicsOpenGL extends PGraphics {
}
popFramebuffer();
// Make the offscreen color buffer opaque so it doesn't show
// the background when drawn on the main surface.
if (offscreenMultisample) {
pushFramebuffer();
setFramebuffer(offscreenFramebuffer);
}
pgl.glColorMask(false, false, false, true);
pgl.glClearColor(0, 0, 0, 1);
pgl.glClear(PGL.GL_COLOR_BUFFER_BIT);
pgl.glColorMask(true, true, true, true);
if (offscreenMultisample) {
popFramebuffer();
}
pgl.endOffscreenDraw(pgPrimary.clearColorBuffer0);
pgPrimary.restoreGL();