aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java29
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java112
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawableFactory.java18
3 files changed, 80 insertions, 79 deletions
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 08cee4dab..aafea36fd 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
@@ -158,27 +158,26 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
throw new IllegalArgumentException("Null target");
}
final List returnList = new ArrayList();
- final GLDrawableFactory factory = this;
- final WindowsWGLContext _sharedContext = sharedContext;
- final WindowsDummyWGLDrawable _sharedDrawable = sharedDrawable;
Runnable r = new Runnable() {
public void run() {
GLContext lastContext = GLContext.getCurrent();
if (lastContext != null) {
lastContext.release();
}
- _sharedContext.makeCurrent();
- WGLExt wglExt = _sharedContext.getWGLExt();
- try {
- GLDrawableImpl pbufferDrawable = new WindowsPbufferWGLDrawable(factory, target,
- _sharedDrawable,
- wglExt);
- returnList.add(pbufferDrawable);
- } finally {
- _sharedContext.release();
- if (lastContext != null) {
- lastContext.makeCurrent();
- }
+ synchronized(WindowsWGLDrawableFactory.this.sharedContext) {
+ WindowsWGLDrawableFactory.this.sharedContext.makeCurrent();
+ try {
+ WGLExt wglExt = WindowsWGLDrawableFactory.this.sharedContext.getWGLExt();
+ GLDrawableImpl pbufferDrawable = new WindowsPbufferWGLDrawable(WindowsWGLDrawableFactory.this, target,
+ WindowsWGLDrawableFactory.this.sharedDrawable,
+ wglExt);
+ returnList.add(pbufferDrawable);
+ } finally {
+ WindowsWGLDrawableFactory.this.sharedContext.release();
+ if (lastContext != null) {
+ lastContext.makeCurrent();
+ }
+ }
}
}
};
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 fd5a174c8..ae12d254a 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
@@ -136,68 +136,70 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio
pfd = WindowsWGLGraphicsConfiguration.createPixelFormatDescriptor();
// Produce a recommended pixel format selection for the GLCapabilitiesChooser.
// Use wglChoosePixelFormatARB if user requested multisampling and if we have it available
- factory.sharedContext.makeCurrent();
- WGLExt wglExt = factory.sharedContext.getWGLExt();
-
int recommendedPixelFormat = pixelFormat; // 1-based pixel format
- boolean haveWGLChoosePixelFormatARB = false;
boolean gotAvailableCaps = false;
- if (wglExt != null) {
- try {
- haveWGLChoosePixelFormatARB = wglExt.isExtensionAvailable("WGL_ARB_pixel_format");
- if (haveWGLChoosePixelFormatARB) {
- if(pixelFormat<=0) {
- int[] iattributes = new int [2*WindowsWGLGraphicsConfiguration.MAX_ATTRIBS];
- float[] fattributes = new float[1];
+ synchronized(factory.sharedContext) {
+ factory.sharedContext.makeCurrent();
+ try {
+ WGLExt wglExt = factory.sharedContext.getWGLExt();
- if(WindowsWGLGraphicsConfiguration.GLCapabilities2AttribList(capabilities,
- iattributes,
- wglExt,
- 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)) {
- numFormats = numFormatsTmp[0];
- if (recommendedPixelFormat<=0 && numFormats > 0) {
- recommendedPixelFormat = pformats[0];
- if (DEBUG) {
- System.err.println(getThreadName() + ": Used wglChoosePixelFormatARB to recommend pixel format " + recommendedPixelFormat);
- }
- }
- } else {
- if (DEBUG) {
- System.err.println(getThreadName() + ": wglChoosePixelFormatARB failed: " + GDI.GetLastError() );
- Thread.dumpStack();
- }
- }
- if (DEBUG) {
- if (recommendedPixelFormat <= 0) {
- System.err.print(getThreadName() + ": wglChoosePixelFormatARB didn't recommend a pixel format: "+GDI.GetLastError());
- if (capabilities.getSampleBuffers()) {
- System.err.print(" for multisampled GLCapabilities");
+ boolean haveWGLChoosePixelFormatARB = false;
+ if (wglExt != null) {
+ haveWGLChoosePixelFormatARB = wglExt.isExtensionAvailable("WGL_ARB_pixel_format");
+ if (haveWGLChoosePixelFormatARB) {
+ if(pixelFormat<=0) {
+ int[] iattributes = new int [2*WindowsWGLGraphicsConfiguration.MAX_ATTRIBS];
+ float[] fattributes = new float[1];
+
+ if(WindowsWGLGraphicsConfiguration.GLCapabilities2AttribList(capabilities,
+ iattributes,
+ wglExt,
+ 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)) {
+ numFormats = numFormatsTmp[0];
+ if (recommendedPixelFormat<=0 && numFormats > 0) {
+ recommendedPixelFormat = pformats[0];
+ if (DEBUG) {
+ System.err.println(getThreadName() + ": Used wglChoosePixelFormatARB to recommend pixel format " + recommendedPixelFormat);
+ }
+ }
+ } else {
+ if (DEBUG) {
+ System.err.println(getThreadName() + ": wglChoosePixelFormatARB failed: " + GDI.GetLastError() );
+ Thread.dumpStack();
+ }
+ }
+ if (DEBUG) {
+ if (recommendedPixelFormat <= 0) {
+ System.err.print(getThreadName() + ": wglChoosePixelFormatARB didn't recommend a pixel format: "+GDI.GetLastError());
+ if (capabilities.getSampleBuffers()) {
+ System.err.print(" for multisampled GLCapabilities");
+ }
+ System.err.println();
+ }
+ }
+ }
}
- System.err.println();
+
+ availableCaps = WindowsWGLGraphicsConfiguration.HDC2GLCapabilities(wglExt, hdc, -1, glProfile, pixelFormatSet, onscreen, usePBuffer);
+ gotAvailableCaps = null!=availableCaps ;
+ choosenBywGLPixelFormat = gotAvailableCaps ;
+ } else if (DEBUG) {
+ System.err.println(getThreadName() + ": wglChoosePixelFormatARB not available");
}
- }
}
- }
-
- availableCaps = WindowsWGLGraphicsConfiguration.HDC2GLCapabilities(wglExt, hdc, -1, glProfile, pixelFormatSet, onscreen, usePBuffer);
- gotAvailableCaps = null!=availableCaps ;
- choosenBywGLPixelFormat = gotAvailableCaps ;
- } else if (DEBUG) {
- System.err.println(getThreadName() + ": wglChoosePixelFormatARB not available");
+ } finally {
+ factory.sharedContext.release();
}
- } finally {
- factory.sharedContext.release();
- }
- }
+ } // synchronized(factory.sharedContext)
if (!gotAvailableCaps) {
if (DEBUG) {
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawableFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawableFactory.java
index 2ae53fb9d..4b84227c3 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawableFactory.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawableFactory.java
@@ -223,17 +223,17 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
* The dummy context shall also use the same Display,
* since switching Display in this regard is another ATI bug.
*/
- boolean usedSharedContext=false;
if( isVendorATI() && null == GLContext.getCurrent() ) {
- sharedContext.makeCurrent();
- usedSharedContext=true;
- }
- try {
- pbufferDrawable = new X11PbufferGLXDrawable(this, target);
- } finally {
- if(usedSharedContext) {
- sharedContext.release();
+ synchronized(sharedContext) {
+ sharedContext.makeCurrent();
+ try {
+ pbufferDrawable = new X11PbufferGLXDrawable(this, target);
+ } finally {
+ sharedContext.release();
+ }
}
+ } else {
+ pbufferDrawable = new X11PbufferGLXDrawable(this, target);
}
return pbufferDrawable;
}