aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/javax/media
diff options
context:
space:
mode:
authorMichael Bien <[email protected]>2009-08-08 21:43:30 +0200
committerMichael Bien <[email protected]>2009-08-08 21:43:30 +0200
commit8ef9d7364a942c19ec5e1f306e08193e83f4fea6 (patch)
tree6dcf95825d2933992199a7062b15e38d3f721c95 /src/jogl/classes/javax/media
parent2a8e9876ca4567de3b08813c280d006f9b2c32e6 (diff)
parentfb3e50b4e7e11df911a83ab7966cf8f293c20da2 (diff)
Merge branch 'master' of ssh://[email protected]/jogl~jogl-git
Diffstat (limited to 'src/jogl/classes/javax/media')
-rw-r--r--src/jogl/classes/javax/media/opengl/GLAutoDrawable.java5
-rw-r--r--src/jogl/classes/javax/media/opengl/GLBase.java163
-rw-r--r--src/jogl/classes/javax/media/opengl/GLContext.java4
-rw-r--r--src/jogl/classes/javax/media/opengl/GLDrawableFactory.java16
-rw-r--r--src/jogl/classes/javax/media/opengl/GLPipelineFactory.java194
-rw-r--r--src/jogl/classes/javax/media/opengl/GLProfile.java22
-rw-r--r--src/jogl/classes/javax/media/opengl/GLUniformData.java12
-rw-r--r--src/jogl/classes/javax/media/opengl/awt/GLCanvas.java4
-rw-r--r--src/jogl/classes/javax/media/opengl/awt/GLJPanel.java34
9 files changed, 411 insertions, 43 deletions
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/GLBase.java b/src/jogl/classes/javax/media/opengl/GLBase.java
index efd2eedd1..92498077b 100644
--- a/src/jogl/classes/javax/media/opengl/GLBase.java
+++ b/src/jogl/classes/javax/media/opengl/GLBase.java
@@ -7,9 +7,53 @@ package javax.media.opengl;
import java.nio.*;
/**
- * The base interface from which all GL profiles derive, providing
- * checked conversion down to concrete profiles, and access to the
- * OpenGL context associated with the GL.
+ * <P>The base interface from which all GL profiles derive, providing
+ * checked conversion down to concrete profiles, access to the
+ * OpenGL context associated with the GL and extension/function
+ * availability queries as described below.</P>
+ *
+ * <P> While the APIs for vendor extensions are unconditionally
+ * exposed, the underlying functions may not be present. The method
+ * {@link #isFunctionAvailable} should be used to query the
+ * availability of any non-core function before it is used for the
+ * first time; for example,
+ * <code>gl.isFunctionAvailable("glProgramStringARB")</code>. On
+ * certain platforms (Windows in particular), the most "core"
+ * functionality is only OpenGL 1.1, so in theory any routines first
+ * exposed in OpenGL 1.2, 1.3, and 1.4, 1.5, or 2.0 as well as vendor
+ * extensions should all be queried. Calling an unavailable function
+ * will cause a {@link GLException} to be raised. </P>
+ *
+ * {@link #isExtensionAvailable} may also be used to determine whether
+ * a specific extension is available before calling the routines or
+ * using the functionality it exposes: for example,
+ * <code>gl.isExtensionAvailable("GL_ARB_vertex_program");</code>.
+ * However, in this case it is up to the end user to know which
+ * routines or functionality are associated with which OpenGL
+ * extensions. It may also be used to test for the availability of a
+ * particular version of OpenGL: for example,
+ * <code>gl.isExtensionAvailable("GL_VERSION_1_5");</code>.
+ *
+ * <P> Exceptions to the window system extension naming rules:
+ *
+ * <UL>
+ *
+ * <LI> The memory allocators for the NVidia vertex_array_range (VAR)
+ * extension, in particular <code>wglAllocateMemoryNV</code> /
+ * <code>glXAllocateMemoryNV</code> and associated routines. {@link
+ * #glAllocateMemoryNV} has been provided for window system-independent
+ * access to VAR. {@link #isFunctionAvailable} will translate an argument
+ * of "glAllocateMemoryNV" or "glFreeMemoryNV" into the appropriate
+ * window system-specific name. </P>
+ *
+ * <LI> WGL_ARB_pbuffer, WGL_ARB_pixel_format, and other
+ * platform-specific pbuffer functionality; the availability of
+ * pbuffers can be queried on Windows, X11 and Mac OS X platforms by
+ * querying {@link #isExtensionAvailable} with an argument of
+ * "GL_ARB_pbuffer" or "GL_ARB_pixel_format".
+ *
+ * </UL> <P>
+ *
*/
public interface GLBase {
@@ -63,6 +107,12 @@ public interface GLBase {
*/
public boolean isGL2ES2();
+ /**
+ * Indicates whether this GL object conforms to the GL2GL3 compatible profile.
+ * @return whether this GL object conforms to the GL2GL3 profile
+ */
+ public boolean isGL2GL3();
+
/** Indicates whether this GL object supports GLSL. */
public boolean hasGLSL();
@@ -116,14 +166,115 @@ public interface GLBase {
public GL2ES2 getGL2ES2() throws GLException;
/**
- * Returns the GLContext with which this GL object is associated.
- * @return the GLContext with which this GL object is associated
+ * Casts this object to the GL2GL3 interface.
+ * @return this object cast to the GL2GL3 interface
+ * @throws GLException if this GLObject is not a GL2GL3 implementation
*/
- public GLContext getContext();
+ public GL2GL3 getGL2GL3() throws GLException;
/**
* Returns the GLProfile with which this GL object is associated.
* @return the GLProfile with which this GL object is associated
*/
public GLProfile getGLProfile();
+
+ /**
+ * Returns the GLContext with which this GL object is associated.
+ * @return the GLContext with which this GL object is associated
+ */
+ public GLContext getContext();
+
+ /**
+ * Returns true if the specified OpenGL core- or extension-function can be
+ * used successfully through this GL instance given the current host (OpenGL
+ * <i>client</i>) and display (OpenGL <i>server</i>) configuration.<P>
+ * By "successfully" we mean that the function is both <i>callable</i>
+ * on the machine running the program and <i>available</i> on the current
+ * display.<P>
+ *
+ * In order to call a function successfully, the function must be both
+ * <i>callable</i> on the machine running the program and <i>available</i> on
+ * the display device that is rendering the output (note: on non-networked,
+ * single-display machines these two conditions are identical; on networked and/or
+ * multi-display machines this becomes more complicated). These conditions are
+ * met if the function is either part of the core OpenGL version supported by
+ * both the host and display, or it is an OpenGL extension function that both
+ * the host and display support. <P>
+ *
+ * A GL function is <i>callable</i> if it is successfully linked at runtime,
+ * hence the GLContext must be made current at least once.
+ *
+ * @param glFunctionName the name of the OpenGL function (e.g., use
+ * "glBindRenderbufferEXT" or "glBindRenderbuffer" to check if {@link
+ * #glBindRenderbuffer(int,int)} is available).
+ */
+ public boolean isFunctionAvailable(String glFunctionName);
+
+ /**
+ * Returns true if the specified OpenGL extension can be
+ * used successfully through this GL instance given the current host (OpenGL
+ * <i>client</i>) and display (OpenGL <i>server</i>) configuration.<P>
+ *
+ * @param glExtensionName the name of the OpenGL extension (e.g.,
+ * "GL_ARB_vertex_program").
+ */
+ public boolean isExtensionAvailable(String glExtensionName);
+
+ /** Provides a platform-independent way to specify the minimum swap
+ interval for buffer swaps. An argument of 0 disables
+ sync-to-vertical-refresh completely, while an argument of 1
+ causes the application to wait until the next vertical refresh
+ until swapping buffers. The default, which is platform-specific,
+ is usually either 0 or 1. This function is not guaranteed to
+ have an effect, and in particular only affects heavyweight
+ onscreen components.
+
+ @see #getSwapInterval
+ @throws GLException if this context is not the current
+ */
+ public void setSwapInterval(int interval);
+
+ /** Provides a platform-independent way to get the swap
+ interval set by {@link #setSwapInterval}. <br>
+
+ If the interval is not set by {@link #setSwapInterval} yet,
+ -1 is returned, indicating that the platforms default
+ is being used.
+
+ @see #setSwapInterval
+ */
+ public int getSwapInterval();
+
+ /**
+ * Returns an object through which platform-specific OpenGL extensions
+ * (EGL, GLX, WGL, etc.) may be accessed. The data type of the returned
+ * object and its associated capabilities are undefined. Most
+ * applications will never need to call this method. It is highly
+ * recommended that any applications which do call this method perform
+ * all accesses on the returned object reflectively to guard
+ * themselves against changes to the implementation.
+ */
+ public Object getPlatformGLExtensions();
+
+ /**
+ * Returns an object providing access to the specified OpenGL
+ * extension. This is intended to provide a mechanism for vendors who
+ * wish to provide access to new OpenGL extensions without changing
+ * the public API of the core package. For example, a user may request
+ * access to extension "GL_VENDOR_foo" and receive back an object
+ * which implements a vendor-specified interface which can call the
+ * OpenGL extension functions corresponding to that extension. It is
+ * up to the vendor to specify both the extension name and Java API
+ * for accessing it, including which class or interface contains the
+ * functions.
+ *
+ * <P>
+ *
+ * Note: it is the intent to add new extensions as quickly as possible
+ * to the core GL API. Therefore it is unlikely that most vendors will
+ * use this extension mechanism, but it is being provided for
+ * completeness.
+ */
+ public Object getExtension(String extensionName);
}
+
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/GLDrawableFactory.java b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
index cee721fa6..1a18a60f8 100644
--- a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
+++ b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
@@ -106,16 +106,14 @@ public abstract class GLDrawableFactory {
}
eglFactory = tmp;
- nativeOSType = NativeWindowFactory.getNativeWindowType(false);
+ nativeOSType = NativeWindowFactory.getNativeWindowType(true);
String factoryClassName = null;
tmp = null;
try {
factoryClassName = Debug.getProperty("jogl.gldrawablefactory.class.name", true, AccessController.getContext());
if (null == factoryClassName) {
- if ( nativeOSType.equals(NativeWindowFactory.TYPE_EGL) ) {
- // use egl*Factory ..
- } else if ( nativeOSType.equals(NativeWindowFactory.TYPE_X11) ) {
+ if ( nativeOSType.equals(NativeWindowFactory.TYPE_X11) ) {
factoryClassName = "com.sun.opengl.impl.x11.glx.X11GLXDrawableFactory";
} else if ( nativeOSType.equals(NativeWindowFactory.TYPE_WINDOWS) ) {
factoryClassName = "com.sun.opengl.impl.windows.wgl.WindowsWGLDrawableFactory";
@@ -126,10 +124,16 @@ public abstract class GLDrawableFactory {
factoryClassName = macosxFactoryClassNameCGL;
}
} else {
- throw new GLException("Unsupported NativeWindow type: "+nativeOSType);
+ // may use egl*Factory ..
+ if (GLProfile.DEBUG) {
+ System.err.println("GLDrawableFactory.static - No Native OS Factory for: "+nativeOSType);
+ }
}
}
if (null != factoryClassName) {
+ if (GLProfile.DEBUG) {
+ System.err.println("GLDrawableFactory.static - Native OS Factory for: "+nativeOSType+": "+factoryClassName);
+ }
tmp = (GLDrawableFactory) NWReflection.createInstance(factoryClassName);
}
} catch (Throwable t) {
@@ -144,7 +148,7 @@ public abstract class GLDrawableFactory {
/**
* Returns the sole GLDrawableFactory instance.
*
- * @arg glProfile GLProfile to determine the factory type, ie EGLDrawableFactory,
+ * @param glProfile GLProfile to determine the factory type, ie EGLDrawableFactory,
* or one of the native GLDrawableFactory's, ie X11/GLX, Windows/WGL or MacOSX/CGL.
*/
public static GLDrawableFactory getFactory(GLProfile glProfile) throws GLException {
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..63b50cb3c
--- /dev/null
+++ b/src/jogl/classes/javax/media/opengl/GLPipelineFactory.java
@@ -0,0 +1,194 @@
+/*
+ * 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 the <code>downstream</code> class and it's superclasses, do:</li>
+ * <ul>
+ * <li> For all <code>downstream</code> class and superclass interfaces, do:</li>
+ * <ul>
+ * <li> If <code>reqInterface</code> is not null and the interface is unequal, continue loop.</li>
+ * <li> If <code>downstream</code> is not instance of interface, continue loop.</li>
+ * <li> If upstream class is available use it, end loop.</li>
+ * </ul>
+ * </ul>
+ * </ul><br>
+ *
+ * @param pipelineClazzBaseName the basename of the pipline class name
+ * @param reqInterface optional requested interface to be used, may be null, in which case the first matching one is used
+ * @param downstream is always the 1st argument for the upstream constructor
+ * @param 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/GLProfile.java b/src/jogl/classes/javax/media/opengl/GLProfile.java
index ead5f6396..756c80009 100644
--- a/src/jogl/classes/javax/media/opengl/GLProfile.java
+++ b/src/jogl/classes/javax/media/opengl/GLProfile.java
@@ -78,10 +78,13 @@ public class GLProfile implements Cloneable {
/** The intersection of the desktop GL3, GL2 and embedded ES2 profile */
public static final String GL2ES2 = "GL2ES2";
+ /** The intersection of the desktop GL3 and GL2 profile */
+ public static final String GL2GL3 = "GL2GL3";
+
/**
- * All GL Profiles in the order of default detection: GL2, GL2ES2, GL2ES1, GLES2, GLES1, GL3
+ * All GL Profiles in the order of default detection: GL2, GL2ES2, GL2ES1, GLES2, GLES1, GL2GL3, GL3
*/
- public static final String[] GL_PROFILE_LIST_ALL = new String[] { GL2, GL2ES2, GL2ES1, GLES2, GLES1, GL3 };
+ public static final String[] GL_PROFILE_LIST_ALL = new String[] { GL2, GL2ES2, GL2ES1, GLES2, GLES1, GL2GL3, GL3 };
/**
* All GL2ES2 Profiles in the order of default detection: GL2ES2, GL2, GLES2, GL3
@@ -273,6 +276,11 @@ public class GLProfile implements Cloneable {
return GL2ES2.equals(profile) || isGL2() || isGL3() || isGLES2() ;
}
+ /** Indicates whether this profile is capable os GL2GL3. */
+ public final boolean isGL2GL3() {
+ return GL2GL3.equals(profile) || isGL2() || isGL3() ;
+ }
+
/** Indicates whether this profile uses the native OpenGL ES1 implementations. */
public final boolean usesNativeGLES1() {
return GLES1.equals(profileImpl) || GL2ES1.equals(profileImpl) ;
@@ -709,6 +717,8 @@ public class GLProfile implements Cloneable {
System.err.println("GLProfile.static hasGL3Impl "+hasGL3Impl);
System.err.println("GLProfile.static hasGL2Impl "+hasGL2Impl);
System.err.println("GLProfile.static hasGL2ES12Impl "+hasGL2ES12Impl);
+ System.err.println("GLProfile.static hasEGLDynLookup "+hasEGLDynLookup);
+ System.err.println("GLProfile.static hasEGLDrawableFactory "+hasEGLDrawableFactory);
System.err.println("GLProfile.static hasGLES2Impl "+hasGLES2Impl);
System.err.println("GLProfile.static hasGLES1Impl "+hasGLES1Impl);
}
@@ -758,10 +768,10 @@ public class GLProfile implements Cloneable {
*/
private static String computeProfileImpl(String profile) {
if (GL2ES1.equals(profile)) {
- if(hasGL2Impl) {
- return GL2;
- } else if(hasGL2ES12Impl) {
+ if(hasGL2ES12Impl) {
return GL2ES12;
+ } else if(hasGL2Impl) {
+ return GL2;
} else if(hasGLES1Impl) {
return GLES1;
}
@@ -779,6 +789,8 @@ public class GLProfile implements Cloneable {
return GL3;
} else if(GL2.equals(profile) && hasGL2Impl) {
return GL2;
+ } else if(GL2GL3.equals(profile) && hasGL2Impl) {
+ return GL2;
} else if(GLES2.equals(profile) && hasGLES2Impl) {
return GLES2;
} else if(GLES1.equals(profile) && hasGLES1Impl) {
diff --git a/src/jogl/classes/javax/media/opengl/GLUniformData.java b/src/jogl/classes/javax/media/opengl/GLUniformData.java
index 8b5fb1a03..f628ce35a 100644
--- a/src/jogl/classes/javax/media/opengl/GLUniformData.java
+++ b/src/jogl/classes/javax/media/opengl/GLUniformData.java
@@ -10,7 +10,7 @@ public class GLUniformData {
*
* Number of objects is 1
*
- * @arg components number of elements of one object, ie 4 for GL_FLOAT_VEC4,
+ * @param components number of elements of one object, ie 4 for GL_FLOAT_VEC4,
*/
public GLUniformData(String name, int val) {
init(name, 1, new Integer(val));
@@ -21,7 +21,7 @@ public class GLUniformData {
*
* Number of objects is 1
*
- * @arg components number of elements of one object, ie 4 for GL_FLOAT_VEC4,
+ * @param components number of elements of one object, ie 4 for GL_FLOAT_VEC4,
*/
public GLUniformData(String name, float val) {
init(name, 1, new Float(val));
@@ -32,7 +32,7 @@ public class GLUniformData {
*
* Number of objects is calculated by data.limit()/components
*
- * @arg components number of elements of one object, ie 4 for GL_FLOAT_VEC4,
+ * @param components number of elements of one object, ie 4 for GL_FLOAT_VEC4,
*/
public GLUniformData(String name, int components, IntBuffer data) {
init(name, components, data);
@@ -43,7 +43,7 @@ public class GLUniformData {
*
* Number of objects is calculated by data.limit()/components
*
- * @arg components number of elements of one object, ie 4 for GL_FLOAT_VEC4,
+ * @param components number of elements of one object, ie 4 for GL_FLOAT_VEC4,
*/
public GLUniformData(String name, int components, FloatBuffer data) {
init(name, components, data);
@@ -54,8 +54,8 @@ public class GLUniformData {
*
* Number of objects is calculated by data.limit()/(rows*columns)
*
- * @arg rows the matrix rows
- * @arg column the matrix column
+ * @param rows the matrix rows
+ * @param column the matrix column
*/
public GLUniformData(String name, int rows, int columns, FloatBuffer data) {
init(name, rows, columns, data);
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 dd2a487e7..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) {
@@ -1322,16 +1324,16 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable {
" with width " + width[0] + ", height " + height[0]);
}
- gl.glBindRenderbuffer(GL2.GL_RENDERBUFFER, frameBufferDepthBuffer[0]);
+ gl.glBindRenderbuffer(GL.GL_RENDERBUFFER, frameBufferDepthBuffer[0]);
// FIXME: may need a loop here like in Java2D
- gl.glRenderbufferStorage(GL2.GL_RENDERBUFFER, GL2.GL_DEPTH_COMPONENT24, width[0], height[0]);
+ gl.glRenderbufferStorage(GL.GL_RENDERBUFFER, GL2GL3.GL_DEPTH_COMPONENT24, width[0], height[0]);
gl.glBindRenderbuffer(GL2.GL_RENDERBUFFER, 0);
createNewDepthBuffer = false;
}
gl.glBindTexture(fboTextureTarget, 0);
- gl.glBindFramebuffer(GL2.GL_FRAMEBUFFER, frameBuffer[0]);
+ gl.glBindFramebuffer(GL.GL_FRAMEBUFFER, frameBuffer[0]);
if (fbObjectWorkarounds) {
// Hook up the color and depth buffer attachment points for this framebuffer
@@ -1435,29 +1437,29 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable {
j2dContext.makeCurrent();
GL gl = j2dContext.getGL();
- if ((getGLInteger(gl, GL2.GL_RED_BITS) < offscreenCaps.getRedBits()) ||
- (getGLInteger(gl, GL2.GL_GREEN_BITS) < offscreenCaps.getGreenBits()) ||
- (getGLInteger(gl, GL2.GL_BLUE_BITS) < offscreenCaps.getBlueBits()) ||
- // (getGLInteger(gl, GL2.GL_ALPHA_BITS) < offscreenCaps.getAlphaBits()) ||
+ if ((getGLInteger(gl, GL.GL_RED_BITS) < offscreenCaps.getRedBits()) ||
+ (getGLInteger(gl, GL.GL_GREEN_BITS) < offscreenCaps.getGreenBits()) ||
+ (getGLInteger(gl, GL.GL_BLUE_BITS) < offscreenCaps.getBlueBits()) ||
+ // (getGLInteger(gl, GL.GL_ALPHA_BITS) < offscreenCaps.getAlphaBits()) ||
(getGLInteger(gl, GL2.GL_ACCUM_RED_BITS) < offscreenCaps.getAccumRedBits()) ||
(getGLInteger(gl, GL2.GL_ACCUM_GREEN_BITS) < offscreenCaps.getAccumGreenBits()) ||
(getGLInteger(gl, GL2.GL_ACCUM_BLUE_BITS) < offscreenCaps.getAccumBlueBits()) ||
(getGLInteger(gl, GL2.GL_ACCUM_ALPHA_BITS) < offscreenCaps.getAccumAlphaBits()) ||
// (getGLInteger(gl, GL2.GL_DEPTH_BITS) < offscreenCaps.getDepthBits()) ||
- (getGLInteger(gl, GL2.GL_STENCIL_BITS) < offscreenCaps.getStencilBits())) {
+ (getGLInteger(gl, GL.GL_STENCIL_BITS) < offscreenCaps.getStencilBits())) {
if (DEBUG) {
System.err.println("GLJPanel: Falling back to pbuffer-based support because Java2D context insufficient");
System.err.println(" Available Required");
- System.err.println("GL_RED_BITS " + getGLInteger(gl, GL2.GL_RED_BITS) + " " + offscreenCaps.getRedBits());
- System.err.println("GL_GREEN_BITS " + getGLInteger(gl, GL2.GL_GREEN_BITS) + " " + offscreenCaps.getGreenBits());
- System.err.println("GL_BLUE_BITS " + getGLInteger(gl, GL2.GL_BLUE_BITS) + " " + offscreenCaps.getBlueBits());
- System.err.println("GL_ALPHA_BITS " + getGLInteger(gl, GL2.GL_ALPHA_BITS) + " " + offscreenCaps.getAlphaBits());
+ System.err.println("GL_RED_BITS " + getGLInteger(gl, GL.GL_RED_BITS) + " " + offscreenCaps.getRedBits());
+ System.err.println("GL_GREEN_BITS " + getGLInteger(gl, GL.GL_GREEN_BITS) + " " + offscreenCaps.getGreenBits());
+ System.err.println("GL_BLUE_BITS " + getGLInteger(gl, GL.GL_BLUE_BITS) + " " + offscreenCaps.getBlueBits());
+ System.err.println("GL_ALPHA_BITS " + getGLInteger(gl, GL.GL_ALPHA_BITS) + " " + offscreenCaps.getAlphaBits());
System.err.println("GL_ACCUM_RED_BITS " + getGLInteger(gl, GL2.GL_ACCUM_RED_BITS) + " " + offscreenCaps.getAccumRedBits());
System.err.println("GL_ACCUM_GREEN_BITS " + getGLInteger(gl, GL2.GL_ACCUM_GREEN_BITS) + " " + offscreenCaps.getAccumGreenBits());
System.err.println("GL_ACCUM_BLUE_BITS " + getGLInteger(gl, GL2.GL_ACCUM_BLUE_BITS) + " " + offscreenCaps.getAccumBlueBits());
System.err.println("GL_ACCUM_ALPHA_BITS " + getGLInteger(gl, GL2.GL_ACCUM_ALPHA_BITS) + " " + offscreenCaps.getAccumAlphaBits());
- System.err.println("GL_DEPTH_BITS " + getGLInteger(gl, GL2.GL_DEPTH_BITS) + " " + offscreenCaps.getDepthBits());
- System.err.println("GL_STENCIL_BITS " + getGLInteger(gl, GL2.GL_STENCIL_BITS) + " " + offscreenCaps.getStencilBits());
+ System.err.println("GL_DEPTH_BITS " + getGLInteger(gl, GL.GL_DEPTH_BITS) + " " + offscreenCaps.getDepthBits());
+ System.err.println("GL_STENCIL_BITS " + getGLInteger(gl, GL.GL_STENCIL_BITS) + " " + offscreenCaps.getStencilBits());
}
isInitialized = false;
backend = null;
@@ -1587,7 +1589,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable {
if (!checkedGLVendor) {
checkedGLVendor = true;
- String vendor = gl.glGetString(GL2.GL_VENDOR);
+ String vendor = gl.glGetString(GL.GL_VENDOR);
if ((vendor != null) &&
vendor.startsWith("ATI")) {