aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/jogamp/opengl/impl/windows
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes/com/jogamp/opengl/impl/windows')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsPbufferWGLDrawable.java12
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java3
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfiguration.java49
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java21
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java11
5 files changed, 52 insertions, 44 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsPbufferWGLDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsPbufferWGLDrawable.java
index 751ae5380..842096e55 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsPbufferWGLDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsPbufferWGLDrawable.java
@@ -51,6 +51,7 @@ import javax.media.opengl.GLProfile;
import com.jogamp.nativewindow.impl.windows.GDI;
import com.jogamp.nativewindow.impl.windows.PIXELFORMATDESCRIPTOR;
+import com.jogamp.opengl.impl.GLContextImpl;
import javax.media.opengl.GLCapabilitiesImmutable;
public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable {
@@ -62,14 +63,14 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable {
public WindowsPbufferWGLDrawable(GLDrawableFactory factory, NativeSurface target,
WindowsWGLDrawable dummyDrawable,
- WGLExt wglExt) {
+ WindowsWGLContext sharedCtx) {
super(factory, target, true);
if (DEBUG) {
System.out.println("Pbuffer config: " + getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration());
}
- createPbuffer(dummyDrawable.getNativeSurface().getSurfaceHandle(), wglExt);
+ createPbuffer(dummyDrawable.getNativeSurface().getSurfaceHandle(), sharedCtx);
if (DEBUG) {
System.err.println("Created pbuffer " + this);
@@ -126,12 +127,13 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable {
}
}
- private void createPbuffer(long parentHdc, WGLExt wglExt) {
+ private void createPbuffer(long parentHdc, WindowsWGLContext sharedCtx) {
int[] iattributes = new int [2*WindowsWGLGraphicsConfiguration.MAX_ATTRIBS];
float[] fattributes = new float[1];
int[] floatModeTmp = new int[1];
int niattribs = 0;
int width, height;
+ WGLExt wglExt = sharedCtx.getWGLExt();
WindowsWGLGraphicsConfiguration config = (WindowsWGLGraphicsConfiguration) getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration();
GLCapabilitiesImmutable capabilities = (GLCapabilitiesImmutable)config.getRequestedCapabilities();
@@ -144,7 +146,7 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable {
if(!WindowsWGLGraphicsConfiguration.GLCapabilities2AttribList(capabilities,
iattributes,
- wglExt,
+ sharedCtx,
true,
floatModeTmp)){
throw new GLException("Pbuffer-related extensions not supported");
@@ -176,7 +178,7 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable {
throw new GLException("pbuffer creation error: Couldn't find a suitable pixel format");
}
- boolean haveMultisample = wglExt.isExtensionAvailable("WGL_ARB_multisample");
+ boolean haveMultisample = sharedCtx.isExtensionAvailable("WGL_ARB_multisample");
if (DEBUG) {
System.err.println("" + nformats + " suitable pixel formats found");
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 51c5875cc..2e29e9c83 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
@@ -257,10 +257,9 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
synchronized(sr.context) {
sr.context.makeCurrent();
try {
- WGLExt wglExt = sr.context.getWGLExt();
GLDrawableImpl pbufferDrawable = new WindowsPbufferWGLDrawable(WindowsWGLDrawableFactory.this, target,
sr.drawable,
- wglExt);
+ sr.context);
returnList.add(pbufferDrawable);
} finally {
sr.context.release();
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 f714c7719..c01072a6f 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
@@ -107,7 +107,7 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio
}
/** Update config - after having a valid and current context */
- protected void updateCapabilitiesByWGL(GLContextImpl context) {
+ protected void updateCapabilitiesByWGL(WindowsWGLContext context) {
if(choosenByWGLPixelFormat) return; // already done ..
GLCapabilitiesImmutable capabilities = (GLCapabilitiesImmutable) getRequestedCapabilities();
@@ -115,12 +115,11 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio
boolean usePBuffer = capabilities.isPBuffer();
GLProfile glp = capabilities.getGLProfile();
- WGLExt wglExt = (WGLExt) context.getPlatformGLExtensions();
GLDrawable drawable = context.getGLDrawable();
NativeSurface ns = drawable.getNativeSurface();
long hdc = ns.getSurfaceHandle();
- GLCapabilitiesImmutable[] caps = HDC2GLCapabilities(wglExt, hdc, getPixelFormatID(), glp, true, onscreen, usePBuffer);
+ GLCapabilitiesImmutable[] caps = HDC2GLCapabilities(context, hdc, getPixelFormatID(), glp, true, onscreen, usePBuffer);
if(null!=caps && null!=caps[0]) {
setCapsPFD(caps[0], getPixelFormat(), getPixelFormatID(), true);
}
@@ -145,19 +144,17 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio
public int getPixelFormatID() { return pixelfmtID; }
public boolean isChoosenByWGL() { return choosenByWGLPixelFormat; }
- private static int haveWGLChoosePixelFormatARB = -1;
- private static int haveWGLARBMultisample = -1;
-
- public static GLCapabilitiesImmutable[] HDC2GLCapabilities(WGLExt wglExt, long hdc, int pfdIDOnly,
+ public static GLCapabilitiesImmutable[] HDC2GLCapabilities(WindowsWGLContext sharedCtx, long hdc, int pfdIDOnly,
GLProfile glp, boolean relaxed, boolean onscreen, boolean usePBuffer) {
- if(haveWGLChoosePixelFormatARB<0) {
- haveWGLChoosePixelFormatARB = wglExt.isExtensionAvailable("WGL_ARB_pixel_format")?1:0;
- }
- if(haveWGLARBMultisample<0) {
- haveWGLARBMultisample = wglExt.isExtensionAvailable("WGL_ARB_multisample")?1:0;
+ boolean haveWGLChoosePixelFormatARB = sharedCtx.isExtensionAvailable("WGL_ARB_pixel_format");
+ boolean haveWGLARBMultisample = sharedCtx.isExtensionAvailable("WGL_ARB_multisample");
+ if(DEBUG) {
+ System.err.println("HDC2GLCapabilities: ARB_pixel_format: "+haveWGLChoosePixelFormatARB);
+ System.err.println("HDC2GLCapabilities: ARB_multisample : "+haveWGLARBMultisample);
}
- if (0==haveWGLChoosePixelFormatARB) {
+
+ if (!haveWGLChoosePixelFormatARB) {
return null;
}
@@ -176,6 +173,7 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio
int[] iattributes = new int [2*MAX_ATTRIBS];
int[] iresults = new int [2*MAX_ATTRIBS];
+ WGLExt wglExt = sharedCtx.getWGLExt();
iattributes[0] = WGLExt.WGL_NUMBER_PIXEL_FORMATS_ARB;
if (wglExt.wglGetPixelFormatAttribivARB(hdc, 0, 0, 1, iattributes, 0, iresults, 0)) {
numFormats = iresults[0];
@@ -208,7 +206,7 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio
iattributes[niattribs++] = WGLExt.WGL_ACCUM_GREEN_BITS_ARB;
iattributes[niattribs++] = WGLExt.WGL_ACCUM_BLUE_BITS_ARB;
iattributes[niattribs++] = WGLExt.WGL_ACCUM_ALPHA_BITS_ARB;
- if (1==haveWGLARBMultisample) {
+ if (haveWGLARBMultisample) {
iattributes[niattribs++] = WGLExt.WGL_SAMPLE_BUFFERS_ARB;
iattributes[niattribs++] = WGLExt.WGL_SAMPLES_ARB;
}
@@ -242,10 +240,17 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio
public static boolean GLCapabilities2AttribList(GLCapabilitiesImmutable caps,
int[] iattributes,
- WGLExt wglExt,
+ GLContextImpl sharedCtx,
boolean pbuffer,
int[] floatMode) throws GLException {
- if (!wglExt.isExtensionAvailable("WGL_ARB_pixel_format")) {
+ boolean haveWGLChoosePixelFormatARB = sharedCtx.isExtensionAvailable("WGL_ARB_pixel_format");
+ boolean haveWGLARBMultisample = sharedCtx.isExtensionAvailable("WGL_ARB_multisample");
+ if(DEBUG) {
+ System.err.println("HDC2GLCapabilities: ARB_pixel_format: "+haveWGLChoosePixelFormatARB);
+ System.err.println("HDC2GLCapabilities: ARB_multisample : "+haveWGLARBMultisample);
+ }
+
+ if (!haveWGLChoosePixelFormatARB) {
return false;
}
@@ -306,13 +311,11 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio
iattributes[niattribs++] = caps.getAccumAlphaBits();
}
- if (wglExt.isExtensionAvailable("WGL_ARB_multisample")) {
- if (caps.getSampleBuffers()) {
+ if (caps.getSampleBuffers() && haveWGLARBMultisample) {
iattributes[niattribs++] = WGLExt.WGL_SAMPLE_BUFFERS_ARB;
iattributes[niattribs++] = GL.GL_TRUE;
iattributes[niattribs++] = WGLExt.WGL_SAMPLES_ARB;
iattributes[niattribs++] = caps.getNumSamples();
- }
}
boolean rtt = caps.getPbufferRenderToTexture();
@@ -326,19 +329,19 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio
}
if (rect) {
- if (!wglExt.isExtensionAvailable("GL_NV_texture_rectangle")) {
+ if (!sharedCtx.isExtensionAvailable("GL_NV_texture_rectangle")) {
throw new GLException("Render-to-texture-rectangle requires GL_NV_texture_rectangle extension");
}
}
if (useFloat) {
- if (!wglExt.isExtensionAvailable("WGL_ATI_pixel_format_float") &&
- !wglExt.isExtensionAvailable("WGL_NV_float_buffer")) {
+ 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 (wglExt.isExtensionAvailable("WGL_NV_float_buffer")) {
+ if (sharedCtx.isExtensionAvailable("WGL_NV_float_buffer")) {
ati = false;
floatMode[0] = GLPbuffer.NV_FLOAT;
} else {
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 46b169343..4989d86a2 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
@@ -179,18 +179,21 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio
if(WindowsWGLGraphicsConfiguration.GLCapabilities2AttribList(capabilities,
iattributes,
- wglExt,
+ sharedContext,
false,
null)) {
int[] pformats = new int[WindowsWGLGraphicsConfiguration.MAX_PFORMATS];
int[] numFormatsTmp = new int[1];
if (wglExt.wglChoosePixelFormatARB(hdc,
- iattributes, 0,
- fattributes, 0,
- WindowsWGLGraphicsConfiguration.MAX_PFORMATS,
- pformats, 0,
- numFormatsTmp, 0)) {
+ iattributes, 0,
+ fattributes, 0,
+ WindowsWGLGraphicsConfiguration.MAX_PFORMATS,
+ pformats, 0,
+ numFormatsTmp, 0)) {
numFormats = numFormatsTmp[0];
+ if (DEBUG) {
+ System.err.println(getThreadName() + ": NumFormats (wglChoosePixelFormatARB) " + numFormats);
+ }
if (recommendedPixelFormat<=0 && numFormats > 0) {
recommendedPixelFormat = pformats[0];
if (DEBUG) {
@@ -215,7 +218,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio
}
}
- availableCaps = WindowsWGLGraphicsConfiguration.HDC2GLCapabilities(wglExt, hdc, -1, glProfile, pixelFormatSet, onscreen, usePBuffer);
+ availableCaps = WindowsWGLGraphicsConfiguration.HDC2GLCapabilities(sharedContext, hdc, -1, glProfile, pixelFormatSet, onscreen, usePBuffer);
gotAvailableCaps = null!=availableCaps ;
choosenBywGLPixelFormat = gotAvailableCaps ;
} else if (DEBUG) {
@@ -243,6 +246,10 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio
throw new GLException("Unable to enumerate pixel formats of window " +
toHexString(hdc) + " for GLCapabilitiesChooser (LastError: "+GDI.GetLastError()+")");
}
+ if (DEBUG) {
+ System.err.println(getThreadName() + ": NumFormats (DescribePixelFormat) " + numFormats);
+ }
+
availableCaps = new GLCapabilitiesImmutable[numFormats];
for (int i = 0; i < numFormats; i++) {
if (GDI.DescribePixelFormat(hdc, 1 + i, pfd.size(), pfd) == 0) {
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java
index 363881ef0..da4f2113d 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java
@@ -93,11 +93,6 @@ public class WindowsAWTWGLGraphicsConfigurationFactory extends GraphicsConfigura
System.err.println("WindowsAWTWGLGraphicsConfigurationFactory: got "+absScreen);
}
GraphicsConfiguration gc = device.getDefaultConfiguration();
- capsChosen = AWTGraphicsConfiguration.setupCapabilitiesRGBABits(capsChosen, gc);
- if(DEBUG) {
- System.err.println("AWT Colormodel compatible: "+capsChosen);
- }
-
WindowsGraphicsDevice winDevice = new WindowsGraphicsDevice(AbstractGraphicsDevice.DEFAULT_UNIT);
DefaultGraphicsScreen winScreen = new DefaultGraphicsScreen(winDevice, awtScreen.getIndex());
if(DEBUG) {
@@ -116,7 +111,9 @@ public class WindowsAWTWGLGraphicsConfigurationFactory extends GraphicsConfigura
if(DEBUG) {
System.err.println("WindowsAWTWGLGraphicsConfigurationFactory: chosen "+winConfig);
}
-
- return new AWTGraphicsConfiguration(awtScreen, winConfig.getChosenCapabilities(), winConfig.getRequestedCapabilities(), gc, winConfig);
+
+ // We have nothing to match .. so choose the default
+ return new AWTGraphicsConfiguration(awtScreen, winConfig.getChosenCapabilities(), winConfig.getRequestedCapabilities(),
+ gc, winConfig);
}
}