From 3a0d7703da32e9a5ddf08a334f18588a78038d88 Mon Sep 17 00:00:00 2001
From: Sven Gothel
GL_ARB_ES2_compatibility
, otherwise false
+ * the extension GL_ARB_ES2_compatibility
, otherwise false
+ * @see GLContext#isGLES2Compatible()
*/
public boolean isGLES2Compatible();
@@ -182,93 +197,117 @@ public interface GLBase {
* Indicates whether this GL object is compatible with the core OpenGL ES3 functionality.
* @return true if this context is an ES3 context or implements
* the extension GL_ARB_ES3_compatibility
, otherwise false
+ * @see GLContext#isGLES3Compatible()
*/
public boolean isGLES3Compatible();
- /** Indicates whether this GL object supports GLSL. */
+ /**
+ * Indicates whether this GL object supports GLSL.
+ * @see GLContext#hasGLSL()
+ */
public boolean hasGLSL();
+ /**
+ * Returns the downstream GL instance in case this is a wrapping pipeline, otherwise null
.
+ * + * See {@link #getRootGL()} for retrieving the implementing root instance. + *
+ * @throws GLException if the downstream instance is not null and not a GL implementation + * @see #getRootGL() + */ + public GL getDownstreamGL() throws GLException; + + /** + * Returns the implementing root instance, considering a wrapped pipelined hierarchy, see {@link #getDownstreamGL()}. + *+ * If this instance is not a wrapping pipeline, i.e. has no downstream instance, + * this instance is returned. + *
+ * @throws GLException if the root instance is not a GL implementation + */ + public GL getRootGL() throws GLException; + /** * Casts this object to the GL interface. - * @throws GLException if this GLObject is not a GL implementation + * @throws GLException if this object is not a GL implementation */ public GL getGL() throws GLException; /** * Casts this object to the GL4bc interface. - * @throws GLException if this GLObject is not a GL4bc implementation + * @throws GLException if this object is not a GL4bc implementation */ public GL4bc getGL4bc() throws GLException; /** * Casts this object to the GL4 interface. - * @throws GLException if this GLObject is not a GL4 implementation + * @throws GLException if this object is not a GL4 implementation */ public GL4 getGL4() throws GLException; /** * Casts this object to the GL3bc interface. - * @throws GLException if this GLObject is not a GL3bc implementation + * @throws GLException if this object is not a GL3bc implementation */ public GL3bc getGL3bc() throws GLException; /** * Casts this object to the GL3 interface. - * @throws GLException if this GLObject is not a GL3 implementation + * @throws GLException if this object is not a GL3 implementation */ public GL3 getGL3() throws GLException; /** * Casts this object to the GL2 interface. - * @throws GLException if this GLObject is not a GL2 implementation + * @throws GLException if this object is not a GL2 implementation */ public GL2 getGL2() throws GLException; /** * Casts this object to the GLES1 interface. - * @throws GLException if this GLObject is not a GLES1 implementation + * @throws GLException if this object is not a GLES1 implementation */ public GLES1 getGLES1() throws GLException; /** * Casts this object to the GLES2 interface. - * @throws GLException if this GLObject is not a GLES2 implementation + * @throws GLException if this object is not a GLES2 implementation */ public GLES2 getGLES2() throws GLException; /** * Casts this object to the GLES3 interface. - * @throws GLException if this GLObject is not a GLES3 implementation + * @throws GLException if this object is not a GLES3 implementation */ public GLES3 getGLES3() throws GLException; /** * Casts this object to the GL2ES1 interface. - * @throws GLException if this GLObject is not a GL2ES1 implementation + * @throws GLException if this object is not a GL2ES1 implementation */ public GL2ES1 getGL2ES1() throws GLException; /** * Casts this object to the GL2ES2 interface. - * @throws GLException if this GLObject is not a GL2ES2 implementation + * @throws GLException if this object is not a GL2ES2 implementation */ public GL2ES2 getGL2ES2() throws GLException; /** * Casts this object to the GL3ES3 interface. - * @throws GLException if this GLObject is not a GL3ES3 implementation + * @throws GLException if this object is not a GL3ES3 implementation */ public GL3ES3 getGL3ES3() throws GLException; /** * Casts this object to the GL4ES3 interface. - * @throws GLException if this GLObject is not a GL3ES3 implementation + * @throws GLException if this object is not a GL3ES3 implementation */ public GL4ES3 getGL4ES3() throws GLException; /** * Casts this object to the GL2GL3 interface. - * @throws GLException if this GLObject is not a GL2GL3 implementation + * @throws GLException if this object is not a GL2GL3 implementation */ public GL2GL3 getGL2GL3() throws GLException; diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java index b27db18af..9d383c371 100644 --- a/src/jogl/classes/javax/media/opengl/GLContext.java +++ b/src/jogl/classes/javax/media/opengl/GLContext.java @@ -503,6 +503,17 @@ public abstract class GLContext { */ public abstract void destroy(); + /** + * Returns the implementing root GL instance of this GLContext's GL object, + * considering a wrapped pipelined hierarchy, see {@link GLBase#getDownstreamGL()}. + * @throws GLException if the root instance is not a GL implementation + * @see GLBase#getRootGL() + * @see GLBase#getDownstreamGL() + * @see #getGL() + * @see #setGL(GL) + */ + public abstract GL getRootGL(); + /** * Returns the GL pipeline object for this GLContext. * @@ -915,40 +926,83 @@ public abstract class GLContext { isExtensionAvailable(GLExtensions.IMG_texture_format_BGRA8888) ; } - /** @see GLProfile#isGL4bc() */ + /** + * Indicates whether this GLContext is capable of GL4bc.Includes [ GL4bc ].
+ * @see GLProfile#isGL4bc() + */ public final boolean isGL4bc() { return ctxVersion.getMajor() >= 4 && 0 != (ctxOptions & CTX_IS_ARB_CREATED) && 0 != (ctxOptions & CTX_PROFILE_COMPAT); } - /** @see GLProfile#isGL4() */ + /** + * Indicates whether this GLContext is capable of GL4.Includes [ GL4bc, GL4 ].
+ * @see GLProfile#isGL4() + */ public final boolean isGL4() { return ctxVersion.getMajor() >= 4 && 0 != (ctxOptions & CTX_IS_ARB_CREATED) && 0 != (ctxOptions & (CTX_PROFILE_COMPAT|CTX_PROFILE_CORE)); } - /** Indicates whether this profile is capable of GL4 (core only).Includes [ GL4 ].
*/ + /** + * Indicates whether this GLContext is capable of GL4 (core only).Includes [ GL4 ].
+ */ public final boolean isGL4core() { return ctxVersion.getMajor() >= 4 && 0 != (ctxOptions & CTX_IS_ARB_CREATED) && 0 != (ctxOptions & CTX_PROFILE_CORE); } - /** @see GLProfile#isGL3bc() */ + /** + * Indicates whether this GLContext is capable of GL3bc.Includes [ GL4bc, GL3bc ].
+ * @see GLProfile#isGL3bc() + */ public final boolean isGL3bc() { return 0 != (ctxOptions & CTX_IS_ARB_CREATED) && 0 != (ctxOptions & CTX_PROFILE_COMPAT) && ctxVersion.compareTo(Version310) >= 0 ; } - /** @see GLProfile#isGL3() */ + /** + * Indicates whether this GLContext is capable of GL3.Includes [ GL4bc, GL4, GL3bc, GL3 ].
+ * @see GLProfile#isGL3() + */ public final boolean isGL3() { return 0 != (ctxOptions & CTX_IS_ARB_CREATED) && 0 != (ctxOptions & (CTX_PROFILE_COMPAT|CTX_PROFILE_CORE)) && ctxVersion.compareTo(Version310) >= 0 ; } - /** Indicates whether this profile is capable of GL3 (core only). GL3 starts w/ OpenGL 3.1Includes [ GL4, GL3, GLES3 ].
*/ + /** + * Indicates whether this GLContext is capable of GL3 (core only). GL3 starts w/ OpenGL 3.1Includes [ GL4, GL3 ].
+ */ public final boolean isGL3core() { + return 0 != ( ctxOptions & CTX_IS_ARB_CREATED ) && + 0 != ( ctxOptions & CTX_PROFILE_CORE ) && + ctxVersion.compareTo(Version310) >= 0; + } + + /** + * Indicates whether this GLContext's native profile does not implement a default vertex array object (VAO), + * starting w/ OpenGL 3.1 core and GLES3. + *Includes [ GL4, GL3, GLES3 ].
+ *+ Due to GL 3.1 core spec: E.1. DEPRECATED AND REMOVED FEATURES (p 296), + GL 3.2 core spec: E.2. DEPRECATED AND REMOVED FEATURES (p 331) + there is no more default VAO buffer 0 bound, hence generating and binding one + to avoid INVALID_OPERATION at VertexAttribPointer. + More clear is GL 4.3 core spec: 10.4 (p 307). + *+ *
+ GLES3 is included, since upcoming ES releases > 3.0 may behave the same: + GL ES 3.0 spec F.1. Legacy Features (p 322). + *+ *
+ * If no default VAO is implemented in the native OpenGL profile, + * an own default VAO is being used, see {@link #getDefaultVAO()}. + *
+ * @see #getDefaultVAO() + */ + public final boolean hasNoDefaultVAO() { return ( 0 != ( ctxOptions & CTX_PROFILE_ES ) && ctxVersion.getMajor() >= 3 ) || ( 0 != ( ctxOptions & CTX_IS_ARB_CREATED ) && 0 != ( ctxOptions & CTX_PROFILE_CORE ) && @@ -956,52 +1010,87 @@ public abstract class GLContext { ) ; } - /** @see GLProfile#isGL2() */ + /** + * If this GLContext does not implement a default VAO, see {@link #hasNoDefaultVAO()}, + * an own default VAO will be created and bound at context creation. + *
+ * If this GLContext does implement a default VAO, i.e. {@link #hasNoDefaultVAO()}
+ * returns false
, this method returns 0
.
+ *
+ * Otherwise this method returns the VAO object name + * representing this GLContext's own default VAO. + *
+ * @see #hasNoDefaultVAO() + */ + public abstract int getDefaultVAO(); + + /** + * @see GLProfile#isGL2() + */ public final boolean isGL2() { return 0 != ( ctxOptions & CTX_PROFILE_COMPAT ) && ctxVersion.getMajor()>=1 ; } - /** @see GLProfile#isGL2GL3() */ + /** + * @see GLProfile#isGL2GL3() + */ public final boolean isGL2GL3() { return isGL2() || isGL3(); } - /** @see GLProfile#isGLES1() */ + /** + * @see GLProfile#isGLES1() + */ public final boolean isGLES1() { return 0 != ( ctxOptions & CTX_PROFILE_ES ) && ctxVersion.getMajor() == 1 ; } - /** @see GLProfile#isGLES2() */ + /** + * @see GLProfile#isGLES2() + */ public final boolean isGLES2() { return 0 != ( ctxOptions & CTX_PROFILE_ES ) && ctxVersion.getMajor() >= 2 ; } - /** @see GLProfile#isGLES3() */ + /** + * @see GLProfile#isGLES3() + */ public final boolean isGLES3() { return 0 != ( ctxOptions & CTX_PROFILE_ES ) && ctxVersion.getMajor() >= 3 ; } - /** @see GLProfile#isGLES() */ + /** + * @see GLProfile#isGLES() + */ public final boolean isGLES() { return 0 != ( CTX_PROFILE_ES & ctxOptions ) ; } - /** @see GLProfile#isGL2ES1() */ + /** + * @see GLProfile#isGL2ES1() + */ public final boolean isGL2ES1() { return isGLES1() || isGL2(); } - /** @see GLProfile#isGL2ES2() */ + /** + * @see GLProfile#isGL2ES2() + */ public final boolean isGL2ES2() { return isGLES2() || isGL2GL3(); } - /** @see GLProfile#isGL3ES3() */ + /** + * @see GLProfile#isGL3ES3() + */ public final boolean isGL3ES3() { return isGL4ES3() || isGL3(); } - /** @see GLProfile#isGL4ES3() */ + /** + * @see GLProfile#isGL4ES3() + */ public final boolean isGL4ES3() { return isGL4() || isGLES3() ; } diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java index 18e136815..5da60597e 100644 --- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java @@ -67,8 +67,8 @@ import javax.media.nativewindow.NativeSurface; import javax.media.nativewindow.NativeWindowFactory; import javax.media.opengl.GL; import javax.media.opengl.GL2ES2; -import javax.media.opengl.GL2ES3; import javax.media.opengl.GL2GL3; +import javax.media.opengl.GL3ES3; import javax.media.opengl.GLCapabilitiesImmutable; import javax.media.opengl.GLContext; import javax.media.opengl.GLDebugListener; @@ -262,6 +262,17 @@ public abstract class GLContextImpl extends GLContext { return (GLDrawableImpl) getGLDrawable(); } + @Override + public final GL getRootGL() { + GL _gl = gl; + GL _parent = _gl.getDownstreamGL(); + while ( null != _parent ) { + _gl = _parent; + _parent = _gl.getDownstreamGL(); + } + return _gl; + } + @Override public final GL getGL() { return gl; @@ -279,6 +290,11 @@ public abstract class GLContextImpl extends GLContext { return gl; } + @Override + public final int getDefaultVAO() { + return defaultVAO; + } + /** * Call this method to notify the OpenGL context * that the drawable has changed (size or position). @@ -399,7 +415,7 @@ public abstract class GLContextImpl extends GLContext { } if ( 0 != defaultVAO ) { final int[] tmp = new int[] { defaultVAO }; - final GL2ES3 gl3es3 = gl.getGL3ES3(); + final GL3ES3 gl3es3 = gl.getRootGL().getGL3ES3(); gl3es3.glBindVertexArray(0); gl3es3.glDeleteVertexArrays(1, tmp, 0); defaultVAO = 0; @@ -636,14 +652,9 @@ public abstract class GLContextImpl extends GLContext { final boolean created; try { created = createImpl(shareWith); // may throws exception if fails! - if( created && isGL3core() ) { - // Due to GL 3.1 core spec: E.1. DEPRECATED AND REMOVED FEATURES (p 296), - // GL 3.2 core spec: E.2. DEPRECATED AND REMOVED FEATURES (p 331) - // there is no more default VAO buffer 0 bound, hence generating and binding one - // to avoid INVALID_OPERATION at VertexAttribPointer. - // More clear is GL 4.3 core spec: 10.4 (p 307). + if( created && hasNoDefaultVAO() ) { final int[] tmp = new int[1]; - final GL2ES3 gl3es3 = gl.getGL3ES3(); + final GL3ES3 gl3es3 = gl.getRootGL().getGL3ES3(); gl3es3.glGenVertexArrays(1, tmp, 0); defaultVAO = tmp[0]; gl3es3.glBindVertexArray(defaultVAO); @@ -1955,10 +1966,6 @@ public abstract class GLContextImpl extends GLContext { return glStateTracker; } - public final boolean isDefaultVAO(int vao) { - return defaultVAO == vao; - } - //--------------------------------------------------------------------------- // Helpers for context optimization where the last context is left // current on the OpenGL worker thread -- cgit v1.2.3 From 0002fccdcd6383874b2813dc6bbe3e33f5f00924 Mon Sep 17 00:00:00 2001 From: Sven GothelDefault: true
. */ + public static final int GEN_DEBUG = 1 << 0; + /**Default: true
. */ + public static final int GEN_TRACE = 1 << 1; + /**Default: false
. */ public static final int GEN_CUSTOM = 1 << 2; + /** + * By extra command-line argument:prolog_xor_downstream
.
+ * + * If true, either prolog (if exist) is called or downstream's method, but not both. + * By default, both methods would be called. + *
+ *Default: false
+ */ public static final int GEN_PROLOG_XOR_DOWNSTREAM = 1 << 3; + /** + * By extra command-line argument:gl_identity_by_assignable_class
.
+ *
+ * If true, implementation does not utilize downstream's isGL*()
+ * implementation, but determines whether the GL profile is matched by interface inheritance.
+ *
Default: false
+ */ + public static final int GEN_GL_IDENTITY_BY_ASSIGNABLE_CLASS = 1 << 4; + int mode; private String outputDir; private String outputPackage; @@ -110,8 +131,12 @@ public class BuildComposablePipeline { classDownstream = getClass(args[4]); mode = GEN_CUSTOM; if (args.length > 5) { - if (args[5].equals("prolog_xor_downstream")) { - mode |= GEN_PROLOG_XOR_DOWNSTREAM; + for(int i=5; iComposable pipeline which wraps an underlying {@link GL} implementation,"); - output.println(" providing error checking after each OpenGL method call. If an error occurs,"); - output.println(" causes a {@link GLException} to be thrown at exactly the point of failure."); - output.println(" Sample code which installs this pipeline:
"); - output.println(); - output.println(""); - output.println(" GL gl = drawable.setGL(new DebugGL(drawable.getGL()));"); - output.println(""); - output.println("*/"); + output.println("/**"); + output.println(" *
"); + output.println(" * Composable pipeline which wraps an underlying {@link GL} implementation,"); + output.println(" * providing error checking after each OpenGL method call. If an error occurs,"); + output.println(" * causes a {@link GLException} to be thrown at exactly the point of failure."); + output.println(" *
"); + output.println(" *"); + output.println(" * Sample code which installs this pipeline:"); + output.println(" *
"); + output.println(" * gl = drawable.setGL(new DebugGL(drawable.getGL()));"); + output.println(" *"); + output.println(" * For automatic instantiation see {@link GLPipelineFactory#create(String, Class, GL, Object[])}"); + output.println(" * "); + output.println(" */"); } protected boolean hasPreDownstreamCallHook(Method m) { @@ -1057,14 +1099,20 @@ public class BuildComposablePipeline { } protected void emitClassDocComment(PrintWriter output) { - output.println("/**
Composable pipeline which wraps an underlying {@link GL} implementation,"); - output.println(" providing tracing information to a user-specified {@link java.io.PrintStream}"); - output.println(" before and after each OpenGL method call. Sample code which installs this pipeline:
"); - output.println(); - output.println(""); - output.println(" GL gl = drawable.setGL(new TraceGL(drawable.getGL(), System.err));"); - output.println(""); - output.println("*/"); + output.println("/**"); + output.println(" *
"); + output.println(" * Composable pipeline which wraps an underlying {@link GL} implementation,"); + output.println(" * providing tracing information to a user-specified {@link java.io.PrintStream}"); + output.println(" * before and after each OpenGL method call."); + output.println(" *
"); + output.println(" *"); + output.println(" * Sample code which installs this pipeline:"); + output.println(" *
"); + output.println(" * gl = drawable.setGL(new TraceGL(drawable.getGL(), System.err));"); + output.println(" *"); + output.println(" * For automatic instantiation see {@link GLPipelineFactory#create(String, Class, GL, Object[])}"); + output.println(" * "); + output.println(" */"); } protected boolean hasPreDownstreamCallHook(Method m) { diff --git a/src/jogl/classes/javax/media/opengl/DebugGL2.java b/src/jogl/classes/javax/media/opengl/DebugGL2.java new file mode 100644 index 000000000..05bcf3d5e --- /dev/null +++ b/src/jogl/classes/javax/media/opengl/DebugGL2.java @@ -0,0 +1,21 @@ +package javax.media.opengl; + +/** + *
+ * Composable pipeline which wraps an underlying {@link GL} implementation, + * providing error checking after each OpenGL method call. If an error occurs, + * causes a {@link GLException} to be thrown at exactly the point of failure. + *
+ *+ * Sample code which installs this pipeline, manual: + *
+ * gl = drawable.setGL(new DebugGL(drawable.getGL())); + *+ * For automatic instantiation see {@link GLPipelineFactory#create(String, Class, GL, Object[])}. + * + */ +public class DebugGL2 extends DebugGL4bc { + public DebugGL2(GL2 downstream) { + super((GL4bc)downstream); + } +} diff --git a/src/jogl/classes/javax/media/opengl/DebugGL3.java b/src/jogl/classes/javax/media/opengl/DebugGL3.java new file mode 100644 index 000000000..c17f90667 --- /dev/null +++ b/src/jogl/classes/javax/media/opengl/DebugGL3.java @@ -0,0 +1,21 @@ +package javax.media.opengl; + +/** + *
+ * Composable pipeline which wraps an underlying {@link GL} implementation, + * providing error checking after each OpenGL method call. If an error occurs, + * causes a {@link GLException} to be thrown at exactly the point of failure. + *
+ *+ * Sample code which installs this pipeline, manual: + *
+ * gl = drawable.setGL(new DebugGL(drawable.getGL())); + *+ * For automatic instantiation see {@link GLPipelineFactory#create(String, Class, GL, Object[])}. + * + */ +public class DebugGL3 extends DebugGL4bc { + public DebugGL3(GL3 downstream) { + super((GL4bc)downstream); + } +} diff --git a/src/jogl/classes/javax/media/opengl/DebugGL3bc.java b/src/jogl/classes/javax/media/opengl/DebugGL3bc.java new file mode 100644 index 000000000..6e294d42b --- /dev/null +++ b/src/jogl/classes/javax/media/opengl/DebugGL3bc.java @@ -0,0 +1,21 @@ +package javax.media.opengl; + +/** + *
+ * Composable pipeline which wraps an underlying {@link GL} implementation, + * providing error checking after each OpenGL method call. If an error occurs, + * causes a {@link GLException} to be thrown at exactly the point of failure. + *
+ *+ * Sample code which installs this pipeline, manual: + *
+ * gl = drawable.setGL(new DebugGL(drawable.getGL())); + *+ * For automatic instantiation see {@link GLPipelineFactory#create(String, Class, GL, Object[])}. + * + */ +public class DebugGL3bc extends DebugGL4bc { + public DebugGL3bc(GL3bc downstream) { + super((GL4bc)downstream); + } +} diff --git a/src/jogl/classes/javax/media/opengl/DebugGL4.java b/src/jogl/classes/javax/media/opengl/DebugGL4.java new file mode 100644 index 000000000..d21d39390 --- /dev/null +++ b/src/jogl/classes/javax/media/opengl/DebugGL4.java @@ -0,0 +1,21 @@ +package javax.media.opengl; + +/** + *
+ * Composable pipeline which wraps an underlying {@link GL} implementation, + * providing error checking after each OpenGL method call. If an error occurs, + * causes a {@link GLException} to be thrown at exactly the point of failure. + *
+ *+ * Sample code which installs this pipeline, manual: + *
+ * gl = drawable.setGL(new DebugGL(drawable.getGL())); + *+ * For automatic instantiation see {@link GLPipelineFactory#create(String, Class, GL, Object[])}. + * + */ +public class DebugGL4 extends DebugGL4bc { + public DebugGL4(GL4 downstream) { + super((GL4bc)downstream); + } +} diff --git a/src/jogl/classes/javax/media/opengl/DebugGLES2.java b/src/jogl/classes/javax/media/opengl/DebugGLES2.java new file mode 100644 index 000000000..dee363c1b --- /dev/null +++ b/src/jogl/classes/javax/media/opengl/DebugGLES2.java @@ -0,0 +1,21 @@ +package javax.media.opengl; + +/** + *
+ * Composable pipeline which wraps an underlying {@link GL} implementation, + * providing error checking after each OpenGL method call. If an error occurs, + * causes a {@link GLException} to be thrown at exactly the point of failure. + *
+ *+ * Sample code which installs this pipeline, manual: + *
+ * gl = drawable.setGL(new DebugGL(drawable.getGL())); + *+ * For automatic instantiation see {@link GLPipelineFactory#create(String, Class, GL, Object[])}. + * + */ +public class DebugGLES2 extends DebugGLES3 { + public DebugGLES2(GLES2 downstream) { + super((GLES3)downstream); + } +} diff --git a/src/jogl/classes/javax/media/opengl/GLPipelineFactory.java b/src/jogl/classes/javax/media/opengl/GLPipelineFactory.java index 2bfc77d4a..c6bf26235 100644 --- a/src/jogl/classes/javax/media/opengl/GLPipelineFactory.java +++ b/src/jogl/classes/javax/media/opengl/GLPipelineFactory.java @@ -51,8 +51,23 @@ public class GLPipelineFactory { /** * Creates a pipelined GL instance using the given downstream
downstream
- * and optional arguments additionalArgs
for the constructor.additionalArgs
for the constructor.
*
+ * + * Sample code which installs a Debug and Trace pipeline + * automatic w/ user defined interface, here: GL2ES2: + *
+ * gl = drawable.setGL( GLPipelineFactory.create("javax.media.opengl.Debug", GL2ES2.class, gl, null) ); + * gl = drawable.setGL( GLPipelineFactory.create("javax.media.opengl.Trace", GL2ES2.class, gl, new Object[] { System.err } ) ); + *+ * or automatic w/ automatic defined class: + *
+ * gl = drawable.setGL( GLPipelineFactory.create("javax.media.opengl.Debug", null, gl, null) ); + * gl = drawable.setGL( GLPipelineFactory.create("javax.media.opengl.Trace", null, gl, new Object[] { System.err } ) ); + *+ * + * + *
* The upstream GL instance is determined as follows: *
pipelineClazzBaseName
as the class name's full basename, incl. package name+ * Composable pipeline which wraps an underlying {@link GL} implementation, + * providing tracing information to a user-specified {@link java.io.PrintStream} + * before and after each OpenGL method call. + *
+ *+ * Sample code which installs this pipeline, manual: + *
+ * gl = drawable.setGL(new TraceGL(drawable.getGL(), System.err)); + *+ * For automatic instantiation see {@link GLPipelineFactory#create(String, Class, GL, Object[])}. + * + */ +public class TraceGL2 extends TraceGL4bc { + public TraceGL2(GL2 downstream, PrintStream stream) { + super((GL4bc)downstream, stream); + } +} diff --git a/src/jogl/classes/javax/media/opengl/TraceGL3.java b/src/jogl/classes/javax/media/opengl/TraceGL3.java new file mode 100644 index 000000000..616b31f61 --- /dev/null +++ b/src/jogl/classes/javax/media/opengl/TraceGL3.java @@ -0,0 +1,23 @@ +package javax.media.opengl; + +import java.io.PrintStream; + +/** + *
+ * Composable pipeline which wraps an underlying {@link GL} implementation, + * providing tracing information to a user-specified {@link java.io.PrintStream} + * before and after each OpenGL method call. + *
+ *+ * Sample code which installs this pipeline, manual: + *
+ * gl = drawable.setGL(new TraceGL(drawable.getGL(), System.err)); + *+ * For automatic instantiation see {@link GLPipelineFactory#create(String, Class, GL, Object[])}. + * + */ +public class TraceGL3 extends TraceGL4bc { + public TraceGL3(GL3 downstream, PrintStream stream) { + super((GL4bc)downstream, stream); + } +} diff --git a/src/jogl/classes/javax/media/opengl/TraceGL3bc.java b/src/jogl/classes/javax/media/opengl/TraceGL3bc.java new file mode 100644 index 000000000..f3761d4d6 --- /dev/null +++ b/src/jogl/classes/javax/media/opengl/TraceGL3bc.java @@ -0,0 +1,23 @@ +package javax.media.opengl; + +import java.io.PrintStream; + +/** + *
+ * Composable pipeline which wraps an underlying {@link GL} implementation, + * providing tracing information to a user-specified {@link java.io.PrintStream} + * before and after each OpenGL method call. + *
+ *+ * Sample code which installs this pipeline, manual: + *
+ * gl = drawable.setGL(new TraceGL(drawable.getGL(), System.err)); + *+ * For automatic instantiation see {@link GLPipelineFactory#create(String, Class, GL, Object[])}. + * + */ +public class TraceGL3bc extends TraceGL4bc { + public TraceGL3bc(GL3bc downstream, PrintStream stream) { + super((GL4bc)downstream, stream); + } +} diff --git a/src/jogl/classes/javax/media/opengl/TraceGL4.java b/src/jogl/classes/javax/media/opengl/TraceGL4.java new file mode 100644 index 000000000..a12bf0f47 --- /dev/null +++ b/src/jogl/classes/javax/media/opengl/TraceGL4.java @@ -0,0 +1,23 @@ +package javax.media.opengl; + +import java.io.PrintStream; + +/** + *
+ * Composable pipeline which wraps an underlying {@link GL} implementation, + * providing tracing information to a user-specified {@link java.io.PrintStream} + * before and after each OpenGL method call. + *
+ *+ * Sample code which installs this pipeline, manual: + *
+ * gl = drawable.setGL(new TraceGL(drawable.getGL(), System.err)); + *+ * For automatic instantiation see {@link GLPipelineFactory#create(String, Class, GL, Object[])}. + * + */ +public class TraceGL4 extends TraceGL4bc { + public TraceGL4(GL4 downstream, PrintStream stream) { + super((GL4bc)downstream, stream); + } +} diff --git a/src/jogl/classes/javax/media/opengl/TraceGLES2.java b/src/jogl/classes/javax/media/opengl/TraceGLES2.java new file mode 100644 index 000000000..38d60e3ac --- /dev/null +++ b/src/jogl/classes/javax/media/opengl/TraceGLES2.java @@ -0,0 +1,23 @@ +package javax.media.opengl; + +import java.io.PrintStream; + +/** + *
+ * Composable pipeline which wraps an underlying {@link GL} implementation, + * providing tracing information to a user-specified {@link java.io.PrintStream} + * before and after each OpenGL method call. + *
+ *+ * Sample code which installs this pipeline, manual: + *
+ * gl = drawable.setGL(new TraceGL(drawable.getGL(), System.err)); + *+ * For automatic instantiation see {@link GLPipelineFactory#create(String, Class, GL, Object[])}. + * + */ +public class TraceGLES2 extends TraceGLES3 { + public TraceGLES2(GLES2 downstream, PrintStream stream) { + super((GLES3)downstream, stream); + } +} -- cgit v1.2.3 From 5dafc958385da595160dc0d3c843c8253334c3c5 Mon Sep 17 00:00:00 2001 From: Sven Gothel
Includes [ GL4 ].
+ * @see GLContext#isGL4core() + */ + public boolean isGL4core(); + + /** + * Indicates whether this GL object uses a GL3 core profile.Includes [ GL4, GL3 ].
+ * @see GLContext#isGL3core() + */ + public boolean isGL3core(); + + /** + * Indicates whether this GL object uses a GL core profile.Includes [ GL4, GL3, GLES3, GL2ES2 ].
+ * @see GLContext#isGLcore() + */ + public boolean isGLcore(); + /** * Indicates whether this GL object is compatible with the core OpenGL ES2 functionality. * @return true if this context is an ES2 context or implements diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java index d94531221..c3e82e6ee 100644 --- a/src/jogl/classes/javax/media/opengl/GLContext.java +++ b/src/jogl/classes/javax/media/opengl/GLContext.java @@ -934,8 +934,9 @@ public abstract class GLContext { * @see GLProfile#isGL4bc() */ public final boolean isGL4bc() { - return ctxVersion.getMajor() >= 4 && 0 != (ctxOptions & CTX_IS_ARB_CREATED) - && 0 != (ctxOptions & CTX_PROFILE_COMPAT); + return 0 != (ctxOptions & CTX_IS_ARB_CREATED) && + 0 != (ctxOptions & CTX_PROFILE_COMPAT) && + ctxVersion.getMajor() >= 4; } /** @@ -943,16 +944,18 @@ public abstract class GLContext { * @see GLProfile#isGL4() */ public final boolean isGL4() { - return ctxVersion.getMajor() >= 4 && 0 != (ctxOptions & CTX_IS_ARB_CREATED) - && 0 != (ctxOptions & (CTX_PROFILE_COMPAT|CTX_PROFILE_CORE)); + return 0 != (ctxOptions & CTX_IS_ARB_CREATED) && + 0 != (ctxOptions & (CTX_PROFILE_COMPAT|CTX_PROFILE_CORE)) && + ctxVersion.getMajor() >= 4; } /** - * Indicates whether this GLContext is capable of GL4 (core only).Includes [ GL4 ].
+ * Indicates whether this GLContext uses a GL4 core profile.Includes [ GL4 ].
*/ public final boolean isGL4core() { - return ctxVersion.getMajor() >= 4 && 0 != (ctxOptions & CTX_IS_ARB_CREATED) - && 0 != (ctxOptions & CTX_PROFILE_CORE); + return 0 != ( ctxOptions & CTX_IS_ARB_CREATED ) && + 0 != ( ctxOptions & CTX_PROFILE_CORE ) && + ctxVersion.getMajor() >= 4; } /** @@ -973,10 +976,10 @@ public abstract class GLContext { return 0 != (ctxOptions & CTX_IS_ARB_CREATED) && 0 != (ctxOptions & (CTX_PROFILE_COMPAT|CTX_PROFILE_CORE)) && ctxVersion.compareTo(Version310) >= 0 ; - } + } /** - * Indicates whether this GLContext is capable of GL3 (core only). GL3 starts w/ OpenGL 3.1Includes [ GL4, GL3 ].
+ * Indicates whether this GLContext uses a GL3 core profile.Includes [ GL4, GL3 ].
*/ public final boolean isGL3core() { return 0 != ( ctxOptions & CTX_IS_ARB_CREATED ) && @@ -984,6 +987,17 @@ public abstract class GLContext { ctxVersion.compareTo(Version310) >= 0; } + /** + * Indicates whether this GLContext uses a GL core profile.Includes [ GL4, GL3, GLES3, GL2ES2 ].
+ */ + public final boolean isGLcore() { + return ( 0 != ( ctxOptions & CTX_PROFILE_ES ) && ctxVersion.getMajor() >= 2 ) || + ( 0 != ( ctxOptions & CTX_IS_ARB_CREATED ) && + 0 != ( ctxOptions & CTX_PROFILE_CORE ) && + ctxVersion.compareTo(Version310) >= 0 + ) ; + } + /** * Indicates whether this GLContext's native profile does not implement a default vertex array object (VAO), * starting w/ OpenGL 3.1 core and GLES3. @@ -1029,6 +1043,7 @@ public abstract class GLContext { public abstract int getDefaultVAO(); /** + * Indicates whether this GLContext is capable of GL2.Includes [ GL4bc, GL3bc, GL2 ].
* @see GLProfile#isGL2() */ public final boolean isGL2() { @@ -1036,6 +1051,7 @@ public abstract class GLContext { } /** + * Indicates whether this GLContext is capable of GL2GL3.Includes [ GL4bc, GL4, GL3bc, GL3, GL2, GL2GL3 ].
* @see GLProfile#isGL2GL3() */ public final boolean isGL2GL3() { @@ -1043,13 +1059,15 @@ public abstract class GLContext { } /** + * Indicates whether this GLContext is capable of GLES1.Includes [ GLES1 ].
* @see GLProfile#isGLES1() */ public final boolean isGLES1() { return 0 != ( ctxOptions & CTX_PROFILE_ES ) && ctxVersion.getMajor() == 1 ; } - /** + /** + * Indicates whether this GLContext is capable of GLES2.Includes [ GLES3, GLES2 ].
* @see GLProfile#isGLES2() */ public final boolean isGLES2() { @@ -1057,6 +1075,7 @@ public abstract class GLContext { } /** + * Indicates whether this GLContext is capable of GLES3.Includes [ GLES3 ].
* @see GLProfile#isGLES3() */ public final boolean isGLES3() { @@ -1064,6 +1083,7 @@ public abstract class GLContext { } /** + * Indicates whether this GLContext is capable of GLES.Includes [ GLES3, GLES1, GLES2 ].
* @see GLProfile#isGLES() */ public final boolean isGLES() { @@ -1071,6 +1091,7 @@ public abstract class GLContext { } /** + * Indicates whether this GLContext is capable of GL2ES1.Includes [ GL4bc, GL3bc, GL2, GLES1, GL2ES1 ].
* @see GLProfile#isGL2ES1() */ public final boolean isGL2ES1() { @@ -1078,6 +1099,7 @@ public abstract class GLContext { } /** + * Indicates whether this GLContext is capable of GL2ES2.Includes [ GL4bc, GL4, GL3bc, GL3, GLES3, GL2, GL2GL3, GL2ES2, GLES2 ].
* @see GLProfile#isGL2ES2() */ public final boolean isGL2ES2() { @@ -1085,6 +1107,7 @@ public abstract class GLContext { } /** + * Indicates whether this GLContext is capable of GL3ES3.Includes [ GL4bc, GL4, GL3bc, GL3, GLES3 ].
* @see GLProfile#isGL3ES3() */ public final boolean isGL3ES3() { @@ -1092,6 +1115,7 @@ public abstract class GLContext { } /** + * Indicates whether this profile is capable of GL4ES3.Includes [ GL4bc, GL4, GLES3 ].
* @see GLProfile#isGL4ES3() */ public final boolean isGL4ES3() { -- cgit v1.2.3