From 1d0b3a27aacd6ec0ebc865cef61c3f326f5dde5c Mon Sep 17 00:00:00 2001 From: codeanticode Date: Thu, 10 May 2012 19:27:03 +0000 Subject: [PATCH] disabled perspective correction for lines in P2D and handling loadPixels() call outside beginDraw/endDraw --- .../opengl/src/processing/opengl/PGraphics2D.java | 1 + .../opengl/src/processing/opengl/PGraphicsOpenGL.java | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/java/libraries/opengl/src/processing/opengl/PGraphics2D.java b/java/libraries/opengl/src/processing/opengl/PGraphics2D.java index 586a376a6..5e5aeb394 100644 --- a/java/libraries/opengl/src/processing/opengl/PGraphics2D.java +++ b/java/libraries/opengl/src/processing/opengl/PGraphics2D.java @@ -28,6 +28,7 @@ public class PGraphics2D extends PGraphicsOpenGL { public PGraphics2D() { super(); hints[ENABLE_ACCURATE_2D] = true; + hints[ENABLE_PERSPECTIVE_CORRECTED_LINES] = false; } } \ No newline at end of file diff --git a/java/libraries/opengl/src/processing/opengl/PGraphicsOpenGL.java b/java/libraries/opengl/src/processing/opengl/PGraphicsOpenGL.java index 5e4f6a05a..2a19e061f 100644 --- a/java/libraries/opengl/src/processing/opengl/PGraphicsOpenGL.java +++ b/java/libraries/opengl/src/processing/opengl/PGraphicsOpenGL.java @@ -4674,6 +4674,12 @@ public class PGraphicsOpenGL extends PGraphics { // Initializes the pixels array, copying the current contents of the // color buffer into it. public void loadPixels() { + boolean needEndDraw = false; + if (!drawing) { + beginDraw(); + needEndDraw = true; + } + if (!setgetPixels) { // Draws any remaining geometry in case the user is still not // setting/getting new pixels. @@ -4690,6 +4696,10 @@ public class PGraphicsOpenGL extends PGraphics { pixelsToTexture(); } } + + if (needEndDraw) { + endDraw(); + } }