From e4d142fa647f470a9dd434fb89db4425c9b3f527 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 20 Mar 2009 18:40:32 +0000 Subject: Fix GLProfile.isGL2ES[12](), adding GLProfile.hasGLSL() git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JOGL_2_SANDBOX@1896 232f8b59-042b-4e1e-8c03-345bb8c30851 --- src/jogl/classes/com/sun/opengl/util/GLArrayDataClient.java | 8 ++++---- src/jogl/classes/com/sun/opengl/util/GLArrayDataServer.java | 8 ++++---- src/jogl/classes/com/sun/opengl/util/GLArrayDataWrapper.java | 4 ++-- src/jogl/classes/com/sun/opengl/util/ImmModeSink.java | 2 +- src/jogl/classes/javax/media/opengl/GLDrawableFactory.java | 2 +- src/jogl/classes/javax/media/opengl/GLProfile.java | 11 +++++++++-- 6 files changed, 21 insertions(+), 14 deletions(-) (limited to 'src/jogl/classes') diff --git a/src/jogl/classes/com/sun/opengl/util/GLArrayDataClient.java b/src/jogl/classes/com/sun/opengl/util/GLArrayDataClient.java index 8bfd60834..7037da97d 100644 --- a/src/jogl/classes/com/sun/opengl/util/GLArrayDataClient.java +++ b/src/jogl/classes/com/sun/opengl/util/GLArrayDataClient.java @@ -63,8 +63,8 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData int initialSize) throws GLException { - if(!GLProfile.isGL2ES2()) { - throw new GLException("GLArrayDataServer not supported for profile: "+GLProfile.getProfile()); + if(!GLProfile.hasGLSL()) { + throw new GLException("GLArrayDataClient.GLSL not supported for profile: "+GLProfile.getProfile()); } GLProfile.isValidArrayDataType(-1, comps, dataType, true, true); @@ -78,8 +78,8 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData int stride, Buffer buffer) throws GLException { - if(!GLProfile.isGL2ES2()) { - throw new GLException("GLArrayDataServer not supported for profile: "+GLProfile.getProfile()); + if(!GLProfile.hasGLSL()) { + throw new GLException("GLArrayDataClient.GLSL not supported for profile: "+GLProfile.getProfile()); } GLProfile.isValidArrayDataType(-1, comps, dataType, true, true); diff --git a/src/jogl/classes/com/sun/opengl/util/GLArrayDataServer.java b/src/jogl/classes/com/sun/opengl/util/GLArrayDataServer.java index caf6efe12..5c3fc39f0 100644 --- a/src/jogl/classes/com/sun/opengl/util/GLArrayDataServer.java +++ b/src/jogl/classes/com/sun/opengl/util/GLArrayDataServer.java @@ -78,8 +78,8 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE int initialSize, int vboBufferUsage) throws GLException { - if(!GLProfile.isGL2ES2()) { - throw new GLException("GLArrayDataServer not supported for profile: "+GLProfile.getProfile()); + if(!GLProfile.hasGLSL()) { + throw new GLException("GLArrayDataServer.GLSL not supported for profile: "+GLProfile.getProfile()); } GLProfile.isValidArrayDataType(-1, comps, dataType, true, true); @@ -100,8 +100,8 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE int stride, Buffer buffer, int vboBufferUsage) throws GLException { - if(!GLProfile.isGL2ES2()) { - throw new GLException("GLArrayDataServer not supported for profile: "+GLProfile.getProfile()); + if(!GLProfile.hasGLSL()) { + throw new GLException("GLArrayDataServer.GLSL not supported for profile: "+GLProfile.getProfile()); } GLProfile.isValidArrayDataType(-1, comps, dataType, true, true); diff --git a/src/jogl/classes/com/sun/opengl/util/GLArrayDataWrapper.java b/src/jogl/classes/com/sun/opengl/util/GLArrayDataWrapper.java index a36ebc60a..04009595e 100644 --- a/src/jogl/classes/com/sun/opengl/util/GLArrayDataWrapper.java +++ b/src/jogl/classes/com/sun/opengl/util/GLArrayDataWrapper.java @@ -26,8 +26,8 @@ public class GLArrayDataWrapper implements GLArrayData { int vboName, long bufferOffset) throws GLException { - if(!GLProfile.isGL2ES2()) { - throw new GLException("GLArrayDataServer not supported for profile: "+GLProfile.getProfile()); + if(!GLProfile.hasGLSL()) { + throw new GLException("GLArrayDataWrapper.GLSL not supported for profile: "+GLProfile.getProfile()); } GLProfile.isValidArrayDataType(-1, comps, dataType, true, true); diff --git a/src/jogl/classes/com/sun/opengl/util/ImmModeSink.java b/src/jogl/classes/com/sun/opengl/util/ImmModeSink.java index 90ea9ce7c..ad4e58129 100644 --- a/src/jogl/classes/com/sun/opengl/util/ImmModeSink.java +++ b/src/jogl/classes/com/sun/opengl/util/ImmModeSink.java @@ -258,7 +258,7 @@ public class ImmModeSink { int cComps, int cDataType, int nComps, int nDataType, int tComps, int tDataType, boolean useGLSL) { - if(useGLSL && !GLProfile.isGL2ES2()) { + if(useGLSL && !GLProfile.hasGLSL()) { throw new GLException("ImmModeSink GLSL usage not supported for profile: "+GLProfile.getProfile()); } vboSet = new VBOSet(glBufferUsage, initialSize, diff --git a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java index 5a3f9f4e9..7e46b822c 100644 --- a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java +++ b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java @@ -104,7 +104,7 @@ public abstract class GLDrawableFactory { } catch (Exception e) { e.printStackTrace(); } - } else if (!GLProfile.isGL2() && !GLProfile.isGL2ES1() && !GLProfile.isGL2ES2()) { + } else if (!GLProfile.isGL2ES1() && !GLProfile.isGL2ES2()) { // We require that the user passes in one of the known profiles throw new GLException("Unknown or unsupported profile \"" + GLProfile.getProfile() + "\""); } diff --git a/src/jogl/classes/javax/media/opengl/GLProfile.java b/src/jogl/classes/javax/media/opengl/GLProfile.java index 1ac09c12e..8c5d8a3bf 100644 --- a/src/jogl/classes/javax/media/opengl/GLProfile.java +++ b/src/jogl/classes/javax/media/opengl/GLProfile.java @@ -201,12 +201,14 @@ public class GLProfile { return GLES2.equals(profile); } + /* Indicates whether a GL2ES1 capable profile is in use, ie GL2ES1, GL2, GLES1 */ public static final boolean isGL2ES1() { - return GL2ES1.equals(profile); + return GL2ES1.equals(profile) || isGL2() || isGLES1() ; } + /* Indicates whether a GL2ES2 capable profile is in use, ie GL2ES2, GL2, GLES2 */ public static final boolean isGL2ES2() { - return GL2ES2.equals(profile); + return GL2ES2.equals(profile) || isGL2() || isGLES2() ; } /** Indicates whether either of the OpenGL ES profiles are in use. */ @@ -214,6 +216,11 @@ public class GLProfile { return isGLES2() || isGLES1(); } + /** Indicates whether a GLSL capable profiles is in use. */ + public static final boolean hasGLSL() { + return isGL2ES2(); + } + public static final boolean matches(String test_profile) { return (null==test_profile)?false:test_profile.equals(profile); } -- cgit v1.2.3