diff options
author | Sven Gothel <[email protected]> | 2010-06-02 04:04:19 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2010-06-02 04:04:19 +0200 |
commit | dd0400a41478c1f365414b8c760eee1c91105280 (patch) | |
tree | f485f7216126b5e7e3931462b2e1ce7adb47458f /src/jogl/classes/javax/media/opengl/GLContext.java | |
parent | 3d53317d3a0748cb3fd1a71f88f6cd4f5de9d4cb (diff) |
JOGL: Unified GLContext native handle
- All GLContext implementations are using the contextHandle of the super class.
- GLContext.getHandle() exposes contextHandle for API cross access
Diffstat (limited to 'src/jogl/classes/javax/media/opengl/GLContext.java')
-rw-r--r-- | src/jogl/classes/javax/media/opengl/GLContext.java | 47 |
1 files changed, 31 insertions, 16 deletions
diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java index 37172e370..efc914de9 100644 --- a/src/jogl/classes/javax/media/opengl/GLContext.java +++ b/src/jogl/classes/javax/media/opengl/GLContext.java @@ -67,7 +67,8 @@ public abstract class GLContext { private HashMap/*<int, Object>*/ attachedObjects = new HashMap(); - protected long context; + /** The underlying native OpenGL context */ + protected long contextHandle; /** * Returns the GLDrawable to which this context may be used to @@ -233,16 +234,28 @@ public abstract class GLContext { public abstract GL setGL(GL gl); /** + * Returns the native GL context handle + */ + public final long getHandle() { return contextHandle; } + + /** + * Indicates whether the underlying OpenGL context has been created. + */ + public final boolean isCreated() { + return 0 != contextHandle; + } + + /** * Returns the attached user object for the given name to this GLContext. */ - public Object getAttachedObject(int name) { + public final Object getAttachedObject(int name) { return attachedObjects.get(new Integer(name)); } /** * Returns the attached user object for the given name to this GLContext. */ - public Object getAttachedObject(String name) { + public final Object getAttachedObject(String name) { return attachedObjects.get(name); } @@ -250,7 +263,7 @@ public abstract class GLContext { * Sets the attached user object for the given name to this GLContext. * Returns the previously set object or null. */ - public Object putAttachedObject(int name, Object obj) { + public final Object putAttachedObject(int name, Object obj) { return attachedObjects.put(new Integer(name), obj); } @@ -258,7 +271,7 @@ public abstract class GLContext { * Sets the attached user object for the given name to this GLContext. * Returns the previously set object or null. */ - public Object putAttachedObject(String name, Object obj) { + public final Object putAttachedObject(String name, Object obj) { return attachedObjects.put(name, obj); } @@ -306,21 +319,23 @@ public abstract class GLContext { public final boolean isCreatedWithARBMethod() { return ( 0 != ( CTX_IS_ARB_CREATED & ctxOptions ) ); } /** - * Returns a valid OpenGL version string, ie - * <code>major.minor ([option]?[options,]*) - gl-version</code> + * Returns a valid OpenGL version string, ie<br> + * <pre> + * major.minor ([option]?[options,]*) - gl-version + * </pre><br> * * <ul> * <li> options * <ul> - * <li> <code>old</code> refers to the non ARB_create_context created context - * <li> <code>new</code> refers to the ARB_create_context created context - * <li> <code>compatible profile</code> - * <li> <code>core profile</code> - * <li> <code>forward compatible</code> - * <li> <code>any</code> refers to the non forward compatible context - * <li> <code>ES</code> refers to the GLES context variant - * </ul> - * <li> <i>gl-version</i> the GL_VERSION string + * <li> <code>old</code> refers to the non ARB_create_context created context</li> + * <li> <code>new</code> refers to the ARB_create_context created context</li> + * <li> <code>compatible profile</code></li> + * <li> <code>core profile</code></li> + * <li> <code>forward compatible</code></li> + * <li> <code>any</code> refers to the non forward compatible context</li> + * <li> <code>ES</code> refers to the GLES context variant</li> + * </ul></li> + * <li> <i>gl-version</i> the GL_VERSION string</li> * </ul> * * e.g.: |