aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl')
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/ExtensionAvailabilityCache.java178
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/GLContextImpl.java26
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/GLPbufferImpl.java4
-rw-r--r--src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/FixedFuncUtil.java15
-rw-r--r--src/jogl/classes/javax/media/opengl/GLAutoDrawable.java5
-rw-r--r--src/jogl/classes/javax/media/opengl/GLContext.java4
-rw-r--r--src/jogl/classes/javax/media/opengl/GLPipelineFactory.java195
-rw-r--r--src/jogl/classes/javax/media/opengl/awt/GLCanvas.java4
-rw-r--r--src/jogl/classes/javax/media/opengl/awt/GLJPanel.java4
9 files changed, 392 insertions, 43 deletions
diff --git a/src/jogl/classes/com/sun/opengl/impl/ExtensionAvailabilityCache.java b/src/jogl/classes/com/sun/opengl/impl/ExtensionAvailabilityCache.java
index eee308088..7931f791b 100644
--- a/src/jogl/classes/com/sun/opengl/impl/ExtensionAvailabilityCache.java
+++ b/src/jogl/classes/com/sun/opengl/impl/ExtensionAvailabilityCache.java
@@ -65,7 +65,25 @@ public final class ExtensionAvailabilityCache {
*/
public void flush()
{
+ if(DEBUG) {
+ System.out.println("ExtensionAvailabilityCache: Flush availability OpenGL "+majorVersion+"."+minorVersion);
+ }
availableExtensionCache.clear();
+ initialized = false;
+ majorVersion = 1;
+ minorVersion = 0;
+ }
+
+ /**
+ * Flush the cache and rebuild the cache.
+ */
+ public void reset() {
+ flush();
+ initAvailableExtensions();
+ }
+
+ public boolean isInitialized() {
+ return initialized && !availableExtensionCache.isEmpty() ;
}
public boolean isExtensionAvailable(String glExtensionName) {
@@ -73,19 +91,101 @@ public final class ExtensionAvailabilityCache {
return availableExtensionCache.contains(mapGLExtensionName(glExtensionName));
}
- protected void initAvailableExtensions() {
+ public String getPlatformExtensionsString() {
+ initAvailableExtensions();
+ return glXExtensions;
+ }
+
+ public String getGLExtensions() {
+ initAvailableExtensions();
+ if(DEBUG) {
+ System.err.println("ExtensionAvailabilityCache: getGLExtensions() called");
+ }
+ return glExtensions;
+ }
+
+ public int getMajorVersion() {
+ initAvailableExtensions();
+ return majorVersion;
+ }
+
+ public int getMinorVersion() {
+ initAvailableExtensions();
+ return minorVersion;
+ }
+
+ private void initAvailableExtensions() {
// if hash is empty (meaning it was flushed), pre-cache it with the list
// of extensions that are in the GL_EXTENSIONS string
- if (availableExtensionCache.isEmpty()) {
+ if (availableExtensionCache.isEmpty() || !initialized) {
GL gl = context.getGL();
+
if (DEBUG) {
- System.err.println("!!! Pre-caching extension availability");
+ System.err.println("ExtensionAvailabilityCache: Pre-caching init "+gl+", GL_VERSION "+gl.glGetString(GL.GL_VERSION));
+ }
+
+ // Set version
+ Version version = new Version(gl.glGetString(GL.GL_VERSION));
+ if (version.isValid()) {
+ majorVersion = version.getMajor();
+ minorVersion = version.getMinor();
+
+ if( !gl.isGL3() &&
+ ( majorVersion > 3 ||
+ ( majorVersion == 3 && minorVersion >= 1 ) ) ) {
+ // downsize version to 3.0 in case we are not using GL3 (3.1)
+ majorVersion = 3;
+ minorVersion = 0;
+ }
}
- String allAvailableExtensions =
- gl.glGetString(GL.GL_EXTENSIONS) + " " + context.getPlatformExtensionsString();
+
+ boolean useGetStringi = false;
+
+ if ( majorVersion > 3 ||
+ ( majorVersion == 3 && minorVersion >= 0 ) ||
+ gl.isGL3() ) {
+ if ( ! gl.isGL2GL3() ) {
+ if(DEBUG) {
+ System.err.println("ExtensionAvailabilityCache: GL >= 3.1 usage, but no GL2GL3 interface: "+gl.getClass().getName());
+ }
+ } else if ( ! gl.isFunctionAvailable("glGetStringi") ) {
+ if(DEBUG) {
+ System.err.println("ExtensionAvailabilityCache: GL >= 3.1 usage, but no glGetStringi");
+ }
+ } else {
+ useGetStringi = true;
+ }
+ }
+
if (DEBUG) {
- System.err.println("!!! Available extensions: " + allAvailableExtensions);
- System.err.println("!!! GL vendor: " + gl.glGetString(GL.GL_VENDOR));
+ System.err.println("ExtensionAvailabilityCache: Pre-caching extension availability OpenGL "+majorVersion+"."+minorVersion+
+ ", use "+ ( useGetStringi ? "glGetStringi" : "glGetString" ) );
+ }
+
+ StringBuffer sb = new StringBuffer();
+ if(useGetStringi) {
+ GL2GL3 gl2gl3 = gl.getGL2GL3();
+ int[] numExtensions = { 0 } ;
+ gl2gl3.glGetIntegerv(gl2gl3.GL_NUM_EXTENSIONS, numExtensions, 0);
+ for (int i = 0; i < numExtensions[0]; i++) {
+ sb.append(gl2gl3.glGetStringi(gl2gl3.GL_EXTENSIONS, i));
+ if(i < numExtensions[0]) {
+ sb.append(" ");
+ }
+ }
+ } else {
+ sb.append(gl.glGetString(GL.GL_EXTENSIONS));
+ }
+ glExtensions = sb.toString();
+ glXExtensions = context.getPlatformExtensionsString();
+
+ sb.append(" ");
+ sb.append(glXExtensions);
+
+ String allAvailableExtensions = sb.toString();
+ if (DEBUG_AVAILABILITY) {
+ System.err.println("ExtensionAvailabilityCache: Available extensions: " + allAvailableExtensions);
+ System.err.println("ExtensionAvailabilityCache: GL vendor: " + gl.glGetString(GL.GL_VENDOR));
}
StringTokenizer tok = new StringTokenizer(allAvailableExtensions);
while (tok.hasMoreTokens()) {
@@ -93,42 +193,53 @@ public final class ExtensionAvailabilityCache {
availableExt = availableExt.intern();
availableExtensionCache.add(availableExt);
if (DEBUG_AVAILABILITY) {
- System.err.println("!!! Available: " + availableExt);
+ System.err.println("ExtensionAvailabilityCache: Available: " + availableExt);
}
}
// Put GL version strings in the table as well
- Version version = new Version(gl.glGetString(GL.GL_VERSION));
- if (version.isValid()) {
- int major = version.getMajor();
- int minor = version.getMinor();
- // FIXME: this needs to be adjusted when the major rev changes
- // beyond the known ones
- while (major > 0) {
- while (minor >= 0) {
- availableExtensionCache.add("GL_VERSION_" + major + "_" + minor);
- if (DEBUG) {
- System.err.println("!!! Added GL_VERSION_" + major + "_" + minor + " to known extensions");
- }
- --minor;
+ // FIXME: this needs to be adjusted when the major rev changes
+ // beyond the known ones
+ int major = majorVersion;
+ int minor = minorVersion;
+ while (major > 0) {
+ while (minor >= 0) {
+ availableExtensionCache.add("GL_VERSION_" + major + "_" + minor);
+ if (DEBUG) {
+ System.err.println("ExtensionAvailabilityCache: Added GL_VERSION_" + major + "_" + minor + " to known extensions");
}
+ --minor;
+ }
- switch (major) {
- case 2:
- // Restart loop at version 1.5
- minor = 5;
- break;
- case 1:
- break;
+ switch (major) {
+ case 2:
+ if(gl.isGL3() && major==2) {
+ // GL3 is a GL 3.1 forward compatible context,
+ // hence no 2.0, 1.0 - 1.5 GL versions are supported.
+ major=0;
+ } else {
+ // make sure 2.0 is added ..
+ minor = 0;
+ availableExtensionCache.add("GL_VERSION_" + major + "_" + minor);
+ if (DEBUG) {
+ System.err.println("ExtensionAvailabilityCache: Added GL_VERSION_" + major + "_" + minor + " to known extensions");
+ }
}
-
- --major;
+ // Restart loop at version 1.5
+ minor = 5;
+ break;
+ case 1:
+ break;
}
+
+ --major;
}
// put a dummy var in here so that the cache is no longer empty even if
// no extensions are in the GL_EXTENSIONS string
availableExtensionCache.add("<INTERNAL_DUMMY_PLACEHOLDER>");
+
+ initialized = true;
}
}
@@ -146,6 +257,11 @@ public final class ExtensionAvailabilityCache {
// Internals only below this point
//
+ private boolean initialized = false;
+ private int majorVersion = 1;
+ private int minorVersion = 0;
+ private String glExtensions = null;
+ private String glXExtensions = null;
private HashSet availableExtensionCache = new HashSet(50);
private GLContextImpl context;
@@ -236,7 +352,7 @@ public final class ExtensionAvailabilityCache {
{
// FIXME: refactor desktop OpenGL dependencies and make this
// class work properly for OpenGL ES
- System.err.println("FunctionAvailabilityCache.Version.<init>: "+e);
+ System.err.println("ExtensionAvailabilityCache: FunctionAvailabilityCache.Version.<init>: "+e);
major = 1;
minor = 0;
/*
diff --git a/src/jogl/classes/com/sun/opengl/impl/GLContextImpl.java b/src/jogl/classes/com/sun/opengl/impl/GLContextImpl.java
index fa7e1ade7..16eb934bd 100644
--- a/src/jogl/classes/com/sun/opengl/impl/GLContextImpl.java
+++ b/src/jogl/classes/com/sun/opengl/impl/GLContextImpl.java
@@ -228,7 +228,7 @@ public abstract class GLContextImpl extends GLContext {
return gl;
}
- public void setGL(GL gl) {
+ public GL setGL(GL gl) {
if(DEBUG) {
String sgl1 = (null!=this.gl)?this.gl.getClass().toString()+", "+this.gl.toString():new String("<null>");
String sgl2 = (null!=gl)?gl.getClass().toString()+", "+gl.toString():new String("<null>");
@@ -236,6 +236,7 @@ public abstract class GLContextImpl extends GLContext {
e.printStackTrace();
}
this.gl = gl;
+ return gl;
}
public abstract Object getPlatformGLExtensions();
@@ -354,7 +355,6 @@ public abstract class GLContextImpl extends GLContext {
if(null==this.gl) {
throw new GLException("setGLFunctionAvailability not called yet");
}
- extensionAvailability.flush();
if (DEBUG) {
System.err.println(getThreadName() + ": !!! Initializing OpenGL extension address table for " + this);
}
@@ -364,6 +364,8 @@ public abstract class GLContextImpl extends GLContext {
// share them among contexts with the same capabilities
}
resetProcAddressTable(getGLProcAddressTable());
+
+ extensionAvailability.reset();
}
/**
@@ -426,6 +428,26 @@ public abstract class GLContextImpl extends GLContext {
return extensionAvailability.isExtensionAvailable(mapToRealGLExtensionName(glExtensionName));
}
+ public String getPlatformExtensionsString() {
+ return extensionAvailability.getPlatformExtensionsString();
+ }
+
+ public String getGLExtensions() {
+ return extensionAvailability.getGLExtensions();
+ }
+
+ public int getMajorVersion() {
+ return extensionAvailability.getMajorVersion();
+ }
+
+ public int getMinorVersion() {
+ return extensionAvailability.getMinorVersion();
+ }
+
+ public boolean isExtensionCacheInitialized() {
+ return extensionAvailability.isInitialized();
+ }
+
/** Indicates which floating-point pbuffer implementation is in
use. Returns one of GLPbuffer.APPLE_FLOAT, GLPbuffer.ATI_FLOAT,
or GLPbuffer.NV_FLOAT. */
diff --git a/src/jogl/classes/com/sun/opengl/impl/GLPbufferImpl.java b/src/jogl/classes/com/sun/opengl/impl/GLPbufferImpl.java
index e414fbc8e..8aba26fc6 100644
--- a/src/jogl/classes/com/sun/opengl/impl/GLPbufferImpl.java
+++ b/src/jogl/classes/com/sun/opengl/impl/GLPbufferImpl.java
@@ -129,8 +129,8 @@ public class GLPbufferImpl implements GLPbuffer {
return getContext().getGL();
}
- public void setGL(GL gl) {
- getContext().setGL(gl);
+ public GL setGL(GL gl) {
+ return getContext().setGL(gl);
}
public void setAutoSwapBufferMode(boolean onOrOff) {
diff --git a/src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/FixedFuncUtil.java b/src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/FixedFuncUtil.java
index 9c8a65173..4149aec69 100644
--- a/src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/FixedFuncUtil.java
+++ b/src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/FixedFuncUtil.java
@@ -14,12 +14,12 @@ import com.sun.opengl.util.glsl.fixedfunc.impl.*;
*/
public class FixedFuncUtil {
/**
- * @return If gl is a GL2ES1, return the type cast object,
+ * @return If gl is a GL2ES1 and force is false, return the type cast object,
* otherwise create a fixed function emulation pipeline with the GL2ES2 impl.
* @throws GLException if the GL object is neither GL2ES1 nor GL2ES2
*/
- public static final GL2ES1 getFixedFuncImpl(GL gl) {
- if(gl.isGL2ES1()) {
+ public static final GL2ES1 getFixedFuncImpl(GL gl, boolean force) {
+ if(!force && gl.isGL2ES1()) {
return gl.getGL2ES1();
} else if(gl.isGL2ES2()) {
GL2ES2 es2 = gl.getGL2ES2();
@@ -32,6 +32,15 @@ public class FixedFuncUtil {
}
/**
+ * @return If gl is a GL2ES1, return the type cast object,
+ * otherwise create a fixed function emulation pipeline with the GL2ES2 impl.
+ * @throws GLException if the GL object is neither GL2ES1 nor GL2ES2
+ */
+ public static final GL2ES1 getFixedFuncImpl(GL gl) {
+ return getFixedFuncImpl(gl, false);
+ }
+
+ /**
* Mapping fixed function (client) array indices to
* GLSL array attribute names.
*
diff --git a/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java b/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java
index 43347c416..a94c14f33 100644
--- a/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java
+++ b/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java
@@ -208,6 +208,7 @@ public interface GLAutoDrawable extends GLDrawable {
This should only be called from within the GLEventListener's
callback methods, and usually only from within the init()
method, in order to install a composable pipeline. See the JOGL
- demos for examples. */
- public void setGL(GL gl);
+ demos for examples.
+ @return the set GL pipeline or null if not successful */
+ public GL setGL(GL gl);
}
diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java
index a2bff729a..8ff52b6e9 100644
--- a/src/jogl/classes/javax/media/opengl/GLContext.java
+++ b/src/jogl/classes/javax/media/opengl/GLContext.java
@@ -205,8 +205,10 @@ public abstract class GLContext {
/**
* Sets the GL pipeline object for this GLContext.
+ *
+ * @return the set GL pipeline or null if not successful
*/
- public abstract void setGL(GL gl);
+ public abstract GL setGL(GL gl);
/**
* Returns the attached user object for the given name to this GLContext.
diff --git a/src/jogl/classes/javax/media/opengl/GLPipelineFactory.java b/src/jogl/classes/javax/media/opengl/GLPipelineFactory.java
new file mode 100644
index 000000000..bb9f86911
--- /dev/null
+++ b/src/jogl/classes/javax/media/opengl/GLPipelineFactory.java
@@ -0,0 +1,195 @@
+/*
+ * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * - Redistribution of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistribution in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * Neither the name of Sun Microsystems, Inc. or the names of
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * This software is provided "AS IS," without a warranty of any kind. ALL
+ * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
+ * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
+ * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+ * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
+ * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
+ * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
+ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+ * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
+ * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ *
+ * You acknowledge that this software is not designed or intended for use
+ * in the design, construction, operation or maintenance of any nuclear
+ * facility.
+ */
+
+package javax.media.opengl;
+
+import java.lang.reflect.*;
+import java.util.StringTokenizer;
+
+import com.sun.opengl.impl.*;
+
+/**
+ * Factory for pipelining GL instances
+ */
+public class GLPipelineFactory {
+ public static final boolean DEBUG = Debug.debug("GLPipelineFactory");
+
+ /**
+ * Creates a pipelined GL instance using the given downstream <code>downstream</code>
+ * and optional arguments <code>additionalArgs</code> for the constructor.<br>
+ *
+ * The upstream GL instance is determined as follows:
+ * <ul>
+ * <li> Use <code>pipelineClazzBaseName</code> as the class name's full basename, incl. package name</li>
+ * <li> For all <code>downstream</code> classes, do:</li>
+ * <ul>
+ * <li> For all <code>downstream</code> class interfaces, do:</li>
+ * <ul>
+ * <li> If <code>reqInterface</code> is not null and the interface is unequal, continue.</li>
+ * <li> If <code>downstream</code> is not instance of interface, continue.</li>
+ * <li> If <code>downstream</code> is not instance of interface, continue.</li>
+ * <li> If upstream class is available use it, end loop.</li>
+ * </ul>
+ * </ul>
+ * </ul><br>
+ *
+ * @arg pipelineClazzBaseName the basename of the pipline class name
+ * @arg reqInterface optional requested interface to be used, may be null, in which case the first matching one is used
+ * @arg downstream is always the 1st argument for the upstream constructor
+ * @arg additionalArgs additional arguments for the upstream constructor
+ */
+ public static final GL create(String pipelineClazzBaseName, Class reqInterface, GL downstream, Object[] additionalArgs) {
+ Class downstreamClazz = downstream.getClass();
+ Class upstreamClazz = null;
+ Class interfaceClazz = null;
+
+ if(DEBUG) {
+ System.out.println("GLPipelineFactory: Start "+downstreamClazz.getName()+", req. Interface: "+reqInterface+" -> "+pipelineClazzBaseName);
+ }
+
+ // For all classes: child -> parent
+ do {
+ // For all interfaces: right -> left == child -> parent
+ // It is important that this matches with the gluegen cfg file's 'Implements' clause !
+ Class[] clazzes = downstreamClazz.getInterfaces();
+ for(int i=clazzes.length-1; null==upstreamClazz && i>=0; i--) {
+ if(DEBUG) {
+ System.out.println("GLPipelineFactory: Try "+downstreamClazz.getName()+" Interface["+i+"]: "+clazzes[i].getName());
+ }
+ if( reqInterface != null && !reqInterface.getName().equals(clazzes[i].getName()) ) {
+ if(DEBUG) {
+ System.out.println("GLPipelineFactory: requested Interface "+reqInterface+" is _not_ "+ clazzes[i].getName());
+ }
+ continue; // not the requested one ..
+ }
+ if( ! clazzes[i].isInstance(downstream) ) {
+ if(DEBUG) {
+ System.out.println("GLPipelineFactory: "+downstream.getClass().getName() + " is _not_ instance of "+ clazzes[i].getName());
+ }
+ continue; // not a compatible one
+ } else {
+ if(DEBUG) {
+ System.out.println("GLPipelineFactory: "+downstream.getClass().getName() + " _is_ instance of "+ clazzes[i].getName());
+ }
+ }
+ upstreamClazz = getUpstreamClazz(clazzes[i], pipelineClazzBaseName);
+ if( null != upstreamClazz ) {
+ interfaceClazz = clazzes[i];
+ }
+ }
+
+ if(null==upstreamClazz) {
+ downstreamClazz = downstreamClazz.getSuperclass();
+ }
+ } while (null!=downstreamClazz && null==upstreamClazz);
+
+
+ if(null==upstreamClazz) {
+ throw new GLException("No pipeline ("+pipelineClazzBaseName+"*) available for :"+downstream.getClass().getName());
+ }
+
+ if(DEBUG) {
+ System.out.println("GLPipelineFactory: Got : "+ upstreamClazz.getName()+", base interface: "+interfaceClazz.getName());
+ }
+
+ Class[] cstrArgTypes = new Class[ 1 + ( ( null==additionalArgs ) ? 0 : additionalArgs.length ) ] ;
+ {
+ int i = 0;
+ cstrArgTypes[i++] = interfaceClazz;
+ for(int j=0; null!=additionalArgs && j<additionalArgs.length; j++) {
+ cstrArgTypes[i++] = additionalArgs[j].getClass();
+ }
+ }
+ Constructor cstr = null;
+ try {
+ cstr = upstreamClazz.getDeclaredConstructor( cstrArgTypes );
+ } catch(NoSuchMethodException nsme) {
+ throw new GLException("Couldn't find pipeline constructor: " + upstreamClazz.getName() +
+ " ( "+getArgsClassNameList(downstreamClazz, additionalArgs) +" )");
+ }
+ Object instance = null;
+ try {
+ Object[] cstrArgs = new Object[ 1 + ( ( null==additionalArgs ) ? 0 : additionalArgs.length ) ] ;
+ {
+ int i = 0;
+ cstrArgs[i++] = downstream;
+ for(int j=0; null!=additionalArgs && j<additionalArgs.length; j++) {
+ cstrArgs[i++] = additionalArgs[j];
+ }
+ }
+ instance = cstr.newInstance( cstrArgs ) ;
+ } catch (Throwable t) { t.printStackTrace(); }
+ if(null==instance) {
+ throw new GLException("Couldn't create instance of pipeline: "+upstreamClazz.getName()+
+ " ( "+getArgsClassNameList(downstreamClazz, additionalArgs) +" )");
+ }
+ if( ! (instance instanceof GL) ) {
+ throw new GLException(upstreamClazz.getName()+" not an instance of GL");
+ }
+ return (GL) instance;
+ }
+
+ private static final String getArgsClassNameList(Class arg0, Object[] args) {
+ StringBuffer sb = new StringBuffer();
+ sb.append(arg0.getName());
+ if(args!=null) {
+ for(int j=0; j<args.length; j++) {
+ sb.append(", ");
+ sb.append(args[j].getClass().getName());
+ }
+ }
+ return sb.toString();
+ }
+
+ private static final Class getUpstreamClazz(Class downstreamClazz, String pipelineClazzBaseName) {
+ String downstreamClazzName = downstreamClazz.getName();
+
+ StringTokenizer st = new StringTokenizer(downstreamClazzName, ".");
+ String downstreamClazzBaseName = downstreamClazzName;
+ while(st.hasMoreTokens()) {
+ downstreamClazzBaseName = st.nextToken();
+ }
+ String upstreamClazzName = pipelineClazzBaseName+downstreamClazzBaseName;
+
+ Class upstreamClazz = null;
+ try {
+ upstreamClazz = Class.forName(upstreamClazzName, true, GLPipelineFactory.class.getClassLoader());
+ } catch (Throwable e) { e.printStackTrace(); }
+
+ return upstreamClazz;
+ }
+}
+
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
index 4282e9985..038d6d280 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
+++ b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
@@ -486,11 +486,13 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable {
return (context == null) ? null : context.getGL();
}
- public void setGL(GL gl) {
+ public GL setGL(GL gl) {
GLContext context = getContext();
if (context != null) {
context.setGL(gl);
+ return gl;
}
+ return null;
}
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
index 7b942b358..fe55b2dbd 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
+++ b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
@@ -404,11 +404,13 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable {
return (context == null) ? null : context.getGL();
}
- public void setGL(GL gl) {
+ public GL setGL(GL gl) {
GLContext context = getContext();
if (context != null) {
context.setGL(gl);
+ return gl;
}
+ return null;
}
public void setAutoSwapBufferMode(boolean onOrOff) {