From bb028021be2714e66d9b1062298a3e308c649c56 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 16 Apr 2010 03:51:00 +0200 Subject: JOGL GL4 preperation: - Re-Enable GL3bc native library build, works .. - Adding all the is/get GL4/GL4bc stubs .. - Adding dummy interface GL4 and GL4bc, will be removed when done - Context creation refactoring: - Move Version information to GLContext - Determine version by creation if possible (ARB_create_context), only use the unreliable GL_VERSION string if necessary. - Offering an almost platform independent ARB_create_context path: - createContextARBImpl - platform dependent GLX calls - createContextARB - platform independent setup and version loop --- src/jogl/classes/javax/media/opengl/GLContext.java | 68 +++++++++++++++++++++- 1 file changed, 67 insertions(+), 1 deletion(-) (limited to 'src/jogl/classes/javax/media/opengl/GLContext.java') diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java index 1e52c2a65..a8dbf9213 100644 --- a/src/jogl/classes/javax/media/opengl/GLContext.java +++ b/src/jogl/classes/javax/media/opengl/GLContext.java @@ -260,7 +260,9 @@ public abstract class GLContext { public final String toString() { StringBuffer sb = new StringBuffer(); sb.append(getClass().getName()); - sb.append(" ["); + sb.append(" [OpenGL "); + sb.append(getGLVersion()); + sb.append(", "); sb.append(getGL()); if(getGLDrawable()!=getGLDrawableRead()) { sb.append(",\n\tDrawable Read : "); @@ -280,4 +282,68 @@ public abstract class GLContext { GLX) extensions. Can only be called while this context is current. */ public abstract String getPlatformExtensionsString(); + + public final int getGLVersionMajor() { return ctxMajorVersion; } + public final int getGLVersionMinor() { return ctxMajorVersion; } + public final boolean isGLCompatibilityProfile() { return ( 0 != ( CTX_PROFILE_COMPAT & ctxOptions ) ); } + public final boolean isGLForwardCompatible() { return ( 0 != ( CTX_OPTION_FORWARD & ctxOptions ) ); } + + /** + * Returns a valid OpenGL version string, ie + * major.minor ([option]?[options,]*) - gl-version + * + * + * + * e.g.: + * + * + * + * + * + * + *
row 2, cell 1row 2, cell 2
+ * + * + * + * + * + * + * + * + * + *
ES2 2.0 (ES, any, new) - 2.0 ES Profile
ATIGL2 3.0 (compatibility profile, any, new) - 3.2.9704 Compatibility Profile Context
ATIGL3 3.3 (core profile, any, new) - 1.4 (3.2.9704 Compatibility Profile Context)
ATIGL3bc3.3 (compatibility profile, any, new) - 1.4 (3.2.9704 Compatibility Profile Context)
NVGL2 3.0 (compatibility profile, any, new) - 3.0.0 NVIDIA 195.36.07.03
NVGL3 3.3 (core profile, any, new) - 3.3.0 NVIDIA 195.36.07.03
NVGL3bc 3.3 (compatibility profile, any, new) - 3.3.0 NVIDIA 195.36.07.03
+ */ + public final String getGLVersion() { + return ctxVersionString; + } + + protected int ctxMajorVersion=-1; + protected int ctxMinorVersion=-1; + protected int ctxOptions=0; + protected String ctxVersionString=null; + + /** ARB_create_context related: created via ARB_create_context */ + protected static final int CTX_IS_ARB_CREATED = 1 << 0; + /** ARB_create_context related: compatibility profile */ + protected static final int CTX_PROFILE_COMPAT = 1 << 1; + /** ARB_create_context related: core profile */ + protected static final int CTX_PROFILE_CORE = 1 << 2; + /** ARB_create_context related: flag forward compatible */ + protected static final int CTX_OPTION_FORWARD = 1 << 3; + /** ARB_create_context related: not flag forward compatible */ + protected static final int CTX_OPTION_ANY = 1 << 4; + /** ARB_create_context related: flag debug */ + protected static final int CTX_OPTION_DEBUG = 1 << 5; } -- cgit v1.2.3