aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/games/jogl
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/java/games/jogl')
-rw-r--r--src/net/java/games/jogl/Animator.java2
-rw-r--r--src/net/java/games/jogl/ComponentEvents.java2
-rw-r--r--src/net/java/games/jogl/DefaultGLCapabilitiesChooser.java2
-rw-r--r--src/net/java/games/jogl/GLCanvas.java10
-rw-r--r--src/net/java/games/jogl/GLCapabilities.java2
-rw-r--r--src/net/java/games/jogl/GLCapabilitiesChooser.java16
-rw-r--r--src/net/java/games/jogl/GLContextHelper.java2
-rw-r--r--src/net/java/games/jogl/GLDrawable.java18
-rw-r--r--src/net/java/games/jogl/GLDrawableFactory.java2
-rw-r--r--src/net/java/games/jogl/GLEventListener.java17
-rw-r--r--src/net/java/games/jogl/GLException.java2
-rw-r--r--src/net/java/games/jogl/GLJPanel.java249
-rw-r--r--src/net/java/games/jogl/GLPbuffer.java25
-rw-r--r--src/net/java/games/jogl/Version.java6
-rwxr-xr-xsrc/net/java/games/jogl/impl/Debug.java2
-rw-r--r--src/net/java/games/jogl/impl/FunctionAvailabilityCache.java60
-rw-r--r--src/net/java/games/jogl/impl/GLContext.java48
-rw-r--r--src/net/java/games/jogl/impl/GLContextFactory.java2
-rwxr-xr-xsrc/net/java/games/jogl/impl/GLContextInitActionPair.java2
-rw-r--r--src/net/java/games/jogl/impl/GLContextShareSet.java2
-rwxr-xr-xsrc/net/java/games/jogl/impl/GLContextStack.java2
-rw-r--r--src/net/java/games/jogl/impl/GLDrawableHelper.java2
-rw-r--r--src/net/java/games/jogl/impl/GLPbufferImpl.java13
-rwxr-xr-xsrc/net/java/games/jogl/impl/GLUquadricImpl.java2
-rw-r--r--src/net/java/games/jogl/impl/InternalBufferUtils.java2
-rw-r--r--src/net/java/games/jogl/impl/JAWT_PlatformInfo.java2
-rw-r--r--src/net/java/games/jogl/impl/NativeLibLoader.java2
-rwxr-xr-xsrc/net/java/games/jogl/impl/Project.java2
-rwxr-xr-xsrc/net/java/games/jogl/impl/SingleThreadedWorkaround.java2
-rwxr-xr-xsrc/net/java/games/jogl/impl/Util.java2
-rw-r--r--src/net/java/games/jogl/impl/macosx/MacOSXDummyGLContext.java8
-rw-r--r--src/net/java/games/jogl/impl/macosx/MacOSXGLContext.java31
-rw-r--r--src/net/java/games/jogl/impl/macosx/MacOSXGLContextFactory.java2
-rw-r--r--src/net/java/games/jogl/impl/macosx/MacOSXOffscreenGLContext.java6
-rw-r--r--src/net/java/games/jogl/impl/macosx/MacOSXOnscreenGLContext.java9
-rw-r--r--src/net/java/games/jogl/impl/macosx/MacOSXPbufferGLContext.java53
-rw-r--r--src/net/java/games/jogl/impl/mipmap/BuildMipmap.java5
-rw-r--r--src/net/java/games/jogl/impl/mipmap/Mipmap.java95
-rw-r--r--src/net/java/games/jogl/impl/windows/WindowsGLContext.java82
-rw-r--r--src/net/java/games/jogl/impl/windows/WindowsGLContextFactory.java10
-rw-r--r--src/net/java/games/jogl/impl/windows/WindowsOffscreenGLContext.java10
-rw-r--r--src/net/java/games/jogl/impl/windows/WindowsOnscreenGLContext.java8
-rw-r--r--src/net/java/games/jogl/impl/windows/WindowsPbufferGLContext.java92
-rw-r--r--src/net/java/games/jogl/impl/x11/X11GLContext.java19
-rw-r--r--src/net/java/games/jogl/impl/x11/X11GLContextFactory.java68
-rw-r--r--src/net/java/games/jogl/impl/x11/X11OffscreenGLContext.java10
-rw-r--r--src/net/java/games/jogl/impl/x11/X11OnscreenGLContext.java8
-rw-r--r--src/net/java/games/jogl/impl/x11/X11PbufferGLContext.java29
-rwxr-xr-xsrc/net/java/games/jogl/impl/x11/X11SunJDKReflection.java2
-rw-r--r--src/net/java/games/jogl/util/BitmapCharRec.java2
-rw-r--r--src/net/java/games/jogl/util/BitmapFontRec.java2
-rw-r--r--src/net/java/games/jogl/util/BufferUtils.java2
-rw-r--r--src/net/java/games/jogl/util/CoordRec.java2
-rw-r--r--src/net/java/games/jogl/util/GLUT.java14
-rw-r--r--src/net/java/games/jogl/util/GLUTBitmap8x13.java2
-rw-r--r--src/net/java/games/jogl/util/GLUTBitmap9x15.java2
-rw-r--r--src/net/java/games/jogl/util/GLUTBitmapHelvetica10.java2
-rw-r--r--src/net/java/games/jogl/util/GLUTBitmapHelvetica12.java2
-rw-r--r--src/net/java/games/jogl/util/GLUTBitmapHelvetica18.java2
-rw-r--r--src/net/java/games/jogl/util/GLUTBitmapTimesRoman10.java2
-rw-r--r--src/net/java/games/jogl/util/GLUTBitmapTimesRoman24.java2
-rw-r--r--src/net/java/games/jogl/util/GLUTStrokeMonoRoman.java2
-rw-r--r--src/net/java/games/jogl/util/GLUTStrokeRoman.java2
-rw-r--r--src/net/java/games/jogl/util/StrokeCharRec.java2
-rw-r--r--src/net/java/games/jogl/util/StrokeFontRec.java2
-rw-r--r--src/net/java/games/jogl/util/StrokeRec.java2
66 files changed, 738 insertions, 357 deletions
diff --git a/src/net/java/games/jogl/Animator.java b/src/net/java/games/jogl/Animator.java
index 4c50b9362..ebb6d9aed 100644
--- a/src/net/java/games/jogl/Animator.java
+++ b/src/net/java/games/jogl/Animator.java
@@ -20,7 +20,7 @@
* 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
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * 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
diff --git a/src/net/java/games/jogl/ComponentEvents.java b/src/net/java/games/jogl/ComponentEvents.java
index fc3208024..e21441aeb 100644
--- a/src/net/java/games/jogl/ComponentEvents.java
+++ b/src/net/java/games/jogl/ComponentEvents.java
@@ -20,7 +20,7 @@
* 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
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * 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
diff --git a/src/net/java/games/jogl/DefaultGLCapabilitiesChooser.java b/src/net/java/games/jogl/DefaultGLCapabilitiesChooser.java
index 9cac4f83a..119007617 100644
--- a/src/net/java/games/jogl/DefaultGLCapabilitiesChooser.java
+++ b/src/net/java/games/jogl/DefaultGLCapabilitiesChooser.java
@@ -20,7 +20,7 @@
* 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
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * 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
diff --git a/src/net/java/games/jogl/GLCanvas.java b/src/net/java/games/jogl/GLCanvas.java
index 17aed5bea..f73a006ae 100644
--- a/src/net/java/games/jogl/GLCanvas.java
+++ b/src/net/java/games/jogl/GLCanvas.java
@@ -20,7 +20,7 @@
* 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
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * 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
@@ -59,6 +59,8 @@ import net.java.games.jogl.impl.*;
public final class GLCanvas extends Canvas implements GLDrawable {
+ protected static final boolean DEBUG = Debug.debug("GLCanvas");
+
private GLDrawableHelper drawableHelper = new GLDrawableHelper();
private GLContext context;
@@ -90,6 +92,9 @@ public final class GLCanvas extends Canvas implements GLDrawable {
public void addNotify() {
super.addNotify();
context.setRealized();
+ if (DEBUG) {
+ System.err.println("GLCanvas.addNotify()");
+ }
}
/** Overridden from Canvas; used to indicate that it's no longer
@@ -97,6 +102,9 @@ public final class GLCanvas extends Canvas implements GLDrawable {
public void removeNotify() {
context.destroy();
super.removeNotify();
+ if (DEBUG) {
+ System.err.println("GLCanvas.removeNotify()");
+ }
}
/** Overridden from Canvas; causes {@link GLDrawableHelper#reshape}
diff --git a/src/net/java/games/jogl/GLCapabilities.java b/src/net/java/games/jogl/GLCapabilities.java
index 794f152f6..d645a71a6 100644
--- a/src/net/java/games/jogl/GLCapabilities.java
+++ b/src/net/java/games/jogl/GLCapabilities.java
@@ -20,7 +20,7 @@
* 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
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * 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
diff --git a/src/net/java/games/jogl/GLCapabilitiesChooser.java b/src/net/java/games/jogl/GLCapabilitiesChooser.java
index 78486f1e9..951dd52a1 100644
--- a/src/net/java/games/jogl/GLCapabilitiesChooser.java
+++ b/src/net/java/games/jogl/GLCapabilitiesChooser.java
@@ -20,7 +20,7 @@
* 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
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * 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
@@ -40,7 +40,10 @@
package net.java.games.jogl;
/** Provides a mechanism by which applications can customize the
- window type selection for a given {@link GLCapabilities}. */
+ window type selection for a given {@link GLCapabilities}.
+ Developers can implement this interface and pass an instance into
+ the appropriate method of {@link GLDrawableFactory}; the chooser
+ will be called during the OpenGL context creation process. */
public interface GLCapabilitiesChooser {
/** Chooses the index (0..available.length - 1) of the {@link
@@ -50,7 +53,14 @@ public interface GLCapabilitiesChooser {
ignore these. The <em>windowSystemRecommendedChoice</em>
parameter may be provided to the chooser by the underlying
window system; if this index is valid, it is recommended, but
- not necessarily required, that the chooser select that entry. */
+ not necessarily required, that the chooser select that entry.
+
+ <P> <em>Note:</em> this method is called automatically by the
+ {@link GLDrawableFactory} when an instance of this class is
+ passed in to one of its factory methods. It should generally not
+ be invoked by users directly, unless it is desired to delegate
+ the choice to some other GLCapabilitiesChooser object.
+ */
public int chooseCapabilities(GLCapabilities desired,
GLCapabilities[] available,
int windowSystemRecommendedChoice);
diff --git a/src/net/java/games/jogl/GLContextHelper.java b/src/net/java/games/jogl/GLContextHelper.java
index d99e17d39..f4878a723 100644
--- a/src/net/java/games/jogl/GLContextHelper.java
+++ b/src/net/java/games/jogl/GLContextHelper.java
@@ -20,7 +20,7 @@
* 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
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * 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
diff --git a/src/net/java/games/jogl/GLDrawable.java b/src/net/java/games/jogl/GLDrawable.java
index 7c671c0b2..9ca86ca79 100644
--- a/src/net/java/games/jogl/GLDrawable.java
+++ b/src/net/java/games/jogl/GLDrawable.java
@@ -20,7 +20,7 @@
* 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
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * 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
@@ -94,10 +94,22 @@ public interface GLDrawable extends ComponentEvents {
Dimension is null a new one will be allocated and returned. */
public Dimension getSize(Dimension d);
- /** Returns the {@link GL} pipeline object this GLDrawable uses. */
+ /** Returns the {@link GL} pipeline object this GLDrawable uses. If
+ this method is called outside of the {@link GLEventListener}'s
+ callback methods (init, display, etc.) it may return null. Users
+ should not rely on the identity of the returned GL object; for
+ example, users should not maintain a hash table with the GL
+ object as the key. Additionally, the GL object should not be
+ cached in client code, but should be re-fetched from the
+ GLDrawable at the beginning of each call to init, display,
+ etc. */
public GL getGL();
- /** Sets the {@link GL} pipeline object this GLDrawable uses. */
+ /** Sets the {@link GL} pipeline object this GLDrawable uses. 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);
/** Returns the {@link GLU} pipeline object this GLDrawable uses. */
diff --git a/src/net/java/games/jogl/GLDrawableFactory.java b/src/net/java/games/jogl/GLDrawableFactory.java
index 113453d54..8204fde7d 100644
--- a/src/net/java/games/jogl/GLDrawableFactory.java
+++ b/src/net/java/games/jogl/GLDrawableFactory.java
@@ -20,7 +20,7 @@
* 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
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * 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
diff --git a/src/net/java/games/jogl/GLEventListener.java b/src/net/java/games/jogl/GLEventListener.java
index 8a768af87..0f345e6c7 100644
--- a/src/net/java/games/jogl/GLEventListener.java
+++ b/src/net/java/games/jogl/GLEventListener.java
@@ -20,7 +20,7 @@
* 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
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * 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
@@ -48,8 +48,12 @@ import java.util.EventListener;
public interface GLEventListener extends EventListener {
/** Called by the drawable immediately after the OpenGL context is
- initialized for the first time. Can be used to perform one-time
- OpenGL initialization such as setup of lights and display lists.
+ initialized. Can be used to perform one-time OpenGL
+ initialization such as setup of lights and display lists. Note
+ that this method may be called more than once if the underlying
+ OpenGL context for the GLDrawable is destroyed and recreated,
+ for example if a GLCanvas is removed from the widget hierarchy
+ and later added again.
*/
public void init(GLDrawable drawable);
@@ -63,10 +67,9 @@ public interface GLEventListener extends EventListener {
component has been resized. The client can update the viewport
and view volume of the window appropriately, for example by a
call to {@link net.java.games.jogl.GL#glViewport}; note that for
- convenience the component has already called {@link
- net.java.games.jogl.GL#glViewport}(x, y, width, height) when this method
- is called, so the client may not have to do anything in this
- method.
+ convenience the component has already called <code>glViewport(x,
+ y, width, height)</code> when this method is called, so the
+ client may not have to do anything in this method.
*/
public void reshape(GLDrawable drawable, int x, int y, int width, int height);
diff --git a/src/net/java/games/jogl/GLException.java b/src/net/java/games/jogl/GLException.java
index 6e0d5965f..e814ecbc8 100644
--- a/src/net/java/games/jogl/GLException.java
+++ b/src/net/java/games/jogl/GLException.java
@@ -20,7 +20,7 @@
* 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
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * 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
diff --git a/src/net/java/games/jogl/GLJPanel.java b/src/net/java/games/jogl/GLJPanel.java
index 9fe7ffa6c..87c9ee9b3 100644
--- a/src/net/java/games/jogl/GLJPanel.java
+++ b/src/net/java/games/jogl/GLJPanel.java
@@ -20,7 +20,7 @@
* 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
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * 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
@@ -64,20 +64,38 @@ import net.java.games.jogl.impl.*;
use hardware-accelerated rendering via pbuffers and falls back on
to software rendering if problems occur. This class can not be
instantiated directly; use {@link GLDrawableFactory} to construct
- them. */
+ them. <P>
+
+ Note that because this component attempts to use pbuffers for
+ rendering, and because pbuffers can not be resized, somewhat
+ surprising behavior may occur during resize operations; the {@link
+ GLEventListener#init} method may be called multiple times as the
+ pbuffer is resized to be able to cover the size of the GLJPanel.
+ This behavior is correct, as the textures and display lists for
+ the GLJPanel will have been lost during the resize operation. The
+ application should attempt to make its GLEventListener.init()
+ methods as side-effect-free as possible.
+*/
public final class GLJPanel extends JPanel implements GLDrawable {
+ protected static final boolean DEBUG = Debug.debug("GLJPanel");
+
private GLDrawableHelper drawableHelper = new GLDrawableHelper();
+ private volatile boolean isInitialized;
// Data used for either pbuffers or pixmap-based offscreen surfaces
private GLCapabilities offscreenCaps;
private GLCapabilitiesChooser chooser;
private GLDrawable shareWith;
+ // This image is exactly the correct size to render into the panel
private BufferedImage offscreenImage;
- private int neededOffscreenImageWidth;
- private int neededOffscreenImageHeight;
- private DataBufferByte dbByte;
- private DataBufferInt dbInt;
+ // One of these is used to store the read back pixels before storing
+ // in the BufferedImage
+ private byte[] readBackBytes;
+ private int[] readBackInts;
+ private int readBackWidthInPixels;
+ private int readBackHeightInPixels;
+ // Width of the actual GLJPanel
private int panelWidth = 0;
private int panelHeight = 0;
private Updater updater;
@@ -114,11 +132,13 @@ public final class GLJPanel extends JPanel implements GLDrawable {
offscreenCaps.setDoubleBuffered(false);
this.chooser = chooser;
this.shareWith = shareWith;
-
- initialize();
}
public void display() {
+ if (!isInitialized) {
+ return;
+ }
+
if (EventQueue.isDispatchThread()) {
// Want display() to be synchronous, so call paintImmediately()
paintImmediately(0, 0, getWidth(), getHeight());
@@ -137,6 +157,10 @@ public final class GLJPanel extends JPanel implements GLDrawable {
GLEventListener#display}. Should not be invoked by applications
directly. */
public void paintComponent(Graphics g) {
+ if (!isInitialized) {
+ return;
+ }
+
updater.setGraphics(g);
if (!hardwareAccelerationDisabled) {
if (!pbufferInitializationCompleted) {
@@ -144,6 +168,9 @@ public final class GLJPanel extends JPanel implements GLDrawable {
heavyweight.display();
pbuffer.display();
} catch (GLException e) {
+ if (DEBUG) {
+ e.printStackTrace();
+ }
// We consider any exception thrown during updating of the
// heavyweight or pbuffer during the initialization phases
// to be an indication that there was a problem
@@ -161,6 +188,37 @@ public final class GLJPanel extends JPanel implements GLDrawable {
}
}
+ public void addNotify() {
+ super.addNotify();
+ initialize();
+ if (DEBUG) {
+ System.err.println("GLJPanel.addNotify()");
+ }
+ }
+
+ /** Overridden from JPanel; used to indicate that it's no longer
+ safe to have an OpenGL context for the component. */
+ public void removeNotify() {
+ if (DEBUG) {
+ System.err.println("GLJPanel.removeNotify()");
+ }
+ if (!hardwareAccelerationDisabled) {
+ if (pbuffer != null) {
+ pbuffer.destroy();
+ }
+ if (toplevel != null) {
+ toplevel.dispose();
+ }
+ pbuffer = null;
+ heavyweight = null;
+ toplevel = null;
+ } else {
+ offscreenContext.destroy();
+ }
+ isInitialized = false;
+ super.removeNotify();
+ }
+
/** Overridden from Canvas; causes {@link GLDrawableHelper#reshape}
to be called on all registered {@link GLEventListener}s. Called
automatically by the AWT; should not be invoked by applications
@@ -168,6 +226,10 @@ public final class GLJPanel extends JPanel implements GLDrawable {
public void reshape(int x, int y, int width, int height) {
super.reshape(x, y, width, height);
+ if (!isInitialized) {
+ return;
+ }
+
// Move all reshape requests onto AWT EventQueue thread
final int fx = x;
final int fy = y;
@@ -177,18 +239,31 @@ public final class GLJPanel extends JPanel implements GLDrawable {
Runnable r = new Runnable() {
public void run() {
GLContext context = null;
- neededOffscreenImageWidth = 0;
- neededOffscreenImageHeight = 0;
+ readBackWidthInPixels = 0;
+ readBackHeightInPixels = 0;
if (!hardwareAccelerationDisabled) {
- if (fwidth > pbufferWidth || fheight > pbufferHeight) {
+ // Use factor larger than 2 during shrinks for some hysteresis
+ float shrinkFactor = 2.5f;
+ if ((fwidth > pbufferWidth ) || (fheight > pbufferHeight) ||
+ (fwidth < (pbufferWidth / shrinkFactor)) || (fheight < (pbufferWidth / shrinkFactor))) {
+ if (DEBUG) {
+ System.err.println("Resizing pbuffer from (" + pbufferWidth + ", " + pbufferHeight + ") " +
+ " to fit (" + fwidth + ", " + fheight + ")");
+ }
// Must destroy and recreate pbuffer to fit
- pbuffer.destroy();
- if (fwidth > pbufferWidth) {
- pbufferWidth = getNextPowerOf2(fwidth);
+ if (pbuffer != null) {
+ pbuffer.destroy();
}
- if (fheight > pbufferHeight) {
- pbufferHeight = getNextPowerOf2(fheight);
+ if (toplevel != null) {
+ toplevel.dispose();
+ }
+ pbuffer = null;
+ isInitialized = false;
+ pbufferWidth = getNextPowerOf2(fwidth);
+ pbufferHeight = getNextPowerOf2(fheight);
+ if (DEBUG) {
+ System.err.println("New pbuffer size is (" + pbufferWidth + ", " + pbufferHeight + ")");
}
initialize();
}
@@ -201,18 +276,16 @@ public final class GLJPanel extends JPanel implements GLDrawable {
// bottleneck. Should probably make the size of the offscreen
// image be the exact size of the pbuffer to save some work on
// resize operations...
- neededOffscreenImageWidth = pbufferWidth;
- neededOffscreenImageHeight = fheight;
+ readBackWidthInPixels = pbufferWidth;
+ readBackHeightInPixels = fheight;
} else {
offscreenContext.resizeOffscreenContext(fwidth, fheight);
context = offscreenContext;
- neededOffscreenImageWidth = fwidth;
- neededOffscreenImageHeight = fheight;
+ readBackWidthInPixels = fwidth;
+ readBackHeightInPixels = fheight;
}
- if (offscreenImage != null &&
- (offscreenImage.getWidth() != neededOffscreenImageWidth ||
- offscreenImage.getHeight() != neededOffscreenImageHeight)) {
+ if (offscreenImage != null) {
offscreenImage.flush();
offscreenImage = null;
}
@@ -237,6 +310,16 @@ public final class GLJPanel extends JPanel implements GLDrawable {
}
}
+ public void setOpaque(boolean opaque) {
+ if (opaque != isOpaque()) {
+ if (offscreenImage != null) {
+ offscreenImage.flush();
+ offscreenImage = null;
+ }
+ }
+ super.setOpaque(opaque);
+ }
+
public void addGLEventListener(GLEventListener listener) {
drawableHelper.addGLEventListener(listener);
}
@@ -247,17 +330,27 @@ public final class GLJPanel extends JPanel implements GLDrawable {
public GL getGL() {
if (!hardwareAccelerationDisabled) {
+ if (pbuffer == null) {
+ return null;
+ }
return pbuffer.getGL();
} else {
+ if (offscreenContext == null) {
+ return null;
+ }
return offscreenContext.getGL();
}
}
public void setGL(GL gl) {
if (!hardwareAccelerationDisabled) {
- pbuffer.setGL(gl);
+ if (pbuffer != null) {
+ pbuffer.setGL(gl);
+ }
} else {
- offscreenContext.setGL(gl);
+ if (offscreenContext != null) {
+ offscreenContext.setGL(gl);
+ }
}
}
@@ -382,17 +475,21 @@ public final class GLJPanel extends JPanel implements GLDrawable {
pbufferInitializationCompleted = false;
if (firstTime) {
toplevel.add(heavyweight);
- toplevel.setSize(0, 0);
+ toplevel.setSize(1, 1);
}
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
toplevel.setVisible(true);
} catch (GLException e) {
+ if (DEBUG) {
+ e.printStackTrace();
+ }
disableHardwareRendering();
}
}
});
+ isInitialized = true;
return;
} else {
// If the heavyweight reports that it can't create an
@@ -415,6 +512,8 @@ public final class GLJPanel extends JPanel implements GLDrawable {
}
}, true, initAction);
}
+
+ isInitialized = true;
}
class Updater implements GLEventListener {
@@ -426,10 +525,16 @@ public final class GLJPanel extends JPanel implements GLDrawable {
public void init(GLDrawable drawable) {
if (!hardwareAccelerationDisabled) {
+ if (DEBUG) {
+ System.err.println("GLJPanel$Updater.init(): pbufferInitializationCompleted = true");
+ }
pbufferInitializationCompleted = true;
EventQueue.invokeLater(new Runnable() {
public void run() {
- toplevel.setVisible(false);
+ // Race conditions might dispose of this before now
+ if (toplevel != null) {
+ toplevel.setVisible(false);
+ }
}
});
}
@@ -451,25 +556,27 @@ public final class GLJPanel extends JPanel implements GLDrawable {
int awtFormat = 0;
int hwGLFormat = 0;
if (!hardwareAccelerationDisabled) {
- // Should be more flexible in these BufferedImage formats;
- // perhaps see what the preferred image types are on the
- // given platform
- awtFormat = BufferedImage.TYPE_INT_RGB;
-
// This seems to be a good choice on all platforms
hwGLFormat = GL.GL_UNSIGNED_INT_8_8_8_8_REV;
+ }
+
+ // Should be more flexible in these BufferedImage formats;
+ // perhaps see what the preferred image types are on the
+ // given platform
+ if (isOpaque()) {
+ awtFormat = BufferedImage.TYPE_INT_RGB;
} else {
- awtFormat = offscreenContext.getOffscreenContextBufferedImageType();
+ awtFormat = BufferedImage.TYPE_INT_ARGB;
}
- offscreenImage = new BufferedImage(neededOffscreenImageWidth,
- neededOffscreenImageHeight,
+ offscreenImage = new BufferedImage(panelWidth,
+ panelHeight,
awtFormat);
switch (awtFormat) {
case BufferedImage.TYPE_3BYTE_BGR:
glFormat = GL.GL_BGR;
glType = GL.GL_UNSIGNED_BYTE;
- dbByte = (DataBufferByte) offscreenImage.getRaster().getDataBuffer();
+ readBackBytes = new byte[readBackWidthInPixels * readBackHeightInPixels * 3];
break;
case BufferedImage.TYPE_INT_RGB:
@@ -478,7 +585,7 @@ public final class GLJPanel extends JPanel implements GLDrawable {
glType = (hardwareAccelerationDisabled
? offscreenContext.getOffscreenContextPixelDataType()
: hwGLFormat);
- dbInt = (DataBufferInt) offscreenImage.getRaster().getDataBuffer();
+ readBackInts = new int[readBackWidthInPixels * readBackHeightInPixels];
break;
default:
@@ -501,17 +608,17 @@ public final class GLJPanel extends JPanel implements GLDrawable {
gl.glGetIntegerv(GL.GL_PACK_ALIGNMENT, alignment, 0);
gl.glPixelStorei(GL.GL_PACK_SWAP_BYTES, GL.GL_FALSE);
- gl.glPixelStorei(GL.GL_PACK_ROW_LENGTH, offscreenImage.getWidth());
+ gl.glPixelStorei(GL.GL_PACK_ROW_LENGTH, readBackWidthInPixels);
gl.glPixelStorei(GL.GL_PACK_SKIP_ROWS, 0);
gl.glPixelStorei(GL.GL_PACK_SKIP_PIXELS, 0);
gl.glPixelStorei(GL.GL_PACK_ALIGNMENT, 1);
// Actually read the pixels.
gl.glReadBuffer(GL.GL_FRONT);
- if (dbByte != null) {
- gl.glReadPixels(0, 0, offscreenImage.getWidth(), offscreenImage.getHeight(), glFormat, glType, dbByte.getData(), 0);
- } else if (dbInt != null) {
- gl.glReadPixels(0, 0, offscreenImage.getWidth(), offscreenImage.getHeight(), glFormat, glType, dbInt.getData(), 0);
+ if (readBackBytes != null) {
+ gl.glReadPixels(0, 0, readBackWidthInPixels, readBackHeightInPixels, glFormat, glType, readBackBytes, 0);
+ } else if (readBackInts != null) {
+ gl.glReadPixels(0, 0, readBackWidthInPixels, readBackHeightInPixels, glFormat, glType, readBackInts, 0);
}
// Restore saved modes.
@@ -520,20 +627,46 @@ public final class GLJPanel extends JPanel implements GLDrawable {
gl.glPixelStorei(GL.GL_PACK_SKIP_ROWS, skiprows[0]);
gl.glPixelStorei(GL.GL_PACK_SKIP_PIXELS, skippixels[0]);
gl.glPixelStorei(GL.GL_PACK_ALIGNMENT, alignment[0]);
-
- if (!hardwareAccelerationDisabled ||
- offscreenContext.offscreenImageNeedsVerticalFlip()) {
- // This performs reasonably well; the snippet below does not.
- // Should figure out if we need to set the image scaling
- // preference to FAST since it doesn't require subsampling
- // of pixels -- FIXME
- for (int i = 0; i < panelHeight; i++) {
- g.drawImage(offscreenImage,
- 0, i, panelWidth, i+1,
- 0, panelHeight - i - 1, panelWidth, panelHeight - i,
- GLJPanel.this);
+
+ if (readBackBytes != null || readBackInts != null) {
+ // Copy temporary data into raster of BufferedImage for faster
+ // blitting Note that we could avoid this copy in the cases
+ // where !offscreenContext.offscreenImageNeedsVerticalFlip(),
+ // but that's the software rendering path which is very slow
+ // anyway
+ Object src = null;
+ Object dest = null;
+ int srcIncr = 0;
+ int destIncr = 0;
+
+ if (readBackBytes != null) {
+ src = readBackBytes;
+ dest = ((DataBufferByte) offscreenImage.getRaster().getDataBuffer()).getData();
+ srcIncr = readBackWidthInPixels * 3;
+ destIncr = offscreenImage.getWidth() * 3;
+ } else {
+ src = readBackInts;
+ dest = ((DataBufferInt) offscreenImage.getRaster().getDataBuffer()).getData();
+ srcIncr = readBackWidthInPixels;
+ destIncr = offscreenImage.getWidth();
+ }
+
+ if (!hardwareAccelerationDisabled ||
+ offscreenContext.offscreenImageNeedsVerticalFlip()) {
+ int srcPos = 0;
+ int destPos = (offscreenImage.getHeight() - 1) * destIncr;
+ for (; destPos >= 0; srcPos += srcIncr, destPos -= destIncr) {
+ System.arraycopy(src, srcPos, dest, destPos, destIncr);
+ }
+ } else {
+ int srcPos = 0;
+ int destEnd = destIncr * offscreenImage.getHeight();
+ for (int destPos = 0; destPos < destEnd; srcPos += srcIncr, destPos += destIncr) {
+ System.arraycopy(src, srcPos, dest, destPos, destIncr);
+ }
}
- } else {
+
+ // Draw resulting image in one shot
g.drawImage(offscreenImage, 0, 0, offscreenImage.getWidth(), offscreenImage.getHeight(), GLJPanel.this);
}
}
@@ -577,6 +710,12 @@ public final class GLJPanel extends JPanel implements GLDrawable {
private PaintImmediatelyAction paintImmediatelyAction = new PaintImmediatelyAction();
private int getNextPowerOf2(int number) {
+ // Workaround for problems where 0 width or height are transiently
+ // seen during layout
+ if (number == 0) {
+ return 2;
+ }
+
if (((number-1) & number) == 0) {
//ex: 8 -> 0b1000; 8-1=7 -> 0b0111; 0b1000&0b0111 == 0
return number;
diff --git a/src/net/java/games/jogl/GLPbuffer.java b/src/net/java/games/jogl/GLPbuffer.java
index fe2c19974..b073388f5 100644
--- a/src/net/java/games/jogl/GLPbuffer.java
+++ b/src/net/java/games/jogl/GLPbuffer.java
@@ -20,7 +20,7 @@
* 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
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * 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
@@ -42,10 +42,20 @@ package net.java.games.jogl;
/** Offscreen rendering support via pbuffers. This class adds very
little functionality over the GLDrawable class; the only methods
are those which allow access to the pbuffer's contents as a
- texture map. These methods are currently highly experimental and
- may be removed in a future release. */
+ texture map and which enable offscreen rendering to floating-point
+ buffers. These methods are currently highly experimental and may
+ be removed in a future release. */
public interface GLPbuffer extends GLDrawable {
+ /** Indicates the GL_APPLE_float_pixels extension is being used for this pbuffer. */
+ public static final int APPLE_FLOAT = 1;
+
+ /** Indicates the GL_ATI_texture_float extension is being used for this pbuffer. */
+ public static final int ATI_FLOAT = 2;
+
+ /** Indicates the GL_NV_float_buffer extension is being used for this pbuffer. */
+ public static final int NV_FLOAT = 3;
+
/** Binds this pbuffer to its internal texture target. Only valid to
call if offscreen render-to-texture has been specified in the
GLCapabilities for this GLPbuffer. If the
@@ -68,4 +78,13 @@ public interface GLPbuffer extends GLDrawable {
is not valid to call display() or any other routines on this
pbuffer after it has been destroyed. */
public void destroy();
+
+ /** Indicates which vendor's extension is being used to support
+ floating point channels in this pbuffer if that capability was
+ requested in the GLCapabilities during pbuffer creation. Returns
+ one of NV_FLOAT, ATI_FLOAT or APPLE_FLOAT, or throws GLException
+ if floating-point channels were not requested for this pbuffer.
+ This function may only be called once the init method for this
+ pbuffer's GLEventListener has been called. */
+ public int getFloatingPointMode();
}
diff --git a/src/net/java/games/jogl/Version.java b/src/net/java/games/jogl/Version.java
index 0d64614e2..7d28f7fc8 100644
--- a/src/net/java/games/jogl/Version.java
+++ b/src/net/java/games/jogl/Version.java
@@ -89,11 +89,11 @@ public final class Version {
/**
* Version string of this build.
*/
- private static final String version = "1.1.0-b11";
+ private static final String version = "1.1.1";
/**
- * Returns the verison string and build number of
- * this implementation. See the class descritpion
+ * Returns the version string and build number of
+ * this implementation. See the class description
* for the version string format.
*
* @return The version string of this implementation.
diff --git a/src/net/java/games/jogl/impl/Debug.java b/src/net/java/games/jogl/impl/Debug.java
index 0082899ac..164c5afbd 100755
--- a/src/net/java/games/jogl/impl/Debug.java
+++ b/src/net/java/games/jogl/impl/Debug.java
@@ -20,7 +20,7 @@
* 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
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * 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
diff --git a/src/net/java/games/jogl/impl/FunctionAvailabilityCache.java b/src/net/java/games/jogl/impl/FunctionAvailabilityCache.java
index a4b67b5e8..be5e26067 100644
--- a/src/net/java/games/jogl/impl/FunctionAvailabilityCache.java
+++ b/src/net/java/games/jogl/impl/FunctionAvailabilityCache.java
@@ -20,7 +20,7 @@
* 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
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * 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
@@ -179,7 +179,7 @@ public final class FunctionAvailabilityCache {
catch (IllegalArgumentException e)
{
// funcCoreVersionString is not an OpenGL version identifier (i.e., not
- // of the form GL_VERSION_XXX).
+ // of the form GL_VERSION_XXX or X.Y).
//
// Since the association string returned from
// StaticGLInfo.getFunctionAssociation() was not null, this function
@@ -206,15 +206,19 @@ public final class FunctionAvailabilityCache {
// belongs.
if (actualVersion.compareTo(versionToCheck) <= 0)
{
- System.err.println(
- glFunctionName + " is in core OpenGL " + glVersionString +
- " because it is in OpenGL " + funcCoreVersionString);
+ if (DEBUG) {
+ System.err.println(
+ glFunctionName + " is in core OpenGL " + glVersionString +
+ " because it is in OpenGL " + funcCoreVersionString);
+ }
return true;
}
- System.err.println(
- glFunctionName + " is NOT a part of the OpenGL " + glVersionString + " core" +
- "; it is part of OpenGL " + funcCoreVersionString);
+ if (DEBUG) {
+ System.err.println(
+ glFunctionName + " is NOT a part of the OpenGL " + glVersionString + " core" +
+ "; it is part of OpenGL " + funcCoreVersionString);
+ }
return false;
}
@@ -256,33 +260,35 @@ public final class FunctionAvailabilityCache {
/**
* @param versionString must be of the form "GL_VERSION_X" or
- * "GL_VERSION_X_Y" or "GL_VERSION_X_Y_Z", where X, Y, and Z are integers.
+ * "GL_VERSION_X_Y" or "GL_VERSION_X_Y_Z" or "X.Y", where X, Y,
+ * and Z are integers.
*
* @exception IllegalArgumentException if the argument is not a valid
* OpenGL version identifier
*/
public Version(String versionString)
{
- if (! versionString.startsWith("GL_VERSION_"))
+ try
{
- // not a version string
- throw new IllegalArgumentException(
- "Illegal version identifier \"" + versionString +
- "\"; does not start with \"GL_VERSION_\"");
- }
-
- try
- {
- StringTokenizer tok = new StringTokenizer(versionString, "_");
+ if (versionString.startsWith("GL_VERSION_"))
+ {
+ StringTokenizer tok = new StringTokenizer(versionString, "_");
- tok.nextToken(); // GL_
- tok.nextToken(); // VERSION_
- if (!tok.hasMoreTokens()) { major = 0; return; }
- major = Integer.valueOf(tok.nextToken()).intValue();
- if (!tok.hasMoreTokens()) { minor = 0; return; }
- minor = Integer.valueOf(tok.nextToken()).intValue();
- if (!tok.hasMoreTokens()) { sub = 0; return; }
- sub = Integer.valueOf(tok.nextToken()).intValue();
+ tok.nextToken(); // GL_
+ tok.nextToken(); // VERSION_
+ if (!tok.hasMoreTokens()) { major = 0; return; }
+ major = Integer.valueOf(tok.nextToken()).intValue();
+ if (!tok.hasMoreTokens()) { minor = 0; return; }
+ minor = Integer.valueOf(tok.nextToken()).intValue();
+ if (!tok.hasMoreTokens()) { sub = 0; return; }
+ sub = Integer.valueOf(tok.nextToken()).intValue();
+ }
+ else
+ {
+ StringTokenizer tok = new StringTokenizer(versionString, ". ");
+ major = Integer.valueOf(tok.nextToken()).intValue();
+ minor = Integer.valueOf(tok.nextToken()).intValue();
+ }
}
catch (Exception e)
{
diff --git a/src/net/java/games/jogl/impl/GLContext.java b/src/net/java/games/jogl/impl/GLContext.java
index 318ff24a2..41fa98c4b 100644
--- a/src/net/java/games/jogl/impl/GLContext.java
+++ b/src/net/java/games/jogl/impl/GLContext.java
@@ -20,7 +20,7 @@
* 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
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * 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
@@ -45,6 +45,8 @@ import net.java.games.gluegen.runtime.*;
public abstract class GLContext {
protected static final boolean DEBUG = Debug.debug("GLContext");
+ protected static final boolean VERBOSE = Debug.verbose();
+ protected static final boolean NO_FREE = Debug.isPropertyDefined("jogl.GLContext.nofree");
static {
NativeLibLoader.load();
@@ -237,8 +239,8 @@ public abstract class GLContext {
if (mustDoMakeCurrent) {
if (curContext != null) {
- if (DEBUG) {
- System.err.println("Freeing context " + curContext + " due to recursive makeCurrent");
+ if (DEBUG && VERBOSE) {
+ System.err.println(getThreadName() + ": Freeing context " + curContext + " due to recursive makeCurrent");
}
curContext.free();
}
@@ -262,8 +264,8 @@ public abstract class GLContext {
}
return;
}
- if (DEBUG) {
- System.err.println("Making context " + this + " current");
+ if (DEBUG && VERBOSE) {
+ System.err.println(getThreadName() + ": Making context " + this + " current");
}
}
ctxStack.push(this, initAction);
@@ -314,8 +316,8 @@ public abstract class GLContext {
// Free the context unless the setRenderingThread optimization
// kicks in.
if (mustDoMakeCurrent && !mustSkipFreeForRenderingThread) {
- if (DEBUG) {
- System.err.println("Freeing context " + this);
+ if (DEBUG && VERBOSE) {
+ System.err.println(getThreadName() + ": Freeing context " + this);
}
try {
@@ -325,8 +327,8 @@ public abstract class GLContext {
}
if (curContext != null) {
- if (DEBUG) {
- System.err.println("Making context " + curContext + " current again");
+ if (DEBUG && VERBOSE) {
+ System.err.println(getThreadName() + ": Making context " + curContext + " current again");
}
try {
curContext.makeCurrent(curInitAction);
@@ -472,6 +474,13 @@ public abstract class GLContext {
pendingOffscreenHeight = newHeight;
}
+ /** Indicates which floating-point pbuffer implementation is in
+ use. Returns one of GLPbuffer.APPLE_FLOAT, GLPbuffer.ATI_FLOAT,
+ or GLPbuffer.NV_FLOAT. */
+ public int getFloatingPointMode() throws GLException {
+ throw new GLException("Not supported on non-pbuffer contexts");
+ }
+
/** Returns a non-null (but possibly empty) string containing the
space-separated list of available platform-dependent (e.g., WGL,
GLX) extensions. Can only be called while this context is
@@ -484,10 +493,16 @@ public abstract class GLContext {
* the definition of "available".
*/
protected void resetGLFunctionAvailability() {
+ // In order to be able to allow the user to uniformly install the
+ // debug and trace pipelines in their GLEventListener.init()
+ // method (for both GLCanvas and GLJPanel), we need to reset the
+ // actual GL object in the GLDrawable as well
+ setGL(createGL());
+
functionAvailability.flush();
if (!haveResetGLUProcAddressTable) {
if (DEBUG) {
- System.err.println("!!! Initializing GLU extension address table");
+ System.err.println(getThreadName() + ": !!! Initializing GLU extension address table");
}
resetProcAddressTable(gluProcAddressTable);
haveResetGLUProcAddressTable = true; // Only need to do this once globally
@@ -578,10 +593,6 @@ public abstract class GLContext {
requests. */
protected abstract boolean isOffscreen();
- /** Only called for offscreen contexts; returns the type of
- BufferedImage required for reading this context's pixels. */
- public abstract int getOffscreenContextBufferedImageType();
-
/** Only called for offscreen contexts; returns the buffer from
which to read pixels (GL.GL_FRONT or GL.GL_BACK). */
public abstract int getOffscreenContextReadBuffer();
@@ -633,7 +644,7 @@ public abstract class GLContext {
protected synchronized void setRealized(boolean realized) {
this.realized = realized;
if (DEBUG) {
- System.err.println("GLContext.setRealized(" + realized + ") for context " + this);
+ System.err.println(getThreadName() + ": GLContext.setRealized(" + realized + ") for context " + this);
}
}
@@ -649,6 +660,9 @@ public abstract class GLContext {
public synchronized void destroy() throws GLException {
if (getRenderingThread() != null &&
Thread.currentThread() != getRenderingThread()) {
+ if (DEBUG) {
+ System.err.println(getThreadName() + ": Deferred destroy for context " + this);
+ }
deferredDestroy = true;
return;
}
@@ -743,4 +757,8 @@ public abstract class GLContext {
}
}
}
+
+ protected static String getThreadName() {
+ return Thread.currentThread().getName();
+ }
}
diff --git a/src/net/java/games/jogl/impl/GLContextFactory.java b/src/net/java/games/jogl/impl/GLContextFactory.java
index 4aa23c397..40a90f883 100644
--- a/src/net/java/games/jogl/impl/GLContextFactory.java
+++ b/src/net/java/games/jogl/impl/GLContextFactory.java
@@ -20,7 +20,7 @@
* 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
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * 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
diff --git a/src/net/java/games/jogl/impl/GLContextInitActionPair.java b/src/net/java/games/jogl/impl/GLContextInitActionPair.java
index ed2e78ac8..379dda3ee 100755
--- a/src/net/java/games/jogl/impl/GLContextInitActionPair.java
+++ b/src/net/java/games/jogl/impl/GLContextInitActionPair.java
@@ -20,7 +20,7 @@
* 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
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * 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
diff --git a/src/net/java/games/jogl/impl/GLContextShareSet.java b/src/net/java/games/jogl/impl/GLContextShareSet.java
index 73ee86499..60c6b7d59 100644
--- a/src/net/java/games/jogl/impl/GLContextShareSet.java
+++ b/src/net/java/games/jogl/impl/GLContextShareSet.java
@@ -20,7 +20,7 @@
* 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
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * 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
diff --git a/src/net/java/games/jogl/impl/GLContextStack.java b/src/net/java/games/jogl/impl/GLContextStack.java
index dd80b0804..089d53525 100755
--- a/src/net/java/games/jogl/impl/GLContextStack.java
+++ b/src/net/java/games/jogl/impl/GLContextStack.java
@@ -20,7 +20,7 @@
* 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
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * 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
diff --git a/src/net/java/games/jogl/impl/GLDrawableHelper.java b/src/net/java/games/jogl/impl/GLDrawableHelper.java
index 775fffdd6..dd5d7c17f 100644
--- a/src/net/java/games/jogl/impl/GLDrawableHelper.java
+++ b/src/net/java/games/jogl/impl/GLDrawableHelper.java
@@ -20,7 +20,7 @@
* 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
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * 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
diff --git a/src/net/java/games/jogl/impl/GLPbufferImpl.java b/src/net/java/games/jogl/impl/GLPbufferImpl.java
index be0f23398..7b17c3010 100644
--- a/src/net/java/games/jogl/impl/GLPbufferImpl.java
+++ b/src/net/java/games/jogl/impl/GLPbufferImpl.java
@@ -20,7 +20,7 @@
* 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
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * 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
@@ -56,6 +56,7 @@ public class GLPbufferImpl implements GLPbuffer {
private GLContext context;
private GLDrawableHelper drawableHelper = new GLDrawableHelper();
private boolean isInitialized=false;
+ private int floatMode;
public GLPbufferImpl(GLContext context) {
this.context = context;
@@ -207,6 +208,13 @@ public class GLPbufferImpl implements GLPbuffer {
context.destroy();
}
+ public int getFloatingPointMode() {
+ if (floatMode == 0) {
+ throw new GLException("Pbuffer not initialized, or floating-point support not requested");
+ }
+ return floatMode;
+ }
+
//----------------------------------------------------------------------
// Internals only below this point
//
@@ -237,8 +245,9 @@ public class GLPbufferImpl implements GLPbuffer {
class InitAction implements Runnable {
public void run() {
- drawableHelper.init(GLPbufferImpl.this);
isInitialized=true;
+ floatMode = context.getFloatingPointMode();
+ drawableHelper.init(GLPbufferImpl.this);
}
}
private InitAction initAction = new InitAction();
diff --git a/src/net/java/games/jogl/impl/GLUquadricImpl.java b/src/net/java/games/jogl/impl/GLUquadricImpl.java
index cd5f3df36..dfc167dcb 100755
--- a/src/net/java/games/jogl/impl/GLUquadricImpl.java
+++ b/src/net/java/games/jogl/impl/GLUquadricImpl.java
@@ -89,7 +89,7 @@
* 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
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * 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
diff --git a/src/net/java/games/jogl/impl/InternalBufferUtils.java b/src/net/java/games/jogl/impl/InternalBufferUtils.java
index 707ebbe93..7ae5efb0e 100644
--- a/src/net/java/games/jogl/impl/InternalBufferUtils.java
+++ b/src/net/java/games/jogl/impl/InternalBufferUtils.java
@@ -20,7 +20,7 @@
* 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
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * 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
diff --git a/src/net/java/games/jogl/impl/JAWT_PlatformInfo.java b/src/net/java/games/jogl/impl/JAWT_PlatformInfo.java
index 64da83ec4..55eb43d42 100644
--- a/src/net/java/games/jogl/impl/JAWT_PlatformInfo.java
+++ b/src/net/java/games/jogl/impl/JAWT_PlatformInfo.java
@@ -20,7 +20,7 @@
* 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
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * 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
diff --git a/src/net/java/games/jogl/impl/NativeLibLoader.java b/src/net/java/games/jogl/impl/NativeLibLoader.java
index 0c2420955..54d37f6ce 100644
--- a/src/net/java/games/jogl/impl/NativeLibLoader.java
+++ b/src/net/java/games/jogl/impl/NativeLibLoader.java
@@ -20,7 +20,7 @@
* 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
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * 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
diff --git a/src/net/java/games/jogl/impl/Project.java b/src/net/java/games/jogl/impl/Project.java
index e0bb03190..41cf9d45e 100755
--- a/src/net/java/games/jogl/impl/Project.java
+++ b/src/net/java/games/jogl/impl/Project.java
@@ -89,7 +89,7 @@
* 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
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * 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
diff --git a/src/net/java/games/jogl/impl/SingleThreadedWorkaround.java b/src/net/java/games/jogl/impl/SingleThreadedWorkaround.java
index ff79b5c6e..f19c1fb67 100755
--- a/src/net/java/games/jogl/impl/SingleThreadedWorkaround.java
+++ b/src/net/java/games/jogl/impl/SingleThreadedWorkaround.java
@@ -20,7 +20,7 @@
* 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
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * 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
diff --git a/src/net/java/games/jogl/impl/Util.java b/src/net/java/games/jogl/impl/Util.java
index 1b2f9ed9f..712da596b 100755
--- a/src/net/java/games/jogl/impl/Util.java
+++ b/src/net/java/games/jogl/impl/Util.java
@@ -52,7 +52,7 @@
* 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
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * 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
diff --git a/src/net/java/games/jogl/impl/macosx/MacOSXDummyGLContext.java b/src/net/java/games/jogl/impl/macosx/MacOSXDummyGLContext.java
index 9b8f02660..29a3ef63b 100644
--- a/src/net/java/games/jogl/impl/macosx/MacOSXDummyGLContext.java
+++ b/src/net/java/games/jogl/impl/macosx/MacOSXDummyGLContext.java
@@ -20,7 +20,7 @@
* 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
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * 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
@@ -66,10 +66,6 @@ class MacOSXDummyGLContext extends MacOSXGLContext
return false;
}
- public int getOffscreenContextBufferedImageType() {
- throw new GLException("Should not call this");
- }
-
public int getOffscreenContextReadBuffer() {
throw new GLException("Should not call this");
}
@@ -106,7 +102,7 @@ class MacOSXDummyGLContext extends MacOSXGLContext
throw new GLException("Should not call this");
}
- protected void create() {
+ protected boolean create() {
throw new GLException("Should not call this");
}
diff --git a/src/net/java/games/jogl/impl/macosx/MacOSXGLContext.java b/src/net/java/games/jogl/impl/macosx/MacOSXGLContext.java
index cfa5c3d99..ec58de9a6 100644
--- a/src/net/java/games/jogl/impl/macosx/MacOSXGLContext.java
+++ b/src/net/java/games/jogl/impl/macosx/MacOSXGLContext.java
@@ -20,7 +20,7 @@
* 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
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * 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
@@ -93,10 +93,6 @@ public abstract class MacOSXGLContext extends GLContext
protected abstract boolean isOffscreen();
- public int getOffscreenContextBufferedImageType() {
- throw new GLException("Should not call this");
- }
-
public int getOffscreenContextReadBuffer() {
throw new GLException("Should not call this");
}
@@ -117,11 +113,15 @@ public abstract class MacOSXGLContext extends GLContext
throw new GLException("Should not call this");
}
+ protected boolean create() {
+ return create(false, false);
+ }
+
/**
* Creates and initializes an appropriate OpenGl nsContext. Should only be
* called by {@link makeCurrent(Runnable)}.
*/
- protected void create() {
+ protected boolean create(boolean pbuffer, boolean floatingPoint) {
MacOSXGLContext other = (MacOSXGLContext) GLContextShareSet.getShareContext(this);
long share = 0;
if (other != null) {
@@ -130,9 +130,11 @@ public abstract class MacOSXGLContext extends GLContext
throw new GLException("GLContextShareSet returned an invalid OpenGL context");
}
}
+ int[] viewNotReady = new int[1];
nsContext = CGL.createContext(share,
nsView,
capabilities.getDoubleBuffered() ? 1 : 0,
+ capabilities.getStereo() ? 1 : 0,
capabilities.getRedBits(),
capabilities.getGreenBits(),
capabilities.getBlueBits(),
@@ -144,18 +146,31 @@ public abstract class MacOSXGLContext extends GLContext
capabilities.getAccumBlueBits(),
capabilities.getAccumAlphaBits(),
capabilities.getSampleBuffers() ? 1 : 0,
- capabilities.getNumSamples());
+ capabilities.getNumSamples(),
+ (pbuffer ? 1 : 0),
+ (floatingPoint ? 1 : 0),
+ viewNotReady);
if (nsContext == 0) {
+ if (viewNotReady[0] == 1) {
+ if (DEBUG) {
+ System.err.println("!!! View not ready for " + getClass().getName());
+ }
+ // View not ready at the window system level -- this is OK
+ return false;
+ }
throw new GLException("Error creating nsContext");
}
//updater = CGL.updateContextRegister(nsContext, nsView); // gznote: not thread safe yet!
GLContextShareSet.contextCreated(this);
+ return true;
}
protected synchronized boolean makeCurrent(Runnable initAction) throws GLException {
boolean created = false;
if (nsContext == 0) {
- create();
+ if (!create()) {
+ return false;
+ }
if (DEBUG) {
System.err.println("!!! Created GL nsContext for " + getClass().getName());
}
diff --git a/src/net/java/games/jogl/impl/macosx/MacOSXGLContextFactory.java b/src/net/java/games/jogl/impl/macosx/MacOSXGLContextFactory.java
index 3e08c9b67..25f15b3f2 100644
--- a/src/net/java/games/jogl/impl/macosx/MacOSXGLContextFactory.java
+++ b/src/net/java/games/jogl/impl/macosx/MacOSXGLContextFactory.java
@@ -20,7 +20,7 @@
* 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
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * 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
diff --git a/src/net/java/games/jogl/impl/macosx/MacOSXOffscreenGLContext.java b/src/net/java/games/jogl/impl/macosx/MacOSXOffscreenGLContext.java
index 3ba7b108a..37b2302c0 100644
--- a/src/net/java/games/jogl/impl/macosx/MacOSXOffscreenGLContext.java
+++ b/src/net/java/games/jogl/impl/macosx/MacOSXOffscreenGLContext.java
@@ -20,7 +20,7 @@
* 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
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * 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
@@ -59,10 +59,6 @@ public class MacOSXOffscreenGLContext extends MacOSXPbufferGLContext
return true;
}
- public int getOffscreenContextBufferedImageType() {
- return BufferedImage.TYPE_INT_ARGB;
- }
-
public int getOffscreenContextWidth() {
return initWidth;
}
diff --git a/src/net/java/games/jogl/impl/macosx/MacOSXOnscreenGLContext.java b/src/net/java/games/jogl/impl/macosx/MacOSXOnscreenGLContext.java
index 401a657fe..ba4eee0ef 100644
--- a/src/net/java/games/jogl/impl/macosx/MacOSXOnscreenGLContext.java
+++ b/src/net/java/games/jogl/impl/macosx/MacOSXOnscreenGLContext.java
@@ -20,7 +20,7 @@
* 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
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * 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
@@ -70,10 +70,6 @@ public class MacOSXOnscreenGLContext extends MacOSXGLContext {
return false;
}
- public int getOffscreenContextBufferedImageType() {
- throw new GLException("Should not call this");
- }
-
public int getOffscreenContextReadBuffer() {
throw new GLException("Should not call this");
}
@@ -131,6 +127,9 @@ public class MacOSXOnscreenGLContext extends MacOSXGLContext {
(MacOSXPbufferGLContext) pbuffersToInstantiate.remove(pbuffersToInstantiate.size() - 1);
ctx.createPbuffer(nsView, nsContext);
}
+ } else {
+ // View might not have been ready
+ unlockSurface();
}
return ret;
} catch (RuntimeException e) {
diff --git a/src/net/java/games/jogl/impl/macosx/MacOSXPbufferGLContext.java b/src/net/java/games/jogl/impl/macosx/MacOSXPbufferGLContext.java
index 8e65ce1f3..93bde269b 100644
--- a/src/net/java/games/jogl/impl/macosx/MacOSXPbufferGLContext.java
+++ b/src/net/java/games/jogl/impl/macosx/MacOSXPbufferGLContext.java
@@ -1,10 +1,27 @@
package net.java.games.jogl.impl.macosx;
+import java.security.*;
+import java.util.*;
+
import net.java.games.jogl.*;
import net.java.games.jogl.impl.*;
public class MacOSXPbufferGLContext extends MacOSXGLContext {
private static final boolean DEBUG = Debug.debug("MacOSXPbufferGLContext");
+ private static boolean isTigerOrLater;
+
+ static {
+ String osVersion =
+ (String) AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ return System.getProperty("os.version");
+ }
+ });
+ StringTokenizer tok = new StringTokenizer(osVersion, ". ");
+ int major = Integer.parseInt(tok.nextToken());
+ int minor = Integer.parseInt(tok.nextToken());
+ isTigerOrLater = ((major > 10) || (minor > 3));
+ }
protected int initWidth;
protected int initHeight;
@@ -64,14 +81,26 @@ public class MacOSXPbufferGLContext extends MacOSXGLContext {
height = getNextPowerOf2(initHeight);
renderTarget = GL.GL_TEXTURE_2D;
}
+
+ int internalFormat = GL.GL_RGBA;
+ if (capabilities.getOffscreenFloatingPointBuffers()) {
+ if (!gl.isExtensionAvailable("GL_APPLE_float_pixels")) {
+ throw new GLException("Floating-point support (GL_APPLE_float_pixels) not available");
+ }
+ switch (capabilities.getRedBits()) {
+ case 16: internalFormat = GL.GL_RGBA_FLOAT16_APPLE; break;
+ case 32: internalFormat = GL.GL_RGBA_FLOAT32_APPLE; break;
+ default: throw new GLException("Invalid floating-point bit depth (only 16 and 32 supported)");
+ }
+ }
- this.pBuffer = CGL.createPBuffer(renderTarget, width, height);
- if (this.pBuffer == 0) {
+ pBuffer = CGL.createPBuffer(renderTarget, internalFormat, width, height);
+ if (pBuffer == 0) {
throw new GLException("pbuffer creation error: CGL.createPBuffer() failed");
}
if (DEBUG) {
- System.err.println("Created pbuffer " + width + " x " + height);
+ System.err.println("Created pbuffer 0x" + Long.toHexString(pBuffer) + ", " + width + " x " + height + " for " + this);
}
}
@@ -79,6 +108,9 @@ public class MacOSXPbufferGLContext extends MacOSXGLContext {
created = false;
if (pBuffer == 0) {
+ if (DEBUG) {
+ System.err.println("Pbuffer not instantiated yet for " + this);
+ }
// pbuffer not instantiated yet
return false;
}
@@ -138,6 +170,10 @@ public class MacOSXPbufferGLContext extends MacOSXGLContext {
// FIXME: do we need to do anything if the pbuffer is double-buffered?
}
+ public int getFloatingPointMode() {
+ return GLPbuffer.APPLE_FLOAT;
+ }
+
private int getNextPowerOf2(int number) {
if (((number-1) & number) == 0) {
//ex: 8 -> 0b1000; 8-1=7 -> 0b0111; 0b1000&0b0111 == 0
@@ -151,10 +187,17 @@ public class MacOSXPbufferGLContext extends MacOSXGLContext {
return (1<<power);
}
- protected void create() {
- super.create();
+ protected boolean create() {
+ if (capabilities.getOffscreenFloatingPointBuffers() &&
+ !isTigerOrLater) {
+ throw new GLException("Floating-point pbuffers supported only on OS X 10.4 or later");
+ }
+ if (!super.create(true, capabilities.getOffscreenFloatingPointBuffers())) {
+ return false;
+ }
created = true;
// Must now associate the pbuffer with our newly-created context
CGL.setContextPBuffer(nsContext, pBuffer);
+ return true;
}
}
diff --git a/src/net/java/games/jogl/impl/mipmap/BuildMipmap.java b/src/net/java/games/jogl/impl/mipmap/BuildMipmap.java
index 6a8a0b08d..9c9c3122b 100644
--- a/src/net/java/games/jogl/impl/mipmap/BuildMipmap.java
+++ b/src/net/java/games/jogl/impl/mipmap/BuildMipmap.java
@@ -306,12 +306,13 @@ public class BuildMipmap {
if( baseLevel <= level && level <= maxLevel ) {
gl.glTexImage2D( target, level, internalFormat, width, height, 0, format, type, data );
}
- if( levels == 0 ) {
+ if( levels == 0 ) { /* we're done. clean up and return */
gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() );
gl.glPixelStorei( GL.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() );
gl.glPixelStorei( GL.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() );
gl.glPixelStorei( GL.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() );
gl.glPixelStorei( GL.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) );
+ return( 0 );
}
int nextWidth = newwidth / 2;
int nextHeight = newheight / 2;
@@ -1055,7 +1056,7 @@ public class BuildMipmap {
gl.glTexImage3D( target, level, internalFormat, width, height, depth,
0, format, type, usersImage );
}
- if( levels == 0 ) {
+ if( levels == 0 ) { /* we're done. clean up and return */
gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() );
gl.glPixelStorei( GL.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() );
gl.glPixelStorei( GL.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() );
diff --git a/src/net/java/games/jogl/impl/mipmap/Mipmap.java b/src/net/java/games/jogl/impl/mipmap/Mipmap.java
index 63cf760e2..052d39fa2 100644
--- a/src/net/java/games/jogl/impl/mipmap/Mipmap.java
+++ b/src/net/java/games/jogl/impl/mipmap/Mipmap.java
@@ -36,6 +36,7 @@ package net.java.games.jogl.impl.mipmap;
import net.java.games.jogl.GL;
import net.java.games.jogl.GLU;
+import net.java.games.jogl.GLException;
import java.nio.*;
/**
@@ -244,52 +245,60 @@ public class Mipmap {
int[] proxyWidth = new int[1];
boolean noProxyTextures = false;
- do {
- // compute level 1 width & height, clamping each at 1
- int widthAtLevelOne = ( ( width > 1 ) ? (widthPowerOf2 >> 1) : widthPowerOf2 );
- int heightAtLevelOne = ( ( height > 1 ) ? (heightPowerOf2 >> 1) : heightPowerOf2 );
- int proxyTarget;
+ // Some drivers (in particular, ATI's) seem to set a GL error
+ // when proxy textures are used even though this is in violation
+ // of the spec. Guard against this and interactions with the
+ // DebugGL by watching for GLException.
+ try {
+ do {
+ // compute level 1 width & height, clamping each at 1
+ int widthAtLevelOne = ( ( width > 1 ) ? (widthPowerOf2 >> 1) : widthPowerOf2 );
+ int heightAtLevelOne = ( ( height > 1 ) ? (heightPowerOf2 >> 1) : heightPowerOf2 );
+ int proxyTarget;
- assert( widthAtLevelOne > 0 );
- assert( heightAtLevelOne > 0 );
+ assert( widthAtLevelOne > 0 );
+ assert( heightAtLevelOne > 0 );
- // does width x height at level 1 & all their mipmaps fit?
- if( target == GL.GL_TEXTURE_2D || target == GL.GL_PROXY_TEXTURE_2D ) {
- proxyTarget = GL.GL_PROXY_TEXTURE_2D;
- gl.glTexImage2D( proxyTarget, 1, internalFormat, widthAtLevelOne,
- heightAtLevelOne, 0, format, type, (double[])null, 0);
- } else if( (target == GL.GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB) ||
- (target == GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB) ||
- (target == GL.GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB) ||
- (target == GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB) ||
- (target == GL.GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB) ||
- (target == GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) ) {
- proxyTarget = GL.GL_PROXY_TEXTURE_CUBE_MAP_ARB;
- gl.glTexImage2D( proxyTarget, 1, internalFormat, widthAtLevelOne,
- heightAtLevelOne, 0, format, type, (double[])null , 0);
- } else {
- assert( target == GL.GL_TEXTURE_1D || target == GL.GL_PROXY_TEXTURE_1D );
- proxyTarget = GL.GL_PROXY_TEXTURE_1D;
- gl.glTexImage1D( proxyTarget, 1, internalFormat, widthAtLevelOne,
- 0, format, type, (double[])null, 0);
- }
- gl.glGetTexLevelParameteriv( proxyTarget, 1, GL.GL_TEXTURE_WIDTH, proxyWidth, 0 );
- // does it fit?
- if( proxyWidth[0] == 0 ) { // nope, so try again with theses sizes
- if( widthPowerOf2 == 1 && heightPowerOf2 == 1 ) {
- /* A 1x1 texture couldn't fit for some reason so break out. This
- * should never happen. But things happen. The disadvantage with
- * this if-statement is that we will never be aware of when this
- * happens since it will silently branch out.
- */
- noProxyTextures = true;
- break;
+ // does width x height at level 1 & all their mipmaps fit?
+ if( target == GL.GL_TEXTURE_2D || target == GL.GL_PROXY_TEXTURE_2D ) {
+ proxyTarget = GL.GL_PROXY_TEXTURE_2D;
+ gl.glTexImage2D( proxyTarget, 1, internalFormat, widthAtLevelOne,
+ heightAtLevelOne, 0, format, type, (double[])null, 0 );
+ } else if( (target == GL.GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB) ||
+ (target == GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB) ||
+ (target == GL.GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB) ||
+ (target == GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB) ||
+ (target == GL.GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB) ||
+ (target == GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) ) {
+ proxyTarget = GL.GL_PROXY_TEXTURE_CUBE_MAP_ARB;
+ gl.glTexImage2D( proxyTarget, 1, internalFormat, widthAtLevelOne,
+ heightAtLevelOne, 0, format, type, (double[])null, 0 );
+ } else {
+ assert( target == GL.GL_TEXTURE_1D || target == GL.GL_PROXY_TEXTURE_1D );
+ proxyTarget = GL.GL_PROXY_TEXTURE_1D;
+ gl.glTexImage1D( proxyTarget, 1, internalFormat, widthAtLevelOne,
+ 0, format, type, (double[])null, 0 );
}
- widthPowerOf2 = widthAtLevelOne;
- heightPowerOf2 = heightAtLevelOne;
- }
- // else it doese fit
- } while( proxyWidth[0] == 0 );
+ gl.glGetTexLevelParameteriv( proxyTarget, 1, GL.GL_TEXTURE_WIDTH, proxyWidth, 0 );
+ // does it fit?
+ if( proxyWidth[0] == 0 ) { // nope, so try again with theses sizes
+ if( widthPowerOf2 == 1 && heightPowerOf2 == 1 ) {
+ /* A 1x1 texture couldn't fit for some reason so break out. This
+ * should never happen. But things happen. The disadvantage with
+ * this if-statement is that we will never be aware of when this
+ * happens since it will silently branch out.
+ */
+ noProxyTextures = true;
+ break;
+ }
+ widthPowerOf2 = widthAtLevelOne;
+ heightPowerOf2 = heightAtLevelOne;
+ }
+ // else it does fit
+ } while( proxyWidth[0] == 0 );
+ } catch (GLException e) {
+ noProxyTextures = true;
+ }
// loop must terminate
// return the width & height at level 0 that fits
if( !noProxyTextures ) {
diff --git a/src/net/java/games/jogl/impl/windows/WindowsGLContext.java b/src/net/java/games/jogl/impl/windows/WindowsGLContext.java
index 37a3f5359..e838c68aa 100644
--- a/src/net/java/games/jogl/impl/windows/WindowsGLContext.java
+++ b/src/net/java/games/jogl/impl/windows/WindowsGLContext.java
@@ -20,7 +20,7 @@
* 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
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * 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
@@ -106,8 +106,6 @@ public abstract class WindowsGLContext extends GLContext {
protected abstract boolean isOffscreen();
- public abstract int getOffscreenContextBufferedImageType();
-
public int getOffscreenContextWidth() {
throw new GLException("Should not call this");
}
@@ -135,17 +133,29 @@ public abstract class WindowsGLContext extends GLContext {
if (hglrc == 0) {
create();
if (DEBUG) {
- System.err.println("!!! Created GL context for " + getClass().getName());
+ System.err.println(getThreadName() + ": !!! Created GL context for " + getClass().getName());
}
created = true;
}
- if (!WGL.wglMakeCurrent(hdc, hglrc)) {
- throw new GLException("Error making context current: " + WGL.GetLastError());
- } else {
- if (DEBUG) {
- System.err.println("wglMakeCurrent(hdc " + hdcToString(hdc) +
- ", hglrc " + hdcToString(hglrc) + ") succeeded");
+ boolean skipMakeCurrent = false;
+ if (NO_FREE) {
+ if (WGL.wglGetCurrentContext() == hglrc) {
+ if (DEBUG && VERBOSE) {
+ System.err.println(getThreadName() + ": skipping wglMakeCurrent because context already current");
+ }
+ skipMakeCurrent = true;
+ }
+ }
+
+ if (!skipMakeCurrent) {
+ if (!WGL.wglMakeCurrent(hdc, hglrc)) {
+ throw new GLException("Error making context current: " + WGL.GetLastError());
+ } else {
+ if (DEBUG && VERBOSE) {
+ System.err.println(getThreadName() + ": wglMakeCurrent(hdc " + hdcToString(hdc) +
+ ", hglrc " + hdcToString(hglrc) + ") succeeded");
+ }
}
}
@@ -174,8 +184,10 @@ public abstract class WindowsGLContext extends GLContext {
}
protected synchronized void free() throws GLException {
- if (!WGL.wglMakeCurrent(0, 0)) {
- throw new GLException("Error freeing OpenGL context: " + WGL.GetLastError());
+ if (!NO_FREE) {
+ if (!WGL.wglMakeCurrent(0, 0)) {
+ throw new GLException("Error freeing OpenGL context: " + WGL.GetLastError());
+ }
}
}
@@ -185,7 +197,7 @@ public abstract class WindowsGLContext extends GLContext {
throw new GLException("Unable to delete OpenGL context");
}
if (DEBUG) {
- System.err.println("!!! Destroyed OpenGL context " + hglrc);
+ System.err.println(getThreadName() + ": !!! Destroyed OpenGL context " + hglrc);
}
hglrc = 0;
}
@@ -215,7 +227,7 @@ public abstract class WindowsGLContext extends GLContext {
protected void resetGLFunctionAvailability() {
super.resetGLFunctionAvailability();
if (DEBUG) {
- System.err.println("!!! Initializing OpenGL extension address table");
+ System.err.println(getThreadName() + ": !!! Initializing OpenGL extension address table");
}
resetProcAddressTable(getGLProcAddressTable());
}
@@ -284,8 +296,11 @@ public abstract class WindowsGLContext extends GLContext {
GraphicsConfiguration config = component.getGraphicsConfiguration();
GraphicsDevice device = config.getDevice();
// Produce a recommended pixel format selection for the GLCapabilitiesChooser.
- // Try to use wglChoosePixelFormatARB if we have it available
- GL dummyGL = WindowsGLContextFactory.getDummyGL(device);
+ // Use wglChoosePixelFormatARB if user requested multisampling and if we have it available
+ GL dummyGL = null;
+ if (capabilities.getSampleBuffers()) {
+ dummyGL = WindowsGLContextFactory.getDummyGL(device);
+ }
int recommendedPixelFormat = -1;
boolean haveWGLChoosePixelFormatARB = false;
boolean haveWGLARBMultisample = false;
@@ -306,7 +321,7 @@ public abstract class WindowsGLContext extends GLContext {
dc = WindowsGLContextFactory.getDummyGLContext( device ).hdc;
rc = WindowsGLContextFactory.getDummyGLContext( device ).hglrc;
if( !WGL.wglMakeCurrent( dc, rc ) ) {
- System.err.println("Error Making WGLC Current: " + WGL.GetLastError() );
+ System.err.println(getThreadName() + ": Error Making WGLC Current: " + WGL.GetLastError() );
} else {
freeWGLC = true;
}
@@ -389,18 +404,18 @@ public abstract class WindowsGLContext extends GLContext {
// Remove one-basing of pixel format (added on later)
recommendedPixelFormat = pformats[0] - 1;
if (DEBUG) {
- System.err.println("Used wglChoosePixelFormatARB to recommend pixel format " + recommendedPixelFormat);
+ System.err.println(getThreadName() + ": Used wglChoosePixelFormatARB to recommend pixel format " + recommendedPixelFormat);
}
}
} else {
if (DEBUG) {
- System.err.println("wglChoosePixelFormatARB failed: " + WGL.GetLastError() );
+ System.err.println(getThreadName() + ": wglChoosePixelFormatARB failed: " + WGL.GetLastError() );
Thread.dumpStack();
}
}
if (DEBUG) {
if (recommendedPixelFormat < 0) {
- System.err.print("wglChoosePixelFormatARB didn't recommend a pixel format");
+ System.err.print(getThreadName() + ": wglChoosePixelFormatARB didn't recommend a pixel format");
if (capabilities.getSampleBuffers()) {
System.err.print(" for multisampled GLCapabilities");
}
@@ -468,7 +483,11 @@ public abstract class WindowsGLContext extends GLContext {
if (!gotAvailableCaps) {
if (DEBUG) {
- System.err.println("Using ChoosePixelFormat because no wglChoosePixelFormatARB: dummyGL = " + dummyGL);
+ if (!capabilities.getSampleBuffers()) {
+ System.err.println(getThreadName() + ": Using ChoosePixelFormat because multisampling not requested");
+ } else {
+ System.err.println(getThreadName() + ": Using ChoosePixelFormat because no wglChoosePixelFormatARB: dummyGL = " + dummyGL);
+ }
}
pfd = glCapabilities2PFD(capabilities, onscreen);
// Remove one-basing of pixel format (added on later)
@@ -495,7 +514,7 @@ public abstract class WindowsGLContext extends GLContext {
(numFormats - 1) + ")");
}
if (DEBUG) {
- System.err.println("Chosen pixel format (" + pixelFormat + "):");
+ System.err.println(getThreadName() + ": Chosen pixel format (" + pixelFormat + "):");
System.err.println(availableCaps[pixelFormat]);
}
pixelFormat += 1; // one-base the index
@@ -512,15 +531,15 @@ public abstract class WindowsGLContext extends GLContext {
if (!WGL.SetPixelFormat(hdc, pixelFormat, pfd)) {
int lastError = WGL.GetLastError();
if (DEBUG) {
- System.err.println("SetPixelFormat failed: current context = " + WGL.wglGetCurrentContext() +
+ System.err.println(getThreadName() + ": SetPixelFormat failed: current context = " + WGL.wglGetCurrentContext() +
", current DC = " + WGL.wglGetCurrentDC());
- System.err.println("GetPixelFormat(hdc " + hdcToString(hdc) + ") returns " + WGL.GetPixelFormat(hdc));
+ System.err.println(getThreadName() + ": GetPixelFormat(hdc " + hdcToString(hdc) + ") returns " + WGL.GetPixelFormat(hdc));
}
throw new GLException("Unable to set pixel format " + pixelFormat + " for device context " + hdcToString(hdc) + ": error code " + lastError);
}
hglrc = WGL.wglCreateContext(hdc);
if (DEBUG) {
- System.err.println("!!! Created OpenGL context " + hglrc + " for device context " + hdcToString(hdc) + " using pixel format " + pixelFormat);
+ System.err.println(getThreadName() + ": !!! Created OpenGL context " + hglrc + " for device context " + hdcToString(hdc) + " using pixel format " + pixelFormat);
}
if (hglrc == 0) {
throw new GLException("Unable to create OpenGL context");
@@ -543,9 +562,6 @@ public abstract class WindowsGLContext extends GLContext {
WGL.PFD_GENERIC_ACCELERATED);
if (caps.getDoubleBuffered()) {
pfdFlags |= WGL.PFD_DOUBLEBUFFER;
- if (onscreen) {
- pfdFlags |= WGL.PFD_SWAP_EXCHANGE;
- }
}
if (onscreen) {
pfdFlags |= WGL.PFD_DRAW_TO_WINDOW;
@@ -558,7 +574,17 @@ public abstract class WindowsGLContext extends GLContext {
pfd.cRedBits ((byte) caps.getRedBits());
pfd.cGreenBits((byte) caps.getGreenBits());
pfd.cBlueBits ((byte) caps.getBlueBits());
+ pfd.cAlphaBits((byte) caps.getAlphaBits());
+ int accumDepth = (caps.getAccumRedBits() +
+ caps.getAccumGreenBits() +
+ caps.getAccumBlueBits());
+ pfd.cAccumBits ((byte) accumDepth);
+ pfd.cAccumRedBits ((byte) caps.getAccumRedBits());
+ pfd.cAccumGreenBits((byte) caps.getAccumGreenBits());
+ pfd.cAccumBlueBits ((byte) caps.getAccumBlueBits());
+ pfd.cAccumAlphaBits((byte) caps.getAccumAlphaBits());
pfd.cDepthBits((byte) caps.getDepthBits());
+ pfd.cStencilBits((byte) caps.getStencilBits());
pfd.iLayerType((byte) WGL.PFD_MAIN_PLANE);
return pfd;
}
diff --git a/src/net/java/games/jogl/impl/windows/WindowsGLContextFactory.java b/src/net/java/games/jogl/impl/windows/WindowsGLContextFactory.java
index 1c976c355..dd6f8daca 100644
--- a/src/net/java/games/jogl/impl/windows/WindowsGLContextFactory.java
+++ b/src/net/java/games/jogl/impl/windows/WindowsGLContextFactory.java
@@ -20,7 +20,7 @@
* 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
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * 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
@@ -56,6 +56,9 @@ import net.java.games.jogl.*;
import net.java.games.jogl.impl.*;
public class WindowsGLContextFactory extends GLContextFactory {
+ private static final boolean DEBUG = Debug.debug("WindowsGLContextFactory");
+ private static final boolean VERBOSE = Debug.verbose();
+
// On Windows we want to be able to use some extension routines like
// wglChoosePixelFormatARB during the creation of the user's first
// GLContext. However, this and other routines' function pointers
@@ -174,6 +177,11 @@ public class WindowsGLContextFactory extends GLContextFactory {
*/
private static void checkForDummyContext( final GraphicsDevice device ) {
if (!pendingContextSet.contains(device) && !dummyContextMap.containsKey( device ) ) {
+ if (DEBUG) {
+ System.err.println("WindowsGLContextFactory.checkForDummyContext() called on thread " +
+ Thread.currentThread().getName());
+ }
+
pendingContextSet.add(device);
GraphicsConfiguration config = device.getDefaultConfiguration();
Rectangle rect = config.getBounds();
diff --git a/src/net/java/games/jogl/impl/windows/WindowsOffscreenGLContext.java b/src/net/java/games/jogl/impl/windows/WindowsOffscreenGLContext.java
index 5743253a0..c70607da7 100644
--- a/src/net/java/games/jogl/impl/windows/WindowsOffscreenGLContext.java
+++ b/src/net/java/games/jogl/impl/windows/WindowsOffscreenGLContext.java
@@ -20,7 +20,7 @@
* 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
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * 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
@@ -65,14 +65,6 @@ public class WindowsOffscreenGLContext extends WindowsGLContext {
return true;
}
- public int getOffscreenContextBufferedImageType() {
- if (capabilities.getAlphaBits() > 0) {
- return BufferedImage.TYPE_INT_ARGB;
- } else {
- return BufferedImage.TYPE_INT_RGB;
- }
- }
-
public int getOffscreenContextWidth() {
return width;
}
diff --git a/src/net/java/games/jogl/impl/windows/WindowsOnscreenGLContext.java b/src/net/java/games/jogl/impl/windows/WindowsOnscreenGLContext.java
index de13be0a1..0dc1818fb 100644
--- a/src/net/java/games/jogl/impl/windows/WindowsOnscreenGLContext.java
+++ b/src/net/java/games/jogl/impl/windows/WindowsOnscreenGLContext.java
@@ -20,7 +20,7 @@
* 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
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * 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
@@ -89,10 +89,6 @@ public class WindowsOnscreenGLContext extends WindowsGLContext {
return false;
}
- public int getOffscreenContextBufferedImageType() {
- throw new GLException("Should not call this");
- }
-
public int getOffscreenContextReadBuffer() {
throw new GLException("Should not call this");
}
@@ -185,7 +181,7 @@ public class WindowsOnscreenGLContext extends WindowsGLContext {
}
GLContextShareSet.contextDestroyed(this);
if (DEBUG) {
- System.err.println("!!! Destroyed OpenGL context " + hglrc + " due to JAWT_LOCK_SURFACE_CHANGED");
+ System.err.println(getThreadName() + ": !!! Destroyed OpenGL context " + hglrc + " due to JAWT_LOCK_SURFACE_CHANGED");
}
hglrc = 0;
}
diff --git a/src/net/java/games/jogl/impl/windows/WindowsPbufferGLContext.java b/src/net/java/games/jogl/impl/windows/WindowsPbufferGLContext.java
index f0ce74d9d..1d5d78296 100644
--- a/src/net/java/games/jogl/impl/windows/WindowsPbufferGLContext.java
+++ b/src/net/java/games/jogl/impl/windows/WindowsPbufferGLContext.java
@@ -20,7 +20,7 @@
* 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
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * 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
@@ -66,6 +66,7 @@ public class WindowsPbufferGLContext extends WindowsGLContext {
private boolean rect; // render-to-texture-rectangle?
private int textureTarget; // e.g. GL_TEXTURE_2D, GL_TEXTURE_RECTANGLE_NV
private int texture; // actual texture object
+ private int floatMode;
public WindowsPbufferGLContext(GLCapabilities capabilities, int initialWidth, int initialHeight) {
super(null, capabilities, null, null);
@@ -145,18 +146,57 @@ public class WindowsPbufferGLContext extends WindowsGLContext {
rtt = capabilities.getOffscreenRenderToTexture();
rect = capabilities.getOffscreenRenderToTextureRectangle();
boolean useFloat = capabilities.getOffscreenFloatingPointBuffers();
+ boolean ati = false;
// Since we are trying to create a pbuffer, the pixel format we
// request (and subsequently use) must be "p-buffer capable".
iattributes[niattribs++] = GL.WGL_DRAW_TO_PBUFFER_ARB;
iattributes[niattribs++] = GL.GL_TRUE;
- if (!rtt) {
- // Currently we don't support non-truecolor visuals in the
- // GLCapabilities, so we don't offer the option of making
- // color-index pbuffers.
- iattributes[niattribs++] = GL.WGL_PIXEL_TYPE_ARB;
- iattributes[niattribs++] = GL.WGL_TYPE_RGBA_ARB;
+ if (rtt && !rect) {
+ throw new GLException("Render-to-texture-rectangle requires render-to-texture to be specified");
+ }
+
+ if (rect) {
+ if (!gl.isExtensionAvailable("GL_NV_texture_rectangle")) {
+ throw new GLException("Render-to-texture-rectangle requires GL_NV_texture_rectangle extension");
+ }
+ }
+
+ if (useFloat) {
+ if (!gl.isExtensionAvailable("WGL_ATI_pixel_format_float") &&
+ !gl.isExtensionAvailable("WGL_NV_float_buffer")) {
+ throw new GLException("Floating-point pbuffers not supported by this hardware");
+ }
+
+ // Prefer NVidia extension over ATI
+ if (gl.isExtensionAvailable("WGL_NV_float_buffer")) {
+ ati = false;
+ floatMode = GLPbuffer.NV_FLOAT;
+ } else {
+ ati = true;
+ floatMode = GLPbuffer.ATI_FLOAT;
+ }
+ if (DEBUG) {
+ System.err.println("Using " + (ati ? "ATI" : "NVidia") + " floating-point extension");
+ }
+ }
+
+ if (useFloat && ati) {
+ if (rtt) {
+ throw new GLException("Render-to-floating-point-texture not supported on ATI hardware");
+ } else {
+ iattributes[niattribs++] = GL.WGL_PIXEL_TYPE_ARB;
+ iattributes[niattribs++] = GL.WGL_TYPE_RGBA_FLOAT_ATI;
+ }
+ } else {
+ if (!rtt) {
+ // Currently we don't support non-truecolor visuals in the
+ // GLCapabilities, so we don't offer the option of making
+ // color-index pbuffers.
+ iattributes[niattribs++] = GL.WGL_PIXEL_TYPE_ARB;
+ iattributes[niattribs++] = GL.WGL_TYPE_RGBA_ARB;
+ }
}
iattributes[niattribs++] = GL.WGL_DOUBLE_BUFFER_ARB;
@@ -195,15 +235,17 @@ public class WindowsPbufferGLContext extends WindowsGLContext {
iattributes[niattribs++] = GL.GL_TRUE;
}
- // FIXME: using NVidia-specific extensions and enums, as well as
- // confusing render-to-texture with render-to-texture-rectangle
- if (useFloat) {
+ if (useFloat && !ati) {
iattributes[niattribs++] = GL.WGL_FLOAT_COMPONENTS_NV;
iattributes[niattribs++] = GL.GL_TRUE;
}
if (rtt) {
if (useFloat) {
+ assert(!ati);
+ if (!rect) {
+ throw new GLException("Render-to-floating-point-texture only supported on NVidia hardware with render-to-texture-rectangle");
+ }
iattributes[niattribs++] = GL.WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV;
iattributes[niattribs++] = GL.GL_TRUE;
} else {
@@ -239,7 +281,7 @@ public class WindowsPbufferGLContext extends WindowsGLContext {
iattributes[2] = GL.WGL_BLUE_BITS_ARB;
iattributes[3] = GL.WGL_ALPHA_BITS_ARB;
iattributes[4] = GL.WGL_DEPTH_BITS_ARB;
- iattributes[5] = GL.WGL_FLOAT_COMPONENTS_NV;
+ iattributes[5] = (useFloat ? (ati ? GL.WGL_PIXEL_TYPE_ARB : GL.WGL_FLOAT_COMPONENTS_NV) : GL.WGL_RED_BITS_ARB);
iattributes[6] = GL.WGL_SAMPLE_BUFFERS_EXT;
iattributes[7] = GL.WGL_SAMPLES_EXT;
iattributes[8] = GL.WGL_DRAW_TO_PBUFFER_ARB;
@@ -257,9 +299,20 @@ public class WindowsPbufferGLContext extends WindowsGLContext {
System.err.print(" depth: " + ivalues[4]);
System.err.print(" multisample: " + ivalues[6]);
System.err.print(" samples: " + ivalues[7]);
- if (ivalues[5] != 0) {
- System.err.print(" [float]");
+ if (useFloat) {
+ if (ati) {
+ if (ivalues[5] == GL.WGL_TYPE_RGBA_FLOAT_ATI) {
+ System.err.print(" [ati float]");
+ } else if (ivalues[5] != GL.WGL_TYPE_RGBA_ARB) {
+ System.err.print(" [unknown pixel type " + ivalues[5] + "]");
+ }
+ } else {
+ if (ivalues[5] != 0) {
+ System.err.print(" [float]");
+ }
+ }
}
+
if (ivalues[8] != 0) {
System.err.print(" [pbuffer]");
}
@@ -402,10 +455,6 @@ public class WindowsPbufferGLContext extends WindowsGLContext {
return false;
}
- public int getOffscreenContextBufferedImageType() {
- throw new GLException("Should not call this");
- }
-
public int getOffscreenContextReadBuffer() {
throw new GLException("Should not call this");
}
@@ -432,7 +481,10 @@ public class WindowsPbufferGLContext extends WindowsGLContext {
if (hglrc != 0) {
super.destroyImpl();
// Must release DC and pbuffer
- GL gl = getGL();
+ // NOTE that since the context is not current, glGetError() can
+ // not be called here, so we skip the use of any composable
+ // pipelines
+ GL gl = createGL();
if (gl.wglReleasePbufferDCARB(buffer, hdc) == 0) {
throw new GLException("Error releasing pbuffer device context: error code " + WGL.GetLastError());
}
@@ -457,6 +509,10 @@ public class WindowsPbufferGLContext extends WindowsGLContext {
}
}
+ public int getFloatingPointMode() {
+ return floatMode;
+ }
+
private String wglGetLastError() {
int err = WGL.GetLastError();
String detail = null;
diff --git a/src/net/java/games/jogl/impl/x11/X11GLContext.java b/src/net/java/games/jogl/impl/x11/X11GLContext.java
index 22d6c5237..837b7b791 100644
--- a/src/net/java/games/jogl/impl/x11/X11GLContext.java
+++ b/src/net/java/games/jogl/impl/x11/X11GLContext.java
@@ -20,7 +20,7 @@
* 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
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * 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
@@ -47,7 +47,6 @@ import net.java.games.jogl.*;
import net.java.games.jogl.impl.*;
public abstract class X11GLContext extends GLContext {
- private static JAWT jawt;
protected long display;
protected long drawable;
protected long visualID;
@@ -111,8 +110,6 @@ public abstract class X11GLContext extends GLContext {
protected abstract boolean isOffscreen();
- public abstract int getOffscreenContextBufferedImageType();
-
public int getOffscreenContextWidth() {
throw new GLException("Should not call this");
}
@@ -310,15 +307,7 @@ public abstract class X11GLContext extends GLContext {
//
protected JAWT getJAWT() {
- if (jawt == null) {
- JAWT j = new JAWT();
- j.version(JAWTFactory.JAWT_VERSION_1_4);
- if (!JAWTFactory.JAWT_GetAWT(j)) {
- throw new RuntimeException("Unable to initialize JAWT");
- }
- jawt = j;
- }
- return jawt;
+ return X11GLContextFactory.getJAWT();
}
protected XVisualInfo chooseVisual() {
@@ -412,10 +401,10 @@ public abstract class X11GLContext extends GLContext {
// These synchronization primitives prevent the AWT from making
// requests from the X server asynchronously to this code.
protected void lockAWT() {
- getJAWT().Lock();
+ X11GLContextFactory.lockAWT();
}
protected void unlockAWT() {
- getJAWT().Unlock();
+ X11GLContextFactory.unlockAWT();
}
}
diff --git a/src/net/java/games/jogl/impl/x11/X11GLContextFactory.java b/src/net/java/games/jogl/impl/x11/X11GLContextFactory.java
index 6d7d6f372..3be11c002 100644
--- a/src/net/java/games/jogl/impl/x11/X11GLContextFactory.java
+++ b/src/net/java/games/jogl/impl/x11/X11GLContextFactory.java
@@ -20,7 +20,7 @@
* 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
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * 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
@@ -61,23 +61,30 @@ public class X11GLContextFactory extends GLContextFactory {
// system's selection to the chooser as a hint
int[] attribs = glCapabilities2AttribList(capabilities, isMultisampleAvailable());
- long display = getDisplayConnection();
- XVisualInfo recommendedVis = GLX.glXChooseVisual(display, screen, attribs, 0);
+ XVisualInfo[] infos = null;
+ GLCapabilities[] caps = null;
int recommendedIndex = -1;
- int[] count = new int[1];
- XVisualInfo template = new XVisualInfo();
- template.screen(screen);
- XVisualInfo[] infos = GLX.XGetVisualInfo(display, GLX.VisualScreenMask, template, count, 0);
- if (infos == null) {
- throw new GLException("Error while enumerating available XVisualInfos");
- }
- GLCapabilities[] caps = new GLCapabilities[infos.length];
- for (int i = 0; i < infos.length; i++) {
- caps[i] = xvi2GLCapabilities(display, infos[i]);
- // Attempt to find the visual chosen by glXChooseVisual
- if (recommendedVis != null && recommendedVis.visualid() == infos[i].visualid()) {
- recommendedIndex = i;
+ lockAWT();
+ try {
+ long display = getDisplayConnection();
+ XVisualInfo recommendedVis = GLX.glXChooseVisual(display, screen, attribs, 0);
+ int[] count = new int[1];
+ XVisualInfo template = new XVisualInfo();
+ template.screen(screen);
+ infos = GLX.XGetVisualInfo(display, GLX.VisualScreenMask, template, count, 0);
+ if (infos == null) {
+ throw new GLException("Error while enumerating available XVisualInfos");
+ }
+ caps = new GLCapabilities[infos.length];
+ for (int i = 0; i < infos.length; i++) {
+ caps[i] = xvi2GLCapabilities(display, infos[i]);
+ // Attempt to find the visual chosen by glXChooseVisual
+ if (recommendedVis != null && recommendedVis.visualid() == infos[i].visualid()) {
+ recommendedIndex = i;
+ }
}
+ } finally {
+ unlockAWT();
}
int chosen = chooser.chooseCapabilities(capabilities, caps, recommendedIndex);
if (chosen < 0 || chosen >= caps.length) {
@@ -205,11 +212,38 @@ public class X11GLContextFactory extends GLContextFactory {
return res;
}
+ // JAWT access
+ private static JAWT jawt;
+ public static JAWT getJAWT() {
+ if (jawt == null) {
+ JAWT j = new JAWT();
+ j.version(JAWTFactory.JAWT_VERSION_1_4);
+ if (!JAWTFactory.JAWT_GetAWT(j)) {
+ throw new RuntimeException("Unable to initialize JAWT");
+ }
+ jawt = j;
+ }
+ return jawt;
+ }
+
+ public static void lockAWT() {
+ getJAWT().Lock();
+ }
+
+ public static void unlockAWT() {
+ getJAWT().Unlock();
+ }
+
// Display connection for use by visual selection algorithm and by all offscreen surfaces
private static long staticDisplay;
public static long getDisplayConnection() {
if (staticDisplay == 0) {
- staticDisplay = GLX.XOpenDisplay(null);
+ lockAWT();
+ try {
+ staticDisplay = GLX.XOpenDisplay(null);
+ } finally {
+ unlockAWT();
+ }
if (staticDisplay == 0) {
throw new GLException("Unable to open default display, needed for visual selection and offscreen surface handling");
}
diff --git a/src/net/java/games/jogl/impl/x11/X11OffscreenGLContext.java b/src/net/java/games/jogl/impl/x11/X11OffscreenGLContext.java
index 343a69f07..2e30e2b18 100644
--- a/src/net/java/games/jogl/impl/x11/X11OffscreenGLContext.java
+++ b/src/net/java/games/jogl/impl/x11/X11OffscreenGLContext.java
@@ -20,7 +20,7 @@
* 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
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * 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
@@ -65,14 +65,6 @@ public class X11OffscreenGLContext extends X11GLContext {
return true;
}
- public int getOffscreenContextBufferedImageType() {
- if (capabilities.getAlphaBits() > 0) {
- return BufferedImage.TYPE_INT_ARGB;
- } else {
- return BufferedImage.TYPE_INT_RGB;
- }
- }
-
public int getOffscreenContextWidth() {
return width;
}
diff --git a/src/net/java/games/jogl/impl/x11/X11OnscreenGLContext.java b/src/net/java/games/jogl/impl/x11/X11OnscreenGLContext.java
index 241a45dc9..2fd340d79 100644
--- a/src/net/java/games/jogl/impl/x11/X11OnscreenGLContext.java
+++ b/src/net/java/games/jogl/impl/x11/X11OnscreenGLContext.java
@@ -20,7 +20,7 @@
* 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
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * 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
@@ -70,10 +70,6 @@ public class X11OnscreenGLContext extends X11GLContext {
return false;
}
- public int getOffscreenContextBufferedImageType() {
- throw new GLException("Should not call this");
- }
-
public int getOffscreenContextReadBuffer() {
throw new GLException("Should not call this");
}
@@ -121,7 +117,7 @@ public class X11OnscreenGLContext extends X11GLContext {
while (!pbuffersToInstantiate.isEmpty()) {
X11PbufferGLContext ctx =
(X11PbufferGLContext) pbuffersToInstantiate.remove(pbuffersToInstantiate.size() - 1);
- ctx.createPbuffer(display, context);
+ ctx.createPbuffer(display, context, getGL());
}
}
return ret;
diff --git a/src/net/java/games/jogl/impl/x11/X11PbufferGLContext.java b/src/net/java/games/jogl/impl/x11/X11PbufferGLContext.java
index 5e59329ca..7733472fb 100644
--- a/src/net/java/games/jogl/impl/x11/X11PbufferGLContext.java
+++ b/src/net/java/games/jogl/impl/x11/X11PbufferGLContext.java
@@ -20,7 +20,7 @@
* 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
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * 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
@@ -60,10 +60,6 @@ public class X11PbufferGLContext extends X11GLContext {
private static final int MAX_PFORMATS = 256;
private static final int MAX_ATTRIBS = 256;
- // FIXME: figure out how to support render-to-texture and
- // render-to-texture-rectangle (which appear to be supported, though
- // it looks like floating-point buffers are not)
-
public X11PbufferGLContext(GLCapabilities capabilities, int initialWidth, int initialHeight) {
super(null, capabilities, null, null);
this.initWidth = initialWidth;
@@ -94,7 +90,7 @@ public class X11PbufferGLContext extends X11GLContext {
throw new GLException("Not yet implemented");
}
- public void createPbuffer(long display, long parentContext) {
+ public void createPbuffer(long display, long parentContext, GL gl) {
if (display == 0) {
throw new GLException("Null display");
}
@@ -103,10 +99,6 @@ public class X11PbufferGLContext extends X11GLContext {
throw new GLException("Null parentContext");
}
- if (capabilities.getOffscreenFloatingPointBuffers()) {
- throw new GLException("Floating-point pbuffers not supported yet on X11");
- }
-
if (capabilities.getOffscreenRenderToTexture()) {
throw new GLException("Render-to-texture pbuffers not supported yet on X11");
}
@@ -166,6 +158,14 @@ public class X11PbufferGLContext extends X11GLContext {
iattributes[niattribs++] = capabilities.getAccumBlueBits();
}
+ if (capabilities.getOffscreenFloatingPointBuffers()) {
+ if (!gl.isExtensionAvailable("GLX_NV_float_buffer")) {
+ throw new GLException("Floating-point pbuffers on X11 currently require NVidia hardware");
+ }
+ iattributes[niattribs++] = GLX.GLX_FLOAT_COMPONENTS_NV;
+ iattributes[niattribs++] = GL.GL_TRUE;
+ }
+
// FIXME: add FSAA support? Don't want to get into a situation
// where we have to retry the glXChooseFBConfig call if it fails
// due to a lack of an antialiased visual...
@@ -286,10 +286,6 @@ public class X11PbufferGLContext extends X11GLContext {
return false;
}
- public int getOffscreenContextBufferedImageType() {
- throw new GLException("Should not call this");
- }
-
public int getOffscreenContextReadBuffer() {
throw new GLException("Should not call this");
}
@@ -332,6 +328,11 @@ public class X11PbufferGLContext extends X11GLContext {
// FIXME: do we need to do anything if the pbuffer is double-buffered?
}
+ public int getFloatingPointMode() {
+ // Floating-point pbuffers currently require NVidia hardware on X11
+ return GLPbuffer.NV_FLOAT;
+ }
+
private int queryFBConfig(long display, GLXFBConfig fbConfig, int attrib) {
int[] tmp = new int[1];
if (GLX.glXGetFBConfigAttrib(display, fbConfig, attrib, tmp, 0) != 0) {
diff --git a/src/net/java/games/jogl/impl/x11/X11SunJDKReflection.java b/src/net/java/games/jogl/impl/x11/X11SunJDKReflection.java
index a59bf7137..59208e5a9 100755
--- a/src/net/java/games/jogl/impl/x11/X11SunJDKReflection.java
+++ b/src/net/java/games/jogl/impl/x11/X11SunJDKReflection.java
@@ -20,7 +20,7 @@
* 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
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * 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
diff --git a/src/net/java/games/jogl/util/BitmapCharRec.java b/src/net/java/games/jogl/util/BitmapCharRec.java
index 5705cf1ec..642bbb465 100644
--- a/src/net/java/games/jogl/util/BitmapCharRec.java
+++ b/src/net/java/games/jogl/util/BitmapCharRec.java
@@ -20,7 +20,7 @@
* 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
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * 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
diff --git a/src/net/java/games/jogl/util/BitmapFontRec.java b/src/net/java/games/jogl/util/BitmapFontRec.java
index bb2a40746..32ea9c183 100644
--- a/src/net/java/games/jogl/util/BitmapFontRec.java
+++ b/src/net/java/games/jogl/util/BitmapFontRec.java
@@ -20,7 +20,7 @@
* 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
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * 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
diff --git a/src/net/java/games/jogl/util/BufferUtils.java b/src/net/java/games/jogl/util/BufferUtils.java
index 1962847e2..7c788100f 100644
--- a/src/net/java/games/jogl/util/BufferUtils.java
+++ b/src/net/java/games/jogl/util/BufferUtils.java
@@ -20,7 +20,7 @@
* 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
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * 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
diff --git a/src/net/java/games/jogl/util/CoordRec.java b/src/net/java/games/jogl/util/CoordRec.java
index a99604a4e..661ed23ff 100644
--- a/src/net/java/games/jogl/util/CoordRec.java
+++ b/src/net/java/games/jogl/util/CoordRec.java
@@ -20,7 +20,7 @@
* 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
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * 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
diff --git a/src/net/java/games/jogl/util/GLUT.java b/src/net/java/games/jogl/util/GLUT.java
index 380b02b9f..aad01e13f 100644
--- a/src/net/java/games/jogl/util/GLUT.java
+++ b/src/net/java/games/jogl/util/GLUT.java
@@ -20,7 +20,7 @@
* 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
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * 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
@@ -383,13 +383,17 @@ public class GLUT {
}
public int glutStrokeWidth (int font, char character) {
+ return (int) glutStrokeWidthf(font, character);
+ }
+
+ public float glutStrokeWidthf (int font, char character) {
StrokeFontRec fontinfo = getStrokeFont(font);
int c = character & 0xFFFF;
if (c < 0 || c >= fontinfo.num_chars)
return 0;
StrokeCharRec ch = fontinfo.ch[c];
if (ch != null)
- return (int) ch.right;
+ return ch.right;
else
return 0;
}
@@ -410,8 +414,12 @@ public class GLUT {
}
public int glutStrokeLength (int font, String string) {
+ return (int) glutStrokeLengthf(font, string);
+ }
+
+ public float glutStrokeLengthf (int font, String string) {
StrokeFontRec fontinfo = getStrokeFont(font);
- int length = 0;
+ float length = 0;
int len = string.length();
for (int i = 0; i < len; i++) {
char c = string.charAt(i);
diff --git a/src/net/java/games/jogl/util/GLUTBitmap8x13.java b/src/net/java/games/jogl/util/GLUTBitmap8x13.java
index ee2bf0561..caa007726 100644
--- a/src/net/java/games/jogl/util/GLUTBitmap8x13.java
+++ b/src/net/java/games/jogl/util/GLUTBitmap8x13.java
@@ -20,7 +20,7 @@
* 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
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * 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
diff --git a/src/net/java/games/jogl/util/GLUTBitmap9x15.java b/src/net/java/games/jogl/util/GLUTBitmap9x15.java
index e2849193b..05aa2635b 100644
--- a/src/net/java/games/jogl/util/GLUTBitmap9x15.java
+++ b/src/net/java/games/jogl/util/GLUTBitmap9x15.java
@@ -20,7 +20,7 @@
* 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
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * 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
diff --git a/src/net/java/games/jogl/util/GLUTBitmapHelvetica10.java b/src/net/java/games/jogl/util/GLUTBitmapHelvetica10.java
index a831ad253..d238d7d16 100644
--- a/src/net/java/games/jogl/util/GLUTBitmapHelvetica10.java
+++ b/src/net/java/games/jogl/util/GLUTBitmapHelvetica10.java
@@ -20,7 +20,7 @@
* 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
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * 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
diff --git a/src/net/java/games/jogl/util/GLUTBitmapHelvetica12.java b/src/net/java/games/jogl/util/GLUTBitmapHelvetica12.java
index f4a0bebeb..fe29ab84f 100644
--- a/src/net/java/games/jogl/util/GLUTBitmapHelvetica12.java
+++ b/src/net/java/games/jogl/util/GLUTBitmapHelvetica12.java
@@ -20,7 +20,7 @@
* 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
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * 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
diff --git a/src/net/java/games/jogl/util/GLUTBitmapHelvetica18.java b/src/net/java/games/jogl/util/GLUTBitmapHelvetica18.java
index 2d6ca178e..31fbda94c 100644
--- a/src/net/java/games/jogl/util/GLUTBitmapHelvetica18.java
+++ b/src/net/java/games/jogl/util/GLUTBitmapHelvetica18.java
@@ -20,7 +20,7 @@
* 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
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * 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
diff --git a/src/net/java/games/jogl/util/GLUTBitmapTimesRoman10.java b/src/net/java/games/jogl/util/GLUTBitmapTimesRoman10.java
index 2d56cb899..175b857e0 100644
--- a/src/net/java/games/jogl/util/GLUTBitmapTimesRoman10.java
+++ b/src/net/java/games/jogl/util/GLUTBitmapTimesRoman10.java
@@ -20,7 +20,7 @@
* 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
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * 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
diff --git a/src/net/java/games/jogl/util/GLUTBitmapTimesRoman24.java b/src/net/java/games/jogl/util/GLUTBitmapTimesRoman24.java
index cf89907b3..25684ceff 100644
--- a/src/net/java/games/jogl/util/GLUTBitmapTimesRoman24.java
+++ b/src/net/java/games/jogl/util/GLUTBitmapTimesRoman24.java
@@ -20,7 +20,7 @@
* 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
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * 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
diff --git a/src/net/java/games/jogl/util/GLUTStrokeMonoRoman.java b/src/net/java/games/jogl/util/GLUTStrokeMonoRoman.java
index a3aec0211..f5d2ebcff 100644
--- a/src/net/java/games/jogl/util/GLUTStrokeMonoRoman.java
+++ b/src/net/java/games/jogl/util/GLUTStrokeMonoRoman.java
@@ -20,7 +20,7 @@
* 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
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * 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
diff --git a/src/net/java/games/jogl/util/GLUTStrokeRoman.java b/src/net/java/games/jogl/util/GLUTStrokeRoman.java
index d5d8e9bf2..2755b8dfc 100644
--- a/src/net/java/games/jogl/util/GLUTStrokeRoman.java
+++ b/src/net/java/games/jogl/util/GLUTStrokeRoman.java
@@ -20,7 +20,7 @@
* 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
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * 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
diff --git a/src/net/java/games/jogl/util/StrokeCharRec.java b/src/net/java/games/jogl/util/StrokeCharRec.java
index 742a305e3..7c961fb4d 100644
--- a/src/net/java/games/jogl/util/StrokeCharRec.java
+++ b/src/net/java/games/jogl/util/StrokeCharRec.java
@@ -20,7 +20,7 @@
* 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
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * 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
diff --git a/src/net/java/games/jogl/util/StrokeFontRec.java b/src/net/java/games/jogl/util/StrokeFontRec.java
index 82734a6dd..133380a77 100644
--- a/src/net/java/games/jogl/util/StrokeFontRec.java
+++ b/src/net/java/games/jogl/util/StrokeFontRec.java
@@ -20,7 +20,7 @@
* 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
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * 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
diff --git a/src/net/java/games/jogl/util/StrokeRec.java b/src/net/java/games/jogl/util/StrokeRec.java
index fa4837cb7..cc4571465 100644
--- a/src/net/java/games/jogl/util/StrokeRec.java
+++ b/src/net/java/games/jogl/util/StrokeRec.java
@@ -20,7 +20,7 @@
* 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
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * 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