aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-03-20 05:07:21 +0100
committerSven Gothel <[email protected]>2011-03-20 05:07:21 +0100
commit3df74690ffd910314364566a8fd6eb2c8242f96a (patch)
treeb7ccabf4fa13f2fd077122951683b0cafd4d45a7 /src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java
parent85f730a91507e9d4bdeab51b97de8d395fa9eb40 (diff)
Refine WGL_PIXEL_TYPE_ARB and GLX_RENDER_TYPE:
WGL_PIXEL_TYPE_ARB: Results -> GLCapabilities - WGL_TYPE_COLORINDEX_ARB not supported - Only WGL_TYPE_RGBA_FLOAT_ARB makes pbuffer float Query: - Only use WGL_FLOAT_COMPONENT_NV if supported - Remove multiple WGL_PIXEL_TYPE_ARB entry GLX_RENDER_TYPE: Results -> GLCapabilities - GLX_COLORINDEX_BIT only not supported
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java')
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java36
1 files changed, 20 insertions, 16 deletions
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java
index ae07646b3..c500135f6 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java
@@ -50,7 +50,6 @@ import javax.media.opengl.GLProfile;
import jogamp.nativewindow.windows.GDI;
import jogamp.nativewindow.windows.PIXELFORMATDESCRIPTOR;
-import jogamp.opengl.GLContextImpl;
import jogamp.opengl.GLGraphicsConfigurationUtil;
public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguration implements Cloneable {
@@ -187,15 +186,18 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio
iattributes[niattribs++] = WGLExt.WGL_SAMPLE_BUFFERS_ARB;
iattributes[niattribs++] = WGLExt.WGL_SAMPLES_ARB;
}
+
if(sharedResource.hasARBPBuffer()) {
- // pbo float buffer
- iattributes[niattribs++] = WGLExt.WGL_PIXEL_TYPE_ARB; // ati
- iattributes[niattribs++] = WGLExt.WGL_FLOAT_COMPONENTS_NV; // nvidia
+ WindowsWGLContext sharedCtx = sharedResource.getContext();
+ if(null != sharedCtx && sharedCtx.isExtensionAvailable(WindowsWGLDrawableFactory.WGL_NV_float_buffer)) {
+ // pbo float buffer
+ iattributes[niattribs++] = WGLExt.WGL_FLOAT_COMPONENTS_NV; // nvidia
+ }
}
return niattribs;
}
-
+
static boolean wglARBPFIDValid(WindowsWGLContext sharedCtx, long hdc, int pfdID) {
int[] in = new int[1];
int[] out = new int[1];
@@ -432,6 +434,7 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio
boolean rect = caps.getPbufferRenderToTextureRectangle();
boolean useFloat = caps.getPbufferFloatingPointBuffers();
boolean ati = false;
+ boolean nvidia = false;
if (pbuffer && sharedResource.hasARBPBuffer()) {
// Check some invariants and set up some state
if (rect && !rtt) {
@@ -446,21 +449,21 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio
}
if (useFloat) {
- if (!sharedCtx.isExtensionAvailable("WGL_ATI_pixel_format_float") &&
- !sharedCtx.isExtensionAvailable("WGL_NV_float_buffer")) {
- throw new GLException("Floating-point pbuffers not supported by this hardware");
- }
-
// Prefer NVidia extension over ATI
- if (sharedCtx.isExtensionAvailable("WGL_NV_float_buffer")) {
- ati = false;
+ nvidia = sharedCtx.isExtensionAvailable(WindowsWGLDrawableFactory.WGL_NV_float_buffer);
+ if(nvidia) {
floatMode[0] = GLPbuffer.NV_FLOAT;
} else {
- ati = true;
- floatMode[0] = GLPbuffer.ATI_FLOAT;
+ ati = sharedCtx.isExtensionAvailable("WGL_ATI_pixel_format_float");
+ if(ati) {
+ floatMode[0] = GLPbuffer.ATI_FLOAT;
+ } else {
+ throw new GLException("Floating-point pbuffers not supported by this hardware");
+ }
}
+
if (DEBUG) {
- System.err.println("Using " + (ati ? "ATI" : "NVidia") + " floating-point extension");
+ System.err.println("Using " + (ati ? "ATI" : ( nvidia ? "NVidia" : "NONE" ) ) + " floating-point extension");
}
}
@@ -483,7 +486,7 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio
}
}
- if (useFloat && !ati) {
+ if (useFloat && nvidia) {
iattributes[niattribs++] = WGLExt.WGL_FLOAT_COMPONENTS_NV;
iattributes[niattribs++] = GL.GL_TRUE;
}
@@ -491,6 +494,7 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio
if (rtt) {
if (useFloat) {
assert(!ati);
+ assert(nvidia);
if (!rect) {
throw new GLException("Render-to-floating-point-texture only supported on NVidia hardware with render-to-texture-rectangle");
}