From 54dcdf1f53c9fc1f7124cf77bbf5aa952d42053a Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Tue, 3 Sep 2013 15:24:10 +0200 Subject: GL*, GLContext: Expose isGL2ES3() and getGL2ES3() for convenience. --- make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java | 13 +++++++++++++ make/config/jogl/gl-impl-CustomJavaCode-gles1.java | 10 ++++++++++ make/config/jogl/gl-impl-CustomJavaCode-gles3.java | 13 +++++++++++++ .../com/jogamp/gluegen/opengl/BuildComposablePipeline.java | 2 ++ src/jogl/classes/javax/media/opengl/GLBase.java | 12 ++++++++++++ src/jogl/classes/javax/media/opengl/GLContext.java | 9 +++++++++ 6 files changed, 59 insertions(+) diff --git a/make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java b/make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java index e4959a32d..d1a4ceda0 100644 --- a/make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java +++ b/make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java @@ -89,6 +89,11 @@ public final boolean isGL2ES2() { return _context.isGL2ES2(); } +@Override +public final boolean isGL2ES3() { + return _context.isGL2ES3(); +} + @Override public final boolean isGL3ES3() { return _context.isGL3ES3(); @@ -190,6 +195,14 @@ public final GL2ES2 getGL2ES2() throws GLException { return this; } +@Override +public final GL2ES3 getGL2ES3() throws GLException { + if(!isGL2ES3()) { + throw new GLException("Not a GL2ES3 implementation"); + } + return this; +} + @Override public final GL3ES3 getGL3ES3() throws GLException { if(!isGL3ES3()) { diff --git a/make/config/jogl/gl-impl-CustomJavaCode-gles1.java b/make/config/jogl/gl-impl-CustomJavaCode-gles1.java index 5d0af6913..deb73e042 100644 --- a/make/config/jogl/gl-impl-CustomJavaCode-gles1.java +++ b/make/config/jogl/gl-impl-CustomJavaCode-gles1.java @@ -67,6 +67,11 @@ public final boolean isGL2ES2() { return false; } +@Override +public final boolean isGL2ES3() { + return false; +} + @Override public final boolean isGL3ES3() { return false; @@ -162,6 +167,11 @@ public final GL2ES1 getGL2ES1() throws GLException { return this; } +@Override +public final GL2ES3 getGL2ES3() throws GLException { + throw new GLException("Not a GL2ES3 implementation"); +} + @Override public final GL2ES2 getGL2ES2() throws GLException { throw new GLException("Not a GL2ES2 implementation"); diff --git a/make/config/jogl/gl-impl-CustomJavaCode-gles3.java b/make/config/jogl/gl-impl-CustomJavaCode-gles3.java index f5075c919..5c58f6cc4 100644 --- a/make/config/jogl/gl-impl-CustomJavaCode-gles3.java +++ b/make/config/jogl/gl-impl-CustomJavaCode-gles3.java @@ -71,6 +71,11 @@ public final boolean isGL2ES2() { return true; } +@Override +public final boolean isGL2ES3() { + return _isES3; +} + @Override public final boolean isGL3ES3() { return _isES3; @@ -172,6 +177,14 @@ public final GL2ES2 getGL2ES2() throws GLException { return this; } +@Override +public final GL2ES3 getGL2ES3() throws GLException { + if(!_isES3) { + throw new GLException("Not a GL2ES3 implementation"); + } + return this; +} + @Override public final GL3ES3 getGL3ES3() throws GLException { if(!_isES3) { diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.java b/src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.java index 262fed934..b04f35230 100644 --- a/src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.java +++ b/src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.java @@ -657,6 +657,7 @@ public class BuildComposablePipeline { emitGLIsMethod(output, "GLES3"); emitGLIsMethod(output, "GL2ES1"); emitGLIsMethod(output, "GL2ES2"); + emitGLIsMethod(output, "GL2ES3"); emitGLIsMethod(output, "GL3ES3"); emitGLIsMethod(output, "GL4ES3"); emitGLIsMethod(output, "GL2GL3"); @@ -724,6 +725,7 @@ public class BuildComposablePipeline { emitGLGetMethod(output, "GLES3"); emitGLGetMethod(output, "GL2ES1"); emitGLGetMethod(output, "GL2ES2"); + emitGLGetMethod(output, "GL2ES3"); emitGLGetMethod(output, "GL3ES3"); emitGLGetMethod(output, "GL4ES3"); emitGLGetMethod(output, "GL2GL3"); diff --git a/src/jogl/classes/javax/media/opengl/GLBase.java b/src/jogl/classes/javax/media/opengl/GLBase.java index a9de70698..07dfc7e72 100644 --- a/src/jogl/classes/javax/media/opengl/GLBase.java +++ b/src/jogl/classes/javax/media/opengl/GLBase.java @@ -167,6 +167,12 @@ public interface GLBase { */ public boolean isGL2ES2(); + /** + * Indicates whether this GL object conforms to a either a GL2GL3 or GL3ES3 compatible profile. + * @see GLContext#isGL2ES3() + */ + public boolean isGL2ES3(); + /** * Indicates whether this GL object conforms to a GL3ES3 compatible profile. * @see GLContext#isGL3ES3() @@ -317,6 +323,12 @@ public interface GLBase { */ public GL2ES2 getGL2ES2() throws GLException; + /** + * Casts this object to the GL2ES3 interface. + * @throws GLException if this object is not a GL2ES3 implementation + */ + public GL2ES3 getGL2ES3() throws GLException; + /** * Casts this object to the GL3ES3 interface. * @throws GLException if this object is not a GL3ES3 implementation diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java index 0c5459b57..f6c03b537 100644 --- a/src/jogl/classes/javax/media/opengl/GLContext.java +++ b/src/jogl/classes/javax/media/opengl/GLContext.java @@ -1113,6 +1113,15 @@ public abstract class GLContext { return isGLES2() || isGL2GL3(); } + /** + * Indicates whether this GLContext is capable of GL2ES3.

Includes [ GL4bc, GL4, GL3bc, GL3, GLES3, GL3ES3, GL2, GL2GL3 ].

+ * @see GLProfile#isGL3ES3() + * @see GLProfile#isGL2GL3() + */ + public final boolean isGL2ES3() { + return isGL3ES3() || isGL2GL3(); + } + /** * Indicates whether this GLContext is capable of GL3ES3.

Includes [ GL4bc, GL4, GL3bc, GL3, GLES3 ].

* @see GLProfile#isGL3ES3() -- cgit v1.2.3