aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/sun/opengl/impl/x11
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes/com/sun/opengl/impl/x11')
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXContext.java32
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawableFactory.java18
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXGraphicsConfigurationFactory.java23
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/x11/glx/X11OffscreenGLXDrawable.java5
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/x11/glx/X11PbufferGLXDrawable.java5
5 files changed, 55 insertions, 28 deletions
diff --git a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXContext.java b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXContext.java
index d5a5f3433..42b0f2a5f 100644
--- a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXContext.java
+++ b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXContext.java
@@ -50,7 +50,6 @@ import com.sun.nativewindow.impl.x11.*;
import com.sun.gluegen.runtime.ProcAddressTable;
public abstract class X11GLXContext extends GLContextImpl {
- protected X11GLXDrawable drawable;
protected long context;
private boolean glXQueryExtensionsStringInitialized;
private boolean glXQueryExtensionsStringAvailable;
@@ -66,10 +65,14 @@ public abstract class X11GLXContext extends GLContextImpl {
functionNameMap.put("glFreeMemoryNV", "glXFreeMemoryNV");
}
- public X11GLXContext(X11GLXDrawable drawable,
+ public X11GLXContext(GLDrawableImpl drawable, GLDrawableImpl drawableRead,
GLContext shareWith) {
- super(drawable.getGLProfile(), shareWith);
- this.drawable = drawable;
+ super(drawable, drawableRead, shareWith);
+ }
+
+ public X11GLXContext(GLDrawableImpl drawable,
+ GLContext shareWith) {
+ this(drawable, null, shareWith);
}
public final ProcAddressTable getPlatformExtProcAddressTable() {
@@ -91,10 +94,6 @@ public abstract class X11GLXContext extends GLContextImpl {
return glXExt;
}
- public GLDrawable getGLDrawable() {
- return drawable;
- }
-
protected String mapToRealGLFunctionName(String glFunctionName) {
String lookup = (String) functionNameMap.get(glFunctionName);
if (lookup != null) {
@@ -150,7 +149,7 @@ public abstract class X11GLXContext extends GLContextImpl {
}
if (!GLX.glXMakeContextCurrent(display,
drawable.getNativeWindow().getSurfaceHandle(),
- drawable.getNativeWindow().getSurfaceHandle(),
+ drawableRead.getNativeWindow().getSurfaceHandle(),
context)) {
throw new GLException("Error making temp context (old2) current: display 0x"+Long.toHexString(display)+", context 0x"+Long.toHexString(context)+", drawable "+drawable);
}
@@ -169,7 +168,7 @@ public abstract class X11GLXContext extends GLContextImpl {
} else {
if (!GLX.glXMakeContextCurrent(display,
drawable.getNativeWindow().getSurfaceHandle(),
- drawable.getNativeWindow().getSurfaceHandle(),
+ drawableRead.getNativeWindow().getSurfaceHandle(),
temp_context)) {
throw new GLException("Error making temp context (old) current: display 0x"+Long.toHexString(display)+", context 0x"+Long.toHexString(context)+", drawable "+drawable);
}
@@ -213,7 +212,7 @@ public abstract class X11GLXContext extends GLContextImpl {
if(0!=context) {
if (!GLX.glXMakeContextCurrent(display,
drawable.getNativeWindow().getSurfaceHandle(),
- drawable.getNativeWindow().getSurfaceHandle(),
+ drawableRead.getNativeWindow().getSurfaceHandle(),
context)) {
if(DEBUG) {
System.err.println("X11GLXContext.createContext couldn't make >= 3.2 core context current - fallback");
@@ -244,7 +243,7 @@ public abstract class X11GLXContext extends GLContextImpl {
if(0!=context) {
if (!GLX.glXMakeContextCurrent(display,
drawable.getNativeWindow().getSurfaceHandle(),
- drawable.getNativeWindow().getSurfaceHandle(),
+ drawableRead.getNativeWindow().getSurfaceHandle(),
context)) {
if(DEBUG) {
System.err.println("X11GLXContext.createContext couldn't make >= 3.0 core context current - fallback");
@@ -273,7 +272,7 @@ public abstract class X11GLXContext extends GLContextImpl {
context = temp_context;
if (!GLX.glXMakeContextCurrent(display,
drawable.getNativeWindow().getSurfaceHandle(),
- drawable.getNativeWindow().getSurfaceHandle(),
+ drawableRead.getNativeWindow().getSurfaceHandle(),
context)) {
GLX.glXMakeContextCurrent(display, 0, 0, 0);
GLX.glXDestroyContext(display, temp_context);
@@ -316,9 +315,10 @@ public abstract class X11GLXContext extends GLContextImpl {
}
if (GLX.glXGetCurrentContext() != context) {
+
if (!GLX.glXMakeContextCurrent(drawable.getNativeWindow().getDisplayHandle(),
drawable.getNativeWindow().getSurfaceHandle(),
- drawable.getNativeWindow().getSurfaceHandle(),
+ drawableRead.getNativeWindow().getSurfaceHandle(),
context)) {
throw new GLException("Error making context current");
}
@@ -326,6 +326,7 @@ public abstract class X11GLXContext extends GLContextImpl {
System.err.println(getThreadName() + ": glXMakeCurrent(display " +
toHexString(drawable.getNativeWindow().getDisplayHandle()) +
", drawable " + toHexString(drawable.getNativeWindow().getSurfaceHandle()) +
+ ", drawableRead " + toHexString(drawableRead.getNativeWindow().getSurfaceHandle()) +
", context " + toHexString(context) + ") succeeded");
}
}
@@ -402,6 +403,9 @@ public abstract class X11GLXContext extends GLContextImpl {
if (DEBUG) {
System.err.println(getThreadName() + ": !!! Initializing GLX extension address table");
}
+ glXQueryExtensionsStringInitialized = false;
+ glXQueryExtensionsStringAvailable = false;
+
if (glXExtProcAddressTable == null) {
// FIXME: cache ProcAddressTables by capability bits so we can
// share them among contexts with the same capabilities
diff --git a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawableFactory.java b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawableFactory.java
index 456e04b77..8ee1efcb7 100644
--- a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawableFactory.java
+++ b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawableFactory.java
@@ -77,6 +77,8 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl implements Dyna
int width,
int height) {
AbstractGraphicsScreen screen = X11GraphicsScreen.createDefault();
+ capabilities.setOnscreen(false);
+ capabilities.setPBuffer(false);
return new X11OffscreenGLXDrawable(this, screen, capabilities, chooser, width, height);
}
@@ -114,13 +116,16 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl implements Dyna
return canCreateGLPbuffer;
}
- public GLDrawableImpl createGLPbufferDrawable(final GLCapabilities capabilities,
+ public GLDrawableImpl createGLPbufferDrawable(GLCapabilities capabilities,
final GLCapabilitiesChooser chooser,
final int initialWidth,
final int initialHeight) {
if (!canCreateGLPbuffer()) {
throw new GLException("Pbuffer support not available with current graphics card");
}
+
+ capabilities.setOnscreen(false);
+ capabilities.setPBuffer(true);
AbstractGraphicsScreen screen = X11GraphicsScreen.createDefault();
return new X11PbufferGLXDrawable(this, screen, capabilities, chooser,
initialWidth, initialHeight);
@@ -131,7 +136,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl implements Dyna
final int initialWidth,
final int initialHeight,
final GLContext shareWith) {
- GLDrawableImpl drawable = createGLPbufferDrawable( capabilities, chooser, initialWidth, initialHeight);
+ GLDrawableImpl drawable = createGLPbufferDrawable(capabilities, chooser, initialWidth, initialHeight);
return new GLPbufferImpl(drawable, shareWith);
}
@@ -161,6 +166,15 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl implements Dyna
return res;
}
+ private void maybeDoSingleThreadedWorkaround(Runnable action) {
+ if (Threading.isSingleThreaded() &&
+ !Threading.isOpenGLThread()) {
+ Threading.invokeOnOpenGLThread(action);
+ } else {
+ action.run();
+ }
+ }
+
public boolean canCreateContextOnJava2DSurface() {
return false;
}
diff --git a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXGraphicsConfigurationFactory.java b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXGraphicsConfigurationFactory.java
index 074fbda5f..0d19d2063 100644
--- a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXGraphicsConfigurationFactory.java
@@ -58,7 +58,7 @@ public class X11GLXGraphicsConfigurationFactory extends GraphicsConfigurationFac
public AbstractGraphicsConfiguration chooseGraphicsConfiguration(Capabilities capabilities,
CapabilitiesChooser chooser,
AbstractGraphicsScreen absScreen) {
- return chooseGraphicsConfigurationStatic(capabilities, chooser, absScreen, capabilities.isOnscreen(), false);
+ return chooseGraphicsConfigurationStatic(capabilities, chooser, absScreen);
}
protected static X11GLXGraphicsConfiguration createDefaultGraphicsConfiguration(AbstractGraphicsScreen absScreen, boolean onscreen, boolean usePBuffer) {
@@ -114,8 +114,7 @@ public class X11GLXGraphicsConfigurationFactory extends GraphicsConfigurationFac
protected static X11GLXGraphicsConfiguration chooseGraphicsConfigurationStatic(Capabilities capabilities,
CapabilitiesChooser chooser,
- AbstractGraphicsScreen absScreen,
- boolean onscreen, boolean usePBuffer) {
+ AbstractGraphicsScreen absScreen) {
if (absScreen == null) {
throw new IllegalArgumentException("AbstractGraphicsScreen is null");
}
@@ -138,21 +137,25 @@ public class X11GLXGraphicsConfigurationFactory extends GraphicsConfigurationFac
if (capabilities == null) {
capabilities = new GLCapabilities(null);
}
- capabilities.setOnscreen (onscreen);
- ((GLCapabilities)capabilities).setPBuffer (usePBuffer);
- if(!onscreen) {
- ((GLCapabilities)capabilities).setDoubleBuffered(false);
+
+ boolean onscreen = capabilities.isOnscreen();
+ boolean usePBuffer = ((GLCapabilities)capabilities).isPBuffer();
+
+ GLCapabilities caps2 = (GLCapabilities) capabilities.clone();
+ if(!caps2.isOnscreen()) {
+ // OFFSCREEN !DOUBLE_BUFFER
+ caps2.setDoubleBuffered(false);
}
X11GLXGraphicsConfiguration res;
- res = chooseGraphicsConfigurationFBConfig((GLCapabilities) capabilities,
+ res = chooseGraphicsConfigurationFBConfig((GLCapabilities) caps2,
(GLCapabilitiesChooser) chooser,
x11Screen);
if(null==res) {
if(usePBuffer) {
throw new GLException("Error: Couldn't create X11GLXGraphicsConfiguration based on FBConfig");
}
- res = chooseGraphicsConfigurationXVisual((GLCapabilities) capabilities,
+ res = chooseGraphicsConfigurationXVisual((GLCapabilities) caps2,
(GLCapabilitiesChooser) chooser,
x11Screen);
}
@@ -160,7 +163,7 @@ public class X11GLXGraphicsConfigurationFactory extends GraphicsConfigurationFac
throw new GLException("Error: Couldn't create X11GLXGraphicsConfiguration");
}
if(DEBUG) {
- System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationStatic("+x11Screen+","+capabilities+", pbuffer "+usePBuffer+"): "+res);
+ System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationStatic("+x11Screen+","+caps2+"): "+res);
}
return res;
}
diff --git a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11OffscreenGLXDrawable.java b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11OffscreenGLXDrawable.java
index 768f6b8e8..4c4546854 100644
--- a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11OffscreenGLXDrawable.java
+++ b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11OffscreenGLXDrawable.java
@@ -53,7 +53,7 @@ public class X11OffscreenGLXDrawable extends X11GLXDrawable {
GLCapabilitiesChooser chooser,
int width,
int height) {
- super(factory, new NullWindow(X11GLXGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(caps, chooser, screen, false, false)), true);
+ super(factory, new NullWindow(X11GLXGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(caps, chooser, screen)), true);
((NullWindow) getNativeWindow()).setSize(width, height);
create();
}
@@ -134,5 +134,8 @@ public class X11OffscreenGLXDrawable extends X11GLXDrawable {
}
}
protected void swapBuffersImpl() {
+ if(DEBUG) {
+ System.err.println("unhandled swapBuffersImpl() called for: "+this);
+ }
}
}
diff --git a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11PbufferGLXDrawable.java b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11PbufferGLXDrawable.java
index bee24fa47..0f758a2f7 100644
--- a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11PbufferGLXDrawable.java
+++ b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11PbufferGLXDrawable.java
@@ -51,7 +51,7 @@ public class X11PbufferGLXDrawable extends X11GLXDrawable {
GLCapabilities caps,
GLCapabilitiesChooser chooser,
int width, int height) {
- super(factory, new NullWindow(X11GLXGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(caps, chooser, screen, false, true)), true);
+ super(factory, new NullWindow(X11GLXGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(caps, chooser, screen)), true);
if (width <= 0 || height <= 0) {
throw new GLException("Width and height of pbuffer must be positive (were (" +
width + ", " + height + "))");
@@ -149,5 +149,8 @@ public class X11PbufferGLXDrawable extends X11GLXDrawable {
}
protected void swapBuffersImpl() {
+ if(DEBUG) {
+ System.err.println("unhandled swapBuffersImpl() called for: "+this);
+ }
}
}