From 3f3e3bccc7bf067aeffb99d0e23db093dd7af398 Mon Sep 17 00:00:00 2001 From: codeanticode Date: Thu, 16 Aug 2012 20:19:31 +0000 Subject: [PATCH] Unwrap GLExceptions to show only the causing exception --- core/andres.txt | 2 +- core/src/processing/opengl/PGL.java | 20 +++++++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/core/andres.txt b/core/andres.txt index 25c3e698d..8a82c3b72 100644 --- a/core/andres.txt +++ b/core/andres.txt @@ -1,6 +1,7 @@ 0208 opengl X Make methods in PGL used by opengl protected, then remove gl from the public GL methods X Texture wrapping option in PGraphics: textureWrap(mode) +X Unwrap GLException to avoid confusion when common, non-GL errors occur. 0208 video X Cleanup video API: @@ -13,7 +14,6 @@ API changes/additions (for beta release) _ Add DISABLE_PERSPECTIVE_CORRECTED_STROKE hint, remove DISABLE_PERSPECTIVE_CORRECTED_LINES _ Rename shader constants (FLAT, LIT, TEXTURED, etc), resetShader() w/out args? _ Back-buffer support in shaders: http://code.google.com/p/processing/issues/detail?id=1169 -_ Unwrap GLException to avoid confusion when common, non-GL errors occur. processing-core todo (after beta): _ Cleaner Implementation of PImage.loadPixels() diff --git a/core/src/processing/opengl/PGL.java b/core/src/processing/opengl/PGL.java index 3a97aa552..b4cdbb819 100644 --- a/core/src/processing/opengl/PGL.java +++ b/core/src/processing/opengl/PGL.java @@ -44,6 +44,7 @@ import javax.media.opengl.GLCapabilitiesImmutable; import javax.media.opengl.GLContext; import javax.media.opengl.GLDrawable; import javax.media.opengl.GLEventListener; +import javax.media.opengl.GLException; import javax.media.opengl.GLProfile; import javax.media.opengl.awt.GLCanvas; import javax.media.opengl.glu.GLU; @@ -914,14 +915,19 @@ public class PGL { protected void requestDraw() { if (initialized) { - //animator.requestDisplay(); - - if (toolkit == AWT) { - canvasAWT.display(); - } else if (toolkit == NEWT) { - animator.requestDisplay(); + try { + //animator.requestDisplay(); + if (toolkit == AWT) { + canvasAWT.display(); + } else if (toolkit == NEWT) { + animator.requestDisplay(); + } + } catch (GLException e) { + // Unwrap GLException to only the causing exception and so + // avoid the additional jogl lines. + Throwable tr = e.getCause(); + throw (RuntimeException)tr; } - } }