aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2010-11-25 16:27:52 +0100
committerSven Gothel <[email protected]>2010-11-25 16:27:52 +0100
commit4c87224144d955d000f0d5efdc9c058416cdefac (patch)
tree79040c30800750c7e710df04c4565afba1398adf /src
parentfefd11bb37abc0eff255ff1ad7506c95e13e7b11 (diff)
NativeWindow/GDI: Adding ERROR_SUCCESS to make the code more clear.
Diffstat (limited to 'src')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawable.java2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java1
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfiguration.java10
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java10
4 files changed, 13 insertions, 10 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawable.java
index bbbd93435..68bfa97e0 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawable.java
@@ -80,7 +80,7 @@ public abstract class WindowsWGLDrawable extends GLDrawableImpl {
startTime = System.currentTimeMillis();
}
- if (!GDI.SwapBuffers(getHandle()) && (GDI.GetLastError() != 0)) {
+ if (!GDI.SwapBuffers(getHandle()) && (GDI.GetLastError() != GDI.ERROR_SUCCESS)) {
throw new GLException("Error swapping buffers");
}
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java
index 80261114f..0180b6c87 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java
@@ -301,6 +301,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
long err = GDI.GetLastError();
String detail = null;
switch ((int) err) {
+ case GDI.ERROR_SUCCESS: detail = "ERROR_SUCCESS"; break;
case GDI.ERROR_INVALID_PIXEL_FORMAT: detail = "ERROR_INVALID_PIXEL_FORMAT"; break;
case GDI.ERROR_NO_SYSTEM_RESOURCES: detail = "ERROR_NO_SYSTEM_RESOURCES"; break;
case GDI.ERROR_INVALID_DATA: detail = "ERROR_INVALID_DATA"; break;
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfiguration.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfiguration.java
index 13df54d0e..900d35698 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfiguration.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfiguration.java
@@ -154,8 +154,8 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio
int[] out = new int[1];
in[0] = WGLExt.WGL_COLOR_BITS_ARB;
if (!sharedCtx.getWGLExt().wglGetPixelFormatAttribivARB(hdc, pfdID, 0, 1, in, 0, out, 0)) {
- // Intel Extreme graphics 'fails' with a zero error code
- return GDI.GetLastError() == 0 ;
+ // Some GPU's falsely fails with a zero error code (success)
+ return GDI.GetLastError() == GDI.ERROR_SUCCESS ;
}
return true;
}
@@ -315,9 +315,9 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio
}
} else {
long lastErr = GDI.GetLastError();
- // Intel Extreme graphics fails with a zero error code
- if (lastErr != 0) {
- throw new GLException("wglARBAllPFIDs2GLCapabilities: Unable to enumerate pixel formats of window using wglGetPixelFormatAttribivARB: error code " + GDI.GetLastError());
+ // Some GPU's falsely fails with a zero error code (success)
+ if (lastErr != GDI.ERROR_SUCCESS) {
+ throw new GLException("wglARBAllPFIDs2GLCapabilities: Unable to enumerate pixel formats of window using wglGetPixelFormatAttribivARB: error code " + lastErr);
}
}
return availableCaps;
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java
index 6228a80a9..c08ea6395 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java
@@ -280,8 +280,9 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio
if (pixelFormatSet <= 0) {
if (!GDI.SetPixelFormat(hdc, pfdID, pfd)) {
- long lastError = GDI.GetLastError();
- throw new GLException("Unable to set pixel format " + pfdID + " for device context " + toHexString(hdc) + ": error code " + lastError);
+ throw new GLException("Unable to set pixel format " + pfdID +
+ " for device context " + toHexString(hdc) +
+ ": error code " + GDI.GetLastError());
}
}
@@ -405,8 +406,9 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio
if (pixelFormatSet <= 0) {
if (!GDI.SetPixelFormat(hdc, pfdID, pfd)) {
- long lastError = GDI.GetLastError();
- throw new GLException("Unable to set pixel format " + pfdID + " for device context " + toHexString(hdc) + ": error code " + lastError);
+ throw new GLException("Unable to set pixel format " + pfdID +
+ " for device context " + toHexString(hdc) +
+ ": error code " + GDI.GetLastError());
}
}