From 5a3d15da5d91ff86114dd638c041fd9c81a938de Mon Sep 17 00:00:00 2001 From: codeanticode Date: Tue, 20 Aug 2013 16:44:49 -0400 Subject: [PATCH] divide width and height by 2f to properly take into account resolutions that are not divisible by 2 --- core/src/processing/opengl/PGraphics2D.java | 2 +- core/src/processing/opengl/PGraphicsOpenGL.java | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/src/processing/opengl/PGraphics2D.java b/core/src/processing/opengl/PGraphics2D.java index a1ad432d8..dd4089dca 100644 --- a/core/src/processing/opengl/PGraphics2D.java +++ b/core/src/processing/opengl/PGraphics2D.java @@ -156,7 +156,7 @@ public class PGraphics2D extends PGraphicsOpenGL { @Override protected void defaultCamera() { - super.camera(width/2, height/2); + super.camera(width/2f, height/2f); } diff --git a/core/src/processing/opengl/PGraphicsOpenGL.java b/core/src/processing/opengl/PGraphicsOpenGL.java index d05c68004..22a10a530 100644 --- a/core/src/processing/opengl/PGraphicsOpenGL.java +++ b/core/src/processing/opengl/PGraphicsOpenGL.java @@ -4278,10 +4278,10 @@ public class PGraphicsOpenGL extends PGraphics { public void ortho(float left, float right, float bottom, float top, float near, float far) { - left -= width/2; - right -= width/2; - bottom -= height/2; - top -= height/2; + left -= width/2f; + right -= width/2f; + bottom -= height/2f; + top -= height/2f; // Flushing geometry with a different perspective configuration. flush();