mirror of
https://github.com/processing/processing4.git
synced 2026-05-27 18:47:04 +02:00
making offscreen surfaces opaque
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user