diff --git a/core/src/processing/opengl/PGL.java b/core/src/processing/opengl/PGL.java index 3e8d0592f..42e338330 100644 --- a/core/src/processing/opengl/PGL.java +++ b/core/src/processing/opengl/PGL.java @@ -590,8 +590,7 @@ public abstract class PGL { disable(BLEND); drawTexture(TEXTURE_2D, glColorTex.get(backTex), fboWidth, fboHeight, pg.width, pg.height, - 0, 0, pg.width, pg.height, - 0, 0, pg.width, pg.height); + 0, 0, pg.width, pg.height, 0, 0, pg.width, pg.height); // Swapping front and back textures. int temp = frontTex; diff --git a/core/src/processing/opengl/PGraphicsOpenGL.java b/core/src/processing/opengl/PGraphicsOpenGL.java index bf2cb2442..d80ba239d 100644 --- a/core/src/processing/opengl/PGraphicsOpenGL.java +++ b/core/src/processing/opengl/PGraphicsOpenGL.java @@ -3392,8 +3392,8 @@ public class PGraphicsOpenGL extends PGraphics { pushMatrix(); if (shapeMode == CENTER) { - translate(x - shape.getWidth() / 2, y - shape.getHeight() / 2, z - - shape.getDepth() / 2); + translate(x - shape.getWidth() / 2, y - shape.getHeight() / 2, + z - shape.getDepth() / 2); } else if ((shapeMode == CORNER) || (shapeMode == CORNERS)) { translate(x, y, z); @@ -5894,21 +5894,27 @@ public class PGraphicsOpenGL extends PGraphics { scrX0 = dx; scrX1 = dx + dw; } + + int texX0 = sx; + int texX1 = sx + sw; + int texY0, texY1; if (invY) { scrY0 = height - (dy + dh); scrY1 = height - dy; + texY0 = tex.height - (sy + sh); + texY1 = tex.height - sy; } else { // Because drawTexture uses bottom-to-top orientation of Y axis. scrY0 = height - dy; scrY1 = height - (dy + dh); + texY0 = sy; + texY1 = sy + sh; } pgl.drawTexture(tex.glTarget, tex.glName, tex.glWidth, tex.glHeight, width, height, - sx, tex.height - (sy + sh), - sx + sw, tex.height - sy, - scrX0, scrY0, - scrX1, scrY1); + texX0, texY0, texX1, texY1, + scrX0, scrY0, scrX1, scrY1); if (needEndDraw) { diff --git a/core/src/processing/opengl/Texture.java b/core/src/processing/opengl/Texture.java index 990d584e3..5996ec028 100644 --- a/core/src/processing/opengl/Texture.java +++ b/core/src/processing/opengl/Texture.java @@ -1252,14 +1252,14 @@ public class Texture implements PConstants { pg.setFramebuffer(tempFbo); // Clear the color buffer to make sure that the alpha channel is set to // full transparency - pgl.clearColor(0, 0, 0, 0); + pgl.clearColor(1, 1, 1, 1); pgl.clear(PGL.COLOR_BUFFER_BIT); if (scale) { // Rendering tex into "this", and scaling the source rectangle // to cover the entire destination region. pgl.drawTexture(tex.glTarget, tex.glName, tex.glWidth, tex.glHeight, tempFbo.width, tempFbo.height, - x, y, w, h, 0, 0, width, height); + x, y, x + w, y + h, 0, 0, width, height); } else { // Rendering tex into "this" but without scaling so the contents @@ -1267,7 +1267,7 @@ public class Texture implements PConstants { // destination. pgl.drawTexture(tex.glTarget, tex.glName, tex.glWidth, tex.glHeight, tempFbo.width, tempFbo.height, - x, y, w, h, x, y, w, h); + x, y, x + w, y + h, x, y, x + w, y + h); } pg.popFramebuffer();