From dd0400a41478c1f365414b8c760eee1c91105280 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Wed, 2 Jun 2010 04:04:19 +0200 Subject: JOGL: Unified GLContext native handle - All GLContext implementations are using the contextHandle of the super class. - GLContext.getHandle() exposes contextHandle for API cross access --- src/jogl/classes/javax/media/opengl/GLContext.java | 47 ++++++++++++++-------- 1 file changed, 31 insertions(+), 16 deletions(-) (limited to 'src/jogl/classes/javax') 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/**/ 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 @@ -232,17 +233,29 @@ 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 - * major.minor ([option]?[options,]*) - gl-version + * Returns a valid OpenGL version string, ie
+ *
+   *     major.minor ([option]?[options,]*) - gl-version
+   * 

* * + *
  • gl-version the GL_VERSION string
  • * * * e.g.: -- cgit v1.2.3