diff options
author | Sven Gothel <[email protected]> | 2009-03-05 01:23:34 +0000 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2009-03-05 01:23:34 +0000 |
commit | 6833b2827d31a7bf08e22963b0d44be6470bdf07 (patch) | |
tree | 0a4db7776d9a1489d2bec772227a6410eeb62cf6 /src/classes/javax/media/opengl/GLContext.java | |
parent | 8e2154eebe45e2f5fd6b0c6598a26ef16617e425 (diff) |
- Fixed rootrel.build usage, this works properly through gluegen, jogl-demos and this build.
You can say -Drootrel.build=build-x86_64 for example.
- Fixed jogl-demos in regard to this changeset
- Gluegen
- Fixed gluegen BuildComposablePipeline's 'getGL*' methods.
Now they return 'this', otherwise the pipeline would be broken/removed.
- Add BuildComposablePipeline CustomPipeline, which allows customized
class composition with an interface (to be wrapped),
prolog class and the downstream class.
- Add GlueGen (incl. ant task) 'outputRootDir' to be able to set a
top output root dir via ant / commandline.
- GL fixed function
- Package 'javax.media.opengl.sub.fixed.*' defines some fixed function interfaces.
This allows partitioning of custom implementation.
- Using gluegen's new CustomPipeline to compose a GLFixedFuncIf implementation,
using a GL downstream and a GLFixedFuncHookIf prolog.
The latter implements the fixed functionality.
Example is the GLFixedFuncImpl.
gl.getContext().setGL( new GLFixedFuncImpl(gl, new FixedFuncHook(gl.getGL2ES2())) ) ;
or
gl.getContext().setGL( new GLFixedFuncImpl(gl, gl.getGL2ES1()) ) ;
- The example GLFixedFuncHookIf impl FixedFuncPipeline/
can be instantiated with custom shader code.
- ES2 and all other interfaces only contain the original functionality,
besides minor convenient data access methods.
- Fix: GL2ES2 createCompileShader() and createLoadShader() is moved to ShaderCode util class.
- Updated PMVMatrix
- Add: GLAutoDrawable.setContext() .. and all it's implementations
Necessary to set a new GLContext.
- Add: GLContext getAttachedObject(int) and putAttachedObject(int, Object),
to allow the user to attach application specific and TLS sensitive objects to the GLContext.
-
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JOGL_2_SANDBOX@1856 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/classes/javax/media/opengl/GLContext.java')
-rw-r--r-- | src/classes/javax/media/opengl/GLContext.java | 54 |
1 files changed, 41 insertions, 13 deletions
diff --git a/src/classes/javax/media/opengl/GLContext.java b/src/classes/javax/media/opengl/GLContext.java index ae9c11786..57569af2a 100644 --- a/src/classes/javax/media/opengl/GLContext.java +++ b/src/classes/javax/media/opengl/GLContext.java @@ -39,6 +39,10 @@ package javax.media.opengl; +import com.sun.opengl.impl.Debug; +import javax.media.opengl.sub.fixed.*; +import java.util.HashMap; + /** Abstraction for an OpenGL rendering context. In order to perform OpenGL rendering, a context must be "made current" on the current thread. OpenGL rendering semantics specify that only one context @@ -53,6 +57,8 @@ package javax.media.opengl; refer to a given context. */ public abstract class GLContext { + protected static final boolean DEBUG = Debug.debug("GLContext"); + /** Indicates that the context was not made current during the last call to {@link #makeCurrent makeCurrent}. */ public static final int CONTEXT_NOT_CURRENT = 0; /** Indicates that the context was made current during the last call to {@link #makeCurrent makeCurrent}. */ @@ -62,6 +68,8 @@ public abstract class GLContext { private static ThreadLocal currentContext = new ThreadLocal(); + private HashMap/*<int, Object>*/ attachedObjects = new HashMap(); + /** * Returns the GLDrawable to which this context may be used to * draw. @@ -158,6 +166,11 @@ public abstract class GLContext { * new GLContext implementations; not for use by end users. */ protected static void setCurrent(GLContext cur) { + if(DEBUG) { + Exception e = new Exception("setCurrent: "+Thread.currentThread()+", "+currentContext.get()+" -> "+cur); + e.printStackTrace(); + } + currentContext.set(cur); } @@ -188,6 +201,21 @@ public abstract class GLContext { */ public abstract void setGL(GL gl); + /** + * Returns the attached user object for the given name to this GLContext/GL. + */ + public Object getAttachedObject(int name) { + return attachedObjects.get(new Integer(name)); + } + + /** + * Sets the attached user object for the given name to this GLContext/GL. + * Returns the previous set object or null. + */ + public Object putAttachedObject(int name, Object obj) { + return attachedObjects.put(new Integer(name), obj); + } + public final String toString() { return "GLContext: "+getClass().getName()+ "(GL: "+getGL().getClass().getName()+","+ @@ -207,28 +235,28 @@ public abstract class GLContext { * Useful for uniq mapping of canonical array index names as listed. * * @see #mgl_Vertex - * @see javax.media.opengl.GL#GL_VERTEX_ARRAY + * @see javax.media.opengl.sub.fixed.GLPointerIf#GL_VERTEX_ARRAY * @see #mgl_Normal - * @see javax.media.opengl.GL#GL_NORMAL_ARRAY + * @see javax.media.opengl.sub.fixed.GLPointerIf#GL_NORMAL_ARRAY * @see #mgl_Color - * @see javax.media.opengl.GL#GL_COLOR_ARRAY + * @see javax.media.opengl.sub.fixed.GLPointerIf#GL_COLOR_ARRAY * @see #mgl_MultiTexCoord - * @see javax.media.opengl.GL#GL_TEXTURE_COORD_ARRAY - * @see javax.media.opengl.GL#glEnableClientState - * @see javax.media.opengl.GL#glVertexPointer - * @see javax.media.opengl.GL#glColorPointer - * @see javax.media.opengl.GL#glNormalPointer - * @see javax.media.opengl.GL#glTexCoordPointer + * @see javax.media.opengl.sub.fixed.GLPointerIf#GL_TEXTURE_COORD_ARRAY + * @see javax.media.opengl.sub.fixed.GLPointerIf#glEnableClientState + * @see javax.media.opengl.sub.fixed.GLPointerIf#glVertexPointer + * @see javax.media.opengl.sub.fixed.GLPointerIf#glColorPointer + * @see javax.media.opengl.sub.fixed.GLPointerIf#glNormalPointer + * @see javax.media.opengl.sub.fixed.GLPointerIf#glTexCoordPointer */ public static String getPredefinedArrayIndexName(int glArrayIndex) { switch(glArrayIndex) { - case GL.GL_VERTEX_ARRAY: + case GLPointerIf.GL_VERTEX_ARRAY: return mgl_Vertex; - case GL.GL_NORMAL_ARRAY: + case GLPointerIf.GL_NORMAL_ARRAY: return mgl_Normal; - case GL.GL_COLOR_ARRAY: + case GLPointerIf.GL_COLOR_ARRAY: return mgl_Color; - case GL.GL_TEXTURE_COORD_ARRAY: + case GLPointerIf.GL_TEXTURE_COORD_ARRAY: return mgl_MultiTexCoord; } return null; |