From 6833b2827d31a7bf08e22963b0d44be6470bdf07 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 5 Mar 2009 01:23:34 +0000 Subject: - 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 --- .../media/opengl/sub/fixed/GLFixedFuncUtil.java | 50 ++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 src/classes/javax/media/opengl/sub/fixed/GLFixedFuncUtil.java (limited to 'src/classes/javax/media/opengl/sub/fixed/GLFixedFuncUtil.java') diff --git a/src/classes/javax/media/opengl/sub/fixed/GLFixedFuncUtil.java b/src/classes/javax/media/opengl/sub/fixed/GLFixedFuncUtil.java new file mode 100644 index 000000000..4c0d1b87f --- /dev/null +++ b/src/classes/javax/media/opengl/sub/fixed/GLFixedFuncUtil.java @@ -0,0 +1,50 @@ +/* + * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. + */ + +package javax.media.opengl.sub.fixed; + +import javax.media.opengl.*; +import javax.media.opengl.sub.*; + +/** + * Contains values to handle the fixed implementation. + */ +public class GLFixedFuncUtil { + + /** + * @return The current GLContext's GL object cast as GLFixedFuncIf + * @throws GLException is this GL Object is not a GLFixedFuncIf implementation, + * or no GLContext is current + */ + public static final GLFixedFuncIf getCurrentGLFixedFuncIf() throws GLException { + GLContext curContext = GLContext.getCurrent(); + if (curContext == null) { + throw new GLException("No OpenGL context current on this thread"); + } + GL gl = curContext.getGL(); + if(gl instanceof GLFixedFuncIf) { + return (GLFixedFuncIf) gl; + } + throw new GLException("Not a GLFixedFuncIf implementation"); + } + + /** + * @return true if GL object is a GLFixedFuncIf + */ + public static final boolean isGLFixedFuncIf(GL gl) { + return (gl instanceof GLFixedFuncIf) ; + } + + /** + * @return The object cast as GLFixedFuncIf + * @throws GLException is this GL Object is not a GLFixedFuncIf implementation + */ + public static final GLFixedFuncIf getGLFixedFuncIf(GL gl) { + if(gl instanceof GLFixedFuncIf) { + return (GLFixedFuncIf) gl; + } + throw new GLException("Not a GLFixedFuncIf implementation"); + } +} + -- cgit v1.2.3