aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/games/jogl/impl/windows
diff options
context:
space:
mode:
authorKenneth Russel <[email protected]>2005-07-07 22:49:47 +0000
committerKenneth Russel <[email protected]>2005-07-07 22:49:47 +0000
commit0fa2740c8c186b0908baa5b7629bef657fe38527 (patch)
treea6f15a7e18af660886149730c2d677a537bf38c5 /src/net/java/games/jogl/impl/windows
parent0969a98f2007d76e38f8819eedfead5b840f6364 (diff)
Merged with main trunk (tag JOGL_PRE_1_1_1)
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JSR-231@317 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/net/java/games/jogl/impl/windows')
-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
5 files changed, 140 insertions, 62 deletions
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;