From 6f2c17b1881bc92d7ffb826b49ecf4d97a77e58a Mon Sep 17 00:00:00 2001 From: codeanticode Date: Tue, 14 Aug 2012 18:25:39 +0000 Subject: [PATCH] throws exceptions if required extensions are not available --- .../processing/opengl/PGraphicsOpenGL.java | 21 +++++++++++++++---- .../processing/opengl/PGraphicsOpenGL.java | 21 +++++++++++++++---- 2 files changed, 34 insertions(+), 8 deletions(-) diff --git a/android/core/src/processing/opengl/PGraphicsOpenGL.java b/android/core/src/processing/opengl/PGraphicsOpenGL.java index 9717c28b9..8b5ea279a 100644 --- a/android/core/src/processing/opengl/PGraphicsOpenGL.java +++ b/android/core/src/processing/opengl/PGraphicsOpenGL.java @@ -5696,10 +5696,23 @@ public class PGraphicsOpenGL extends PGraphics { OPENGL_EXTENSIONS = pgl.getString(PGL.EXTENSIONS); GLSL_VERSION = pgl.getString(PGL.SHADING_LANGUAGE_VERSION); - npotTexSupported = -1 < OPENGL_EXTENSIONS.indexOf("texture_non_power_of_two"); - autoMipmapGenSupported = -1 < OPENGL_EXTENSIONS.indexOf("generate_mipmap"); - fboMultisampleSupported = -1 < OPENGL_EXTENSIONS.indexOf("framebuffer_multisample"); - packedDepthStencilSupported = -1 < OPENGL_EXTENSIONS.indexOf("packed_depth_stencil"); + if (-1 == OPENGL_EXTENSIONS.indexOf("_framebuffer_object")) { + throw new RuntimeException("No framebuffer objects available"); + } + if (-1 == OPENGL_EXTENSIONS.indexOf("_vertex_buffer_object")) { + throw new RuntimeException("No vertex buffer objects available"); + } + if (-1 == OPENGL_EXTENSIONS.indexOf("_vertex_shader")) { + throw new RuntimeException("No vertex shaders available"); + } + if (-1 == OPENGL_EXTENSIONS.indexOf("_fragment_shader")) { + throw new RuntimeException("No fragment shaders available"); + } + + npotTexSupported = -1 < OPENGL_EXTENSIONS.indexOf("_texture_non_power_of_two"); + autoMipmapGenSupported = -1 < OPENGL_EXTENSIONS.indexOf("_generate_mipmap"); + fboMultisampleSupported = -1 < OPENGL_EXTENSIONS.indexOf("_framebuffer_multisample"); + packedDepthStencilSupported = -1 < OPENGL_EXTENSIONS.indexOf("_packed_depth_stencil"); try { pgl.blendEquation(PGL.FUNC_ADD); diff --git a/core/src/processing/opengl/PGraphicsOpenGL.java b/core/src/processing/opengl/PGraphicsOpenGL.java index 9717c28b9..8b5ea279a 100644 --- a/core/src/processing/opengl/PGraphicsOpenGL.java +++ b/core/src/processing/opengl/PGraphicsOpenGL.java @@ -5696,10 +5696,23 @@ public class PGraphicsOpenGL extends PGraphics { OPENGL_EXTENSIONS = pgl.getString(PGL.EXTENSIONS); GLSL_VERSION = pgl.getString(PGL.SHADING_LANGUAGE_VERSION); - npotTexSupported = -1 < OPENGL_EXTENSIONS.indexOf("texture_non_power_of_two"); - autoMipmapGenSupported = -1 < OPENGL_EXTENSIONS.indexOf("generate_mipmap"); - fboMultisampleSupported = -1 < OPENGL_EXTENSIONS.indexOf("framebuffer_multisample"); - packedDepthStencilSupported = -1 < OPENGL_EXTENSIONS.indexOf("packed_depth_stencil"); + if (-1 == OPENGL_EXTENSIONS.indexOf("_framebuffer_object")) { + throw new RuntimeException("No framebuffer objects available"); + } + if (-1 == OPENGL_EXTENSIONS.indexOf("_vertex_buffer_object")) { + throw new RuntimeException("No vertex buffer objects available"); + } + if (-1 == OPENGL_EXTENSIONS.indexOf("_vertex_shader")) { + throw new RuntimeException("No vertex shaders available"); + } + if (-1 == OPENGL_EXTENSIONS.indexOf("_fragment_shader")) { + throw new RuntimeException("No fragment shaders available"); + } + + npotTexSupported = -1 < OPENGL_EXTENSIONS.indexOf("_texture_non_power_of_two"); + autoMipmapGenSupported = -1 < OPENGL_EXTENSIONS.indexOf("_generate_mipmap"); + fboMultisampleSupported = -1 < OPENGL_EXTENSIONS.indexOf("_framebuffer_multisample"); + packedDepthStencilSupported = -1 < OPENGL_EXTENSIONS.indexOf("_packed_depth_stencil"); try { pgl.blendEquation(PGL.FUNC_ADD);