using processing Y-axis orientation for ortho() and frustum(), centering ortho() at top left corner.

This commit is contained in:
codeanticode
2012-11-30 02:41:23 +00:00
parent 525b16a6a2
commit f49e889773
3 changed files with 12 additions and 12 deletions
+1 -1
View File
@@ -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);
}
+1 -1
View File
@@ -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);
}
+10 -10
View File
@@ -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();