mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
using processing Y-axis orientation for ortho() and frustum(), centering ortho() at top left corner.
This commit is contained in:
@@ -120,7 +120,7 @@ public class PGraphics2D extends PGraphicsOpenGL {
|
||||
|
||||
@Override
|
||||
protected void defaultPerspective() {
|
||||
super.ortho(0, width, height, 0, -1, +1);
|
||||
super.ortho(0, width, 0, height, -1, +1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ public class PGraphics3D extends PGraphicsOpenGL {
|
||||
@Override
|
||||
protected void begin2D() {
|
||||
pushProjection();
|
||||
ortho(0, width, height, 0, -1, +1);
|
||||
ortho(0, width, 0, height, -1, +1);
|
||||
pushMatrix();
|
||||
camera(width/2, height/2);
|
||||
}
|
||||
|
||||
@@ -4054,7 +4054,7 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
*/
|
||||
@Override
|
||||
public void ortho() {
|
||||
ortho(0, width, height, 0, cameraNear, cameraFar);
|
||||
ortho(0, width, 0, height, cameraNear, cameraFar);
|
||||
}
|
||||
|
||||
|
||||
@@ -4094,10 +4094,10 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
float tz = -(far + near) / (far - near);
|
||||
|
||||
// The minus sign is needed to invert the Y axis.
|
||||
projection.set(x, 0, 0, tx,
|
||||
0, y, 0, ty,
|
||||
0, 0, z, tz,
|
||||
0, 0, 0, 1);
|
||||
projection.set(x, 0, 0, tx,
|
||||
0, -y, 0, ty,
|
||||
0, 0, z, tz,
|
||||
0, 0, 0, 1);
|
||||
|
||||
calcProjmodelview();
|
||||
|
||||
@@ -4140,7 +4140,7 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
float ymin = -ymax;
|
||||
float xmin = ymin * aspect;
|
||||
float xmax = ymax * aspect;
|
||||
frustum(xmin, xmax, ymax, ymin, zNear, zFar);
|
||||
frustum(xmin, xmax, ymin, ymax, zNear, zFar);
|
||||
}
|
||||
|
||||
|
||||
@@ -4161,10 +4161,10 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
float h = top - bottom;
|
||||
float d = zfar - znear;
|
||||
|
||||
projection.set(n2 / w, 0, (right + left) / w, 0,
|
||||
0, n2 / h, (top + bottom) / h, 0,
|
||||
0, 0, -(zfar + znear) / d, -(n2 * zfar) / d,
|
||||
0, 0, -1, 0);
|
||||
projection.set(n2 / w, 0, (right + left) / w, 0,
|
||||
0, -n2 / h, (top + bottom) / h, 0,
|
||||
0, 0, -(zfar + znear) / d, -(n2 * zfar) / d,
|
||||
0, 0, -1, 0);
|
||||
|
||||
calcProjmodelview();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user