From a593a85c19ba2ffb22d75b866ef4310f43bba560 Mon Sep 17 00:00:00 2001 From: codeanticode Date: Mon, 18 Jun 2012 16:19:22 +0000 Subject: [PATCH] Fixed the bug in frustum() that resulted in texture blurriness. --- .../processing/opengl/PGraphicsOpenGL.java | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/java/libraries/opengl/src/processing/opengl/PGraphicsOpenGL.java b/java/libraries/opengl/src/processing/opengl/PGraphicsOpenGL.java index a685907e4..7d701a3c1 100644 --- a/java/libraries/opengl/src/processing/opengl/PGraphicsOpenGL.java +++ b/java/libraries/opengl/src/processing/opengl/PGraphicsOpenGL.java @@ -3977,6 +3977,8 @@ public class PGraphicsOpenGL extends PGraphics { 0, -y, 0, ty, 0, 0, z, tz, 0, 0, 0, 1); + + calcProjmodelview(); } @@ -4028,18 +4030,12 @@ public class PGraphicsOpenGL extends PGraphics { // Flushing geometry with a different perspective configuration. flush(); - float temp, temp2, temp3, temp4; - temp = 2.0f * znear; - temp2 = right - left; - temp3 = top - bottom; - temp4 = zfar - znear; - - // The minus sign in the temp / temp3 term is to invert the Y axis. - projection.set(temp / temp2, 0, (right + left) / temp2, 0, - 0, -temp / temp3, (top + bottom) / temp3, 0, - 0, 0, (-zfar - znear) / temp4, (-temp * zfar) / temp4, - 0, 0, -1, 1); - + //System.out.println(projection); + projection.set((2*znear)/(right-left), 0, (right+left)/(right-left), 0, + 0, -(2*znear)/(top-bottom), (top+bottom)/(top-bottom), 0, + 0, 0, -(zfar+znear)/(zfar-znear),-(2*zfar*znear)/(zfar-znear), + 0, 0, -1, 0); + calcProjmodelview(); }