don't draw the back texture onto the front texture when background is used

This commit is contained in:
codeanticode
2012-11-24 17:12:13 +00:00
parent 850e9778d1
commit 844807bb05
2 changed files with 18 additions and 19 deletions
+2 -2
View File
@@ -859,10 +859,10 @@ public class PGL {
protected void endOnscreenDraw(boolean clear0) {
if (isFBOBacked() && capabilities.getNumSamples() == 0) {
if (!clear0 && isFBOBacked() && capabilities.getNumSamples() == 0) {
// Draw the back texture into the front texture, which will be used as
// front texture in the next frame. Otherwise flickering will occur if
// the sketch uses "incremental drawing" (no background()).
// the sketch uses "incremental drawing" (background() not called).
frontFBO.bind(gl);
gl.glDisable(GL.GL_BLEND);
drawTexture(GL.GL_TEXTURE_2D, backTex.getName(),
+16 -17
View File
@@ -1727,7 +1727,7 @@ public class PGraphicsOpenGL extends PGraphics {
if (primarySurface) {
pgl.beginOnscreenDraw(clearColorBuffer);
} else {
pgl.beginOffscreenDraw(pgPrimary.clearColorBuffer);
pgl.beginOffscreenDraw(clearColorBuffer);
// Just in case the texture was recreated (in a resize event for example)
offscreenFramebuffer.setColorBuffer(texture);
@@ -1822,28 +1822,27 @@ public class PGraphicsOpenGL extends PGraphics {
restoreSurface = true;
}
// Draw the back texture into the front texture, which will be used as
// front texture in the next frame. Otherwise flickering will occur if
// the sketch uses "incremental drawing" (no background()).
if (offscreenMultisample) {
pushFramebuffer();
setFramebuffer(offscreenFramebuffer);
if (!clearColorBuffer0) {
// Draw the back texture into the front texture, which will be used as
// front texture in the next frame. Otherwise flickering will occur if
// the sketch uses "incremental drawing" (background() not called).
if (offscreenMultisample) {
pushFramebuffer();
setFramebuffer(offscreenFramebuffer);
}
offscreenFramebuffer.setColorBuffer(ptexture);
drawTexture();
offscreenFramebuffer.setColorBuffer(texture);
if (offscreenMultisample) {
popFramebuffer();
}
}
offscreenFramebuffer.setColorBuffer(ptexture);
drawTexture();
offscreenFramebuffer.setColorBuffer(texture);
if (offscreenMultisample) {
popFramebuffer();
}
popFramebuffer();
texture.updateTexels(); // Mark all texels in screen texture as modified.
pgl.endOffscreenDraw(pgPrimary.clearColorBuffer0);
pgl.endOffscreenDraw(clearColorBuffer0);
int temp = texture.glName;
texture.glName = ptexture.glName;