From 247690b142fa2366906072409a6f2829fa4d166e Mon Sep 17 00:00:00 2001 From: codeanticode Date: Sun, 31 May 2015 18:44:59 -0400 Subject: [PATCH] inits pixelWidth, pixelHeight --- core/src/processing/opengl/PGraphicsOpenGL.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/src/processing/opengl/PGraphicsOpenGL.java b/core/src/processing/opengl/PGraphicsOpenGL.java index 3a32b3741..8e09b5827 100644 --- a/core/src/processing/opengl/PGraphicsOpenGL.java +++ b/core/src/processing/opengl/PGraphicsOpenGL.java @@ -590,6 +590,9 @@ public class PGraphicsOpenGL extends PGraphics { public void setSize(int iwidth, int iheight) { width = iwidth; height = iheight; + float f = getPixelScale(); + pixelWidth = (int)(width * f); + pixelHeight = (int)(height * f); // init perspective projection based on new dimensions cameraFOV = 60 * DEG_TO_RAD; // at least for now @@ -700,7 +703,8 @@ public class PGraphicsOpenGL extends PGraphics { public float getPixelScale() { - return surfaceJOGL.getPixelScale(); + if (surfaceJOGL == null) return pixelFactor; + else return surfaceJOGL.getPixelScale(); }