aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/games/jogl/impl
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/java/games/jogl/impl')
-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
35 files changed, 438 insertions, 256 deletions
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