mirror of
https://github.com/processing/processing4.git
synced 2026-02-13 18:35:37 +01:00
fixes #2345, and also a bug in the coordinates passed to drawTexture()
in the Texture class.
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user