aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/opengl/x11
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-10-18 08:11:19 +0200
committerSven Gothel <[email protected]>2013-10-18 08:11:19 +0200
commit1c51abc1872b3cb984800fd76941a82dacd9e7b1 (patch)
tree1b26b1536c8b139b802573ea2a37260c51ea17b1 /src/jogl/classes/jogamp/opengl/x11
parent47d73819a71b7d9c4d2182a4de5712435832c5a1 (diff)
parentf1ae8ddb87c88a57dce4593f006881ef6a7f0932 (diff)
Merge remote-tracking branch 'hharrison/master'
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/x11')
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/GLXUtil.java44
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java6
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXDrawable.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java18
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java31
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDynamicLibraryBundleInfo.java22
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java62
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java47
8 files changed, 118 insertions, 114 deletions
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/GLXUtil.java b/src/jogl/classes/jogamp/opengl/x11/glx/GLXUtil.java
index 2c591cfbd..12e3db3bd 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/GLXUtil.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/GLXUtil.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -45,14 +45,14 @@ import com.jogamp.nativewindow.x11.X11GraphicsDevice;
public class GLXUtil {
public static final boolean DEBUG = Debug.debug("GLXUtil");
-
+
public static synchronized boolean isGLXAvailableOnServer(X11GraphicsDevice x11Device) {
if(null == x11Device) {
throw new IllegalArgumentException("null X11GraphicsDevice");
}
if(0 == x11Device.getHandle()) {
throw new IllegalArgumentException("null X11GraphicsDevice display handle");
- }
+ }
boolean glXAvailable = false;
x11Device.lock();
try {
@@ -60,17 +60,17 @@ public class GLXUtil {
} catch (Throwable t) { /* n/a */
} finally {
x11Device.unlock();
- }
- return glXAvailable;
+ }
+ return glXAvailable;
}
-
+
public static String getGLXClientString(X11GraphicsDevice x11Device, int name) {
x11Device.lock();
try {
return GLX.glXGetClientString(x11Device.getHandle(), name);
} finally {
x11Device.unlock();
- }
+ }
}
public static String queryGLXServerString(X11GraphicsDevice x11Device, int screen_idx, int name) {
x11Device.lock();
@@ -78,27 +78,27 @@ public class GLXUtil {
return GLX.glXQueryServerString(x11Device.getHandle(), screen_idx, name);
} finally {
x11Device.unlock();
- }
- }
+ }
+ }
public static String queryGLXExtensionsString(X11GraphicsDevice x11Device, int screen_idx) {
x11Device.lock();
try {
return GLX.glXQueryExtensionsString(x11Device.getHandle(), screen_idx);
} finally {
x11Device.unlock();
- }
+ }
}
-
+
public static VersionNumber getGLXServerVersionNumber(X11GraphicsDevice x11Device) {
final IntBuffer major = Buffers.newDirectIntBuffer(1);
final IntBuffer minor = Buffers.newDirectIntBuffer(1);
-
+
x11Device.lock();
try {
if (!GLX.glXQueryVersion(x11Device.getHandle(), major, minor)) {
throw new GLException("glXQueryVersion failed");
}
-
+
// Work around bugs in ATI's Linux drivers where they report they
// only implement GLX version 1.2 on the server side
if (major.get(0) == 1 && minor.get(0) == 2) {
@@ -117,7 +117,7 @@ public class GLXUtil {
}
return new VersionNumber(major.get(0), minor.get(0), 0);
}
-
+
public static boolean isMultisampleAvailable(String extensions) {
if (extensions != null) {
return (extensions.indexOf("GLX_ARB_multisample") >= 0);
@@ -142,8 +142,8 @@ public class GLXUtil {
public static VersionNumber getClientVersionNumber() {
return clientVersionNumber;
}
-
- public static synchronized void initGLXClientDataSingleton(X11GraphicsDevice x11Device) {
+
+ public static synchronized void initGLXClientDataSingleton(X11GraphicsDevice x11Device) {
if(null != clientVendorName) {
return; // already initialized
}
@@ -152,10 +152,10 @@ public class GLXUtil {
}
if(0 == x11Device.getHandle()) {
throw new IllegalArgumentException("null X11GraphicsDevice display handle");
- }
+ }
clientMultisampleAvailable = isMultisampleAvailable(GLX.glXGetClientString(x11Device.getHandle(), GLX.GLX_EXTENSIONS));
clientVendorName = GLX.glXGetClientString(x11Device.getHandle(), GLX.GLX_VENDOR);
-
+
int[] major = new int[1];
int[] minor = new int[1];
final String str = GLX.glXGetClientString(x11Device.getHandle(), GLX.GLX_VERSION);
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java
index 72e84b05e..ba88ff3c4 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java
@@ -79,15 +79,15 @@ public class X11ExternalGLXContext extends X11GLXContext {
long drawable = GLX.glXGetCurrentDrawable();
if (drawable == 0) {
throw new GLException("Error: attempted to make an external GLDrawable without a drawable/context current");
- }
+ }
IntBuffer val = Buffers.newDirectIntBuffer(1);
-
+
int w, h;
GLX.glXQueryDrawable(display, drawable, GLX.GLX_WIDTH, val);
w=val.get(0);
GLX.glXQueryDrawable(display, drawable, GLX.GLX_HEIGHT, val);
h=val.get(0);
-
+
GLX.glXQueryContext(display, ctx, GLX.GLX_SCREEN, val);
X11GraphicsScreen x11Screen = (X11GraphicsScreen) X11GraphicsScreen.createScreenDevice(display, val.get(0), false);
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXDrawable.java
index fca36c0cc..650fd31d3 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXDrawable.java
@@ -73,7 +73,7 @@ public class X11ExternalGLXDrawable extends X11GLXDrawable {
throw new GLException("Error: attempted to make an external GLDrawable without a drawable current");
}
IntBuffer val = Buffers.newDirectIntBuffer(1);
-
+
GLX.glXQueryContext(display, context, GLX.GLX_SCREEN, val);
X11GraphicsScreen x11Screen = (X11GraphicsScreen) X11GraphicsScreen.createScreenDevice(display, val.get(0), false);
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java
index 0ecf11a43..22a48e093 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java
@@ -142,7 +142,7 @@ public class X11GLXContext extends GLContextImpl {
if(null != glXServerVersion) {
return isGLXVersionGreaterEqualOneThree;
}
- glXServerVersion = ((X11GLXDrawableFactory)drawable.getFactoryImpl()).getGLXVersionNumber(drawable.getNativeSurface().getGraphicsConfiguration().getScreen().getDevice());
+ glXServerVersion = ((X11GLXDrawableFactory)drawable.getFactoryImpl()).getGLXVersionNumber(drawable.getNativeSurface().getGraphicsConfiguration().getScreen().getDevice());
isGLXVersionGreaterEqualOneThree = null != glXServerVersion ? glXServerVersion.compareTo(X11GLXDrawableFactory.versionOneThree) >= 0 : false;
return isGLXVersionGreaterEqualOneThree;
}
@@ -262,7 +262,7 @@ public class X11GLXContext extends GLContextImpl {
t.printStackTrace();
}
}
-
+
if(0!=ctx) {
if (!glXMakeContextCurrent(display, drawable.getHandle(), drawableRead.getHandle(), ctx)) {
if(DEBUG) {
@@ -419,7 +419,7 @@ public class X11GLXContext extends GLContextImpl {
if (GLX.glXGetCurrentContext() != contextHandle) {
if (!glXMakeContextCurrent(dpy, drawable.getHandle(), drawableRead.getHandle(), contextHandle)) {
- throw new GLException("Error making context " + toHexString(contextHandle) +
+ throw new GLException("Error making context " + toHexString(contextHandle) +
" current on Thread " + getThreadName() +
" with display " + toHexString(dpy) +
", drawableWrite " + toHexString(drawable.getHandle()) +
@@ -525,7 +525,7 @@ public class X11GLXContext extends GLContextImpl {
@Override
protected boolean setSwapIntervalImpl(int interval) {
- if( !drawable.getChosenGLCapabilities().isOnscreen() ) { return false; }
+ if( !drawable.getChosenGLCapabilities().isOnscreen() ) { return false; }
final GLXExt glXExt = getGLXExt();
if(0==hasSwapInterval) {
@@ -534,7 +534,7 @@ public class X11GLXContext extends GLContextImpl {
if( glXExt.isExtensionAvailable(GLXExtensions.GLX_MESA_swap_control) ) {
if(DEBUG) { System.err.println("X11GLXContext.setSwapInterval using: "+GLXExtensions.GLX_MESA_swap_control); }
hasSwapInterval = 1;
- } else */
+ } else */
if ( glXExt.isExtensionAvailable(GLXExtensions.GLX_SGI_swap_control) ) {
if(DEBUG) { System.err.println("X11GLXContext.setSwapInterval using: "+GLXExtensions.GLX_SGI_swap_control); }
hasSwapInterval = 2;
@@ -542,7 +542,7 @@ public class X11GLXContext extends GLContextImpl {
hasSwapInterval = -1;
}
} catch (Throwable t) { hasSwapInterval=-1; }
- }
+ }
/* try {
switch( hasSwapInterval ) {
case 1:
@@ -581,7 +581,7 @@ public class X11GLXContext extends GLContextImpl {
try {
final IntBuffer maxGroupsNIO = Buffers.newDirectIntBuffer(maxGroups.length - maxGroups_offset);
final IntBuffer maxBarriersNIO = Buffers.newDirectIntBuffer(maxBarriers.length - maxBarriers_offset);
-
+
if( glXExt.glXQueryMaxSwapGroupsNV(ns.getDisplayHandle(), ns.getScreenIndex(),
maxGroupsNIO, maxBarriersNIO) ) {
maxGroupsNIO.get(maxGroups, maxGroups_offset, maxGroupsNIO.remaining());
@@ -623,7 +623,7 @@ public class X11GLXContext extends GLContextImpl {
}
@Override
- public final ByteBuffer glAllocateMemoryNV(int size, float readFrequency, float writeFrequency, float priority) {
+ public final ByteBuffer glAllocateMemoryNV(int size, float readFrequency, float writeFrequency, float priority) {
return getGLXExt().glXAllocateMemoryNV(size, readFrequency, writeFrequency, priority);
}
@@ -631,7 +631,7 @@ public class X11GLXContext extends GLContextImpl {
public final void glFreeMemoryNV(ByteBuffer pointer) {
getGLXExt().glXFreeMemoryNV(pointer);
}
-
+
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java
index 5df458b7e..78e549508 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java
@@ -86,7 +86,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
public static final VersionNumber versionOneFour = new VersionNumber(1, 4, 0);
static final String GLX_SGIX_pbuffer = "GLX_SGIX_pbuffer";
-
+
private static DesktopGLDynamicLookupHelper x11GLXDynamicLookupHelper = null;
public X11GLXDrawableFactory() {
@@ -95,6 +95,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
synchronized(X11GLXDrawableFactory.class) {
if( null == x11GLXDynamicLookupHelper ) {
x11GLXDynamicLookupHelper = AccessController.doPrivileged(new PrivilegedAction<DesktopGLDynamicLookupHelper>() {
+ @Override
public DesktopGLDynamicLookupHelper run() {
DesktopGLDynamicLookupHelper tmp;
try {
@@ -134,7 +135,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
protected final boolean isComplete() {
return null != x11GLXDynamicLookupHelper;
}
-
+
@Override
protected final void destroy() {
if(null != sharedResourceRunner) {
@@ -205,7 +206,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
final public GLContextImpl getContext() { return context; }
@Override
public GLRendererQuirks getRendererQuirks() {
- return null != context ? context.getRendererQuirks() : null;
+ return null != context ? context.getRendererQuirks() : null;
}
final String getGLXVendorName() { return glXServerVendorName; }
@@ -251,18 +252,18 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
}
return res;
}
-
+
@Override
public SharedResourceRunner.Resource createSharedResource(String connection) {
final X11GraphicsDevice sharedDevice = new X11GraphicsDevice(X11Util.openDisplay(connection), AbstractGraphicsDevice.DEFAULT_UNIT, true /* owner */);
sharedDevice.lock();
try {
final X11GraphicsScreen sharedScreen = new X11GraphicsScreen(sharedDevice, sharedDevice.getDefaultScreen());
-
+
GLXUtil.initGLXClientDataSingleton(sharedDevice);
final String glXServerVendorName = GLX.glXQueryServerString(sharedDevice.getHandle(), 0, GLX.GLX_VENDOR);
final boolean glXServerMultisampleAvailable = GLXUtil.isMultisampleAvailable(GLX.glXQueryServerString(sharedDevice.getHandle(), 0, GLX.GLX_EXTENSIONS));
-
+
final GLProfile glp = GLProfile.get(sharedDevice, GLProfile.GL_PROFILE_LIST_MIN_DESKTOP, false);
if (null == glp) {
throw new GLException("Couldn't get default GLProfile for device: "+sharedDevice);
@@ -283,7 +284,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
if (null == sharedContext) {
throw new GLException("Couldn't create shared context for drawable: "+sharedDrawable);
}
-
+
boolean madeCurrent = false;
sharedContext.makeCurrent();
try {
@@ -493,12 +494,12 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
}
@Override
- protected final ProxySurface createMutableSurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice,
+ protected final ProxySurface createMutableSurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice,
GLCapabilitiesImmutable capsChosen,
GLCapabilitiesImmutable capsRequested,
GLCapabilitiesChooser chooser, UpstreamSurfaceHook upstreamHook) {
final X11GraphicsDevice device;
- if( createNewDevice || !(deviceReq instanceof X11GraphicsDevice) ) {
+ if( createNewDevice || !(deviceReq instanceof X11GraphicsDevice) ) {
device = new X11GraphicsDevice(X11Util.openDisplay(deviceReq.getConnection()), deviceReq.getUnitID(), true /* owner */);
} else {
device = (X11GraphicsDevice) deviceReq;
@@ -506,18 +507,18 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
final X11GraphicsScreen screen = new X11GraphicsScreen(device, device.getDefaultScreen());
final X11GLXGraphicsConfiguration config = X11GLXGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capsChosen, capsRequested, chooser, screen, VisualIDHolder.VID_UNDEFINED);
if(null == config) {
- throw new GLException("Choosing GraphicsConfiguration failed w/ "+capsChosen+" on "+screen);
+ throw new GLException("Choosing GraphicsConfiguration failed w/ "+capsChosen+" on "+screen);
}
return new WrappedSurface(config, 0, upstreamHook, createNewDevice);
}
-
+
@Override
- public final ProxySurface createDummySurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice,
+ public final ProxySurface createDummySurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice,
GLCapabilitiesImmutable chosenCaps, GLCapabilitiesImmutable requestedCaps, GLCapabilitiesChooser chooser, int width, int height) {
chosenCaps = GLGraphicsConfigurationUtil.fixOnscreenGLCapabilities(chosenCaps);
- return createMutableSurfaceImpl(deviceReq, createNewDevice, chosenCaps, requestedCaps, chooser, new X11DummyUpstreamSurfaceHook(width, height));
- }
-
+ return createMutableSurfaceImpl(deviceReq, createNewDevice, chosenCaps, requestedCaps, chooser, new X11DummyUpstreamSurfaceHook(width, height));
+ }
+
@Override
protected final ProxySurface createProxySurfaceImpl(AbstractGraphicsDevice deviceReq, int screenIdx, long windowHandle, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser, UpstreamSurfaceHook upstream) {
final X11GraphicsDevice device = new X11GraphicsDevice(X11Util.openDisplay(deviceReq.getConnection()), deviceReq.getUnitID(), true /* owner */);
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDynamicLibraryBundleInfo.java
index f25f7ae2c..951174f71 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDynamicLibraryBundleInfo.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDynamicLibraryBundleInfo.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package jogamp.opengl.x11.glx;
import jogamp.opengl.*;
@@ -40,8 +40,8 @@ public final class X11GLXDynamicLibraryBundleInfo extends DesktopGLDynamicLibrar
public final List<List<String>> getToolLibNames() {
final List<List<String>> libsList = new ArrayList<List<String>>();
final List<String> libsGL = new ArrayList<String>();
-
- // Be aware that on DRI systems, eg ATI fglrx, etc,
+
+ // Be aware that on DRI systems, eg ATI fglrx, etc,
// you have to set LIBGL_DRIVERS_PATH env variable.
// Eg on Ubuntu 64bit systems this is:
// export LIBGL_DRIVERS_PATH=/usr/lib/fglrx/dri:/usr/lib32/fglrx/dri
@@ -55,11 +55,11 @@ public final class X11GLXDynamicLibraryBundleInfo extends DesktopGLDynamicLibrar
// last but not least .. the generic one
libsGL.add("GL");
-
- libsList.add(libsGL);
+
+ libsList.add(libsGL);
return libsList;
- }
-
+ }
+
@Override
public final List<String> getToolGetProcAddressFuncNameList() {
List<String> res = new ArrayList<String>();
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java
index c23bd5337..4d1ed3985 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -61,14 +61,15 @@ import com.jogamp.nativewindow.x11.X11GraphicsScreen;
public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implements Cloneable {
public static final int MAX_ATTRIBS = 128;
- private GLCapabilitiesChooser chooser;
+ private GLCapabilitiesChooser chooser;
- X11GLXGraphicsConfiguration(X11GraphicsScreen screen,
+ X11GLXGraphicsConfiguration(X11GraphicsScreen screen,
X11GLCapabilities capsChosen, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser) {
super(screen, capsChosen, capsRequested, capsChosen.getXVisualInfo());
this.chooser=chooser;
}
+ @Override
public Object clone() {
return super.clone();
}
@@ -86,8 +87,8 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem
void updateGraphicsConfiguration() {
final CapabilitiesImmutable aChosenCaps = getChosenCapabilities();
if( !(aChosenCaps instanceof X11GLCapabilities) || VisualIDHolder.VID_UNDEFINED == aChosenCaps.getVisualID(VIDType.X11_XVISUAL) ) {
- // This case is actually quite impossible, since on X11 the visualID and hence GraphicsConfiguration
- // must be determined _before_ window creation!
+ // This case is actually quite impossible, since on X11 the visualID and hence GraphicsConfiguration
+ // must be determined _before_ window creation!
final X11GLXGraphicsConfiguration newConfig = (X11GLXGraphicsConfiguration)
GraphicsConfigurationFactory.getFactory(getScreen().getDevice(), aChosenCaps).chooseGraphicsConfiguration(
aChosenCaps, getRequestedCapabilities(), chooser, getScreen(), VisualIDHolder.VID_UNDEFINED);
@@ -121,7 +122,7 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem
glp = GLProfile.getDefault(x11Screen.getDevice());
}
final X11GLXDrawableFactory factory = (X11GLXDrawableFactory) GLDrawableFactory.getDesktopFactory();
- final X11GLCapabilities caps = GLXFBConfig2GLCapabilities(device, glp, fbcfg, GLGraphicsConfigurationUtil.ALL_BITS, factory.isGLXMultisampleAvailable(device));
+ final X11GLCapabilities caps = GLXFBConfig2GLCapabilities(device, glp, fbcfg, GLGraphicsConfigurationUtil.ALL_BITS, factory.isGLXMultisampleAvailable(device));
if(null==caps) {
throw new GLException("GLCapabilities null of "+toHexString(fbcfg));
}
@@ -130,7 +131,7 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem
static IntBuffer GLCapabilities2AttribList(GLCapabilitiesImmutable caps,
boolean forFBAttr, boolean isMultisampleAvailable,
- long display, int screen)
+ long display, int screen)
{
int colorDepth = (caps.getRedBits() +
caps.getGreenBits() +
@@ -143,7 +144,7 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem
if (forFBAttr) {
res.put(idx++, GLX.GLX_DRAWABLE_TYPE);
-
+
final int surfaceType;
if( caps.isOnscreen() ) {
surfaceType = GLX.GLX_WINDOW_BIT;
@@ -157,7 +158,7 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem
throw new GLException("no surface type set in caps: "+caps);
}
res.put(idx++, surfaceType);
-
+
res.put(idx++, GLX.GLX_RENDER_TYPE);
res.put(idx++, GLX.GLX_RGBA_BIT);
} else {
@@ -233,8 +234,8 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem
}
// FBConfig
-
- static boolean GLXFBConfigIDValid(long display, int screen, int fbcfgid) {
+
+ static boolean GLXFBConfigIDValid(long display, int screen, int fbcfgid) {
long fbcfg = X11GLXGraphicsConfiguration.glXFBConfigID2FBConfig(display, screen, fbcfgid);
return (0 != fbcfg) ? X11GLXGraphicsConfiguration.GLXFBConfigValid( display, fbcfg ) : false ;
}
@@ -278,8 +279,8 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem
int winattrmask, boolean isMultisampleAvailable) {
final int allDrawableTypeBits = FBCfgDrawableTypeBits(device, fbcfg);
int drawableTypeBits = winattrmask & allDrawableTypeBits;
-
- final long display = device.getHandle();
+
+ final long display = device.getHandle();
int fbcfgid = X11GLXGraphicsConfiguration.glXFBConfig2FBConfigID(display, fbcfg);
XVisualInfo visualInfo = GLX.glXGetVisualFromFBConfig(display, fbcfg);
if(null == visualInfo) {
@@ -307,8 +308,8 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem
res.setSampleBuffers(glXGetFBConfig(display, fbcfg, GLX.GLX_SAMPLE_BUFFERS, tmp) != 0);
res.setNumSamples (glXGetFBConfig(display, fbcfg, GLX.GLX_SAMPLES, tmp));
}
- final XRenderDirectFormat xrmask = ( null != visualInfo ) ?
- XVisual2XRenderMask( display, visualInfo.getVisual() ) :
+ final XRenderDirectFormat xrmask = ( null != visualInfo ) ?
+ XVisual2XRenderMask( display, visualInfo.getVisual() ) :
null ;
final int alphaMask = ( null != xrmask ) ? xrmask.getAlphaMask() : 0;
res.setBackgroundOpaque( 0 >= alphaMask );
@@ -318,7 +319,7 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem
res.setTransparentBlueValue(xrmask.getBlueMask());
res.setTransparentAlphaValue(alphaMask);
}
- // ALPHA shall be set at last - due to it's auto setting by the above (!opaque / samples)
+ // ALPHA shall be set at last - due to it's auto setting by the above (!opaque / samples)
res.setDoubleBuffered(glXGetFBConfig(display, fbcfg, GLX.GLX_DOUBLEBUFFER, tmp) != 0);
res.setStereo (glXGetFBConfig(display, fbcfg, GLX.GLX_STEREO, tmp) != 0);
res.setHardwareAccelerated(glXGetFBConfig(display, fbcfg, GLX.GLX_CONFIG_CAVEAT, tmp) != GLX.GLX_SLOW_CONFIG);
@@ -332,8 +333,8 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem
res.setAccumAlphaBits(glXGetFBConfig(display, fbcfg, GLX.GLX_ACCUM_ALPHA_SIZE, tmp));
res.setDepthBits (glXGetFBConfig(display, fbcfg, GLX.GLX_DEPTH_SIZE, tmp));
res.setStencilBits (glXGetFBConfig(display, fbcfg, GLX.GLX_STENCIL_SIZE, tmp));
-
- return (X11GLCapabilities) GLGraphicsConfigurationUtil.fixWinAttribBitsAndHwAccel(device, drawableTypeBits, res);
+
+ return (X11GLCapabilities) GLGraphicsConfigurationUtil.fixWinAttribBitsAndHwAccel(device, drawableTypeBits, res);
}
private static String glXGetFBConfigErrorCode(int err) {
@@ -363,7 +364,7 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem
static long glXFBConfigID2FBConfig(long display, int screen, int id) {
final IntBuffer attribs = Buffers.newDirectIntBuffer(new int[] { GLX.GLX_FBCONFIG_ID, id, 0 });
final IntBuffer count = Buffers.newDirectIntBuffer(1);
- count.put(0, -1);
+ count.put(0, -1);
PointerBuffer fbcfgsL = GLX.glXChooseFBConfig(display, screen, attribs, count);
if (fbcfgsL == null || fbcfgsL.limit()<1) {
return 0;
@@ -380,7 +381,7 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem
XVisualInfo[] infos = X11Lib.XGetVisualInfo(display, X11Lib.VisualIDMask, template, count, 0);
if (infos == null || infos.length == 0) {
return null;
- }
+ }
XVisualInfo res = XVisualInfo.create(infos[0]);
if (DEBUG) {
System.err.println("Fetched XVisualInfo for visual ID " + toHexString(visualID));
@@ -391,10 +392,10 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem
static X11GLCapabilities XVisualInfo2GLCapabilities(final X11GraphicsDevice device, GLProfile glp, XVisualInfo info,
final int winattrmask, boolean isMultisampleEnabled) {
- final int allDrawableTypeBits = GLGraphicsConfigurationUtil.WINDOW_BIT |
+ final int allDrawableTypeBits = GLGraphicsConfigurationUtil.WINDOW_BIT |
GLGraphicsConfigurationUtil.BITMAP_BIT |
GLGraphicsConfigurationUtil.FBO_BIT ;
-
+
final int drawableTypeBits = winattrmask & allDrawableTypeBits;
if( 0 == drawableTypeBits ) {
@@ -425,13 +426,13 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem
// Note: use of hardware acceleration is determined by
// glXCreateContext, not by the XVisualInfo. Optimistically claim
// that all GLCapabilities have the capability to be hardware
- // accelerated.
+ // accelerated.
if (isMultisampleEnabled) {
res.setSampleBuffers(glXGetConfig(display, info, GLX.GLX_SAMPLE_BUFFERS, tmp) != 0);
res.setNumSamples (glXGetConfig(display, info, GLX.GLX_SAMPLES, tmp));
}
- final XRenderDirectFormat xrmask = ( null != info ) ?
- XVisual2XRenderMask( display, info.getVisual() ) :
+ final XRenderDirectFormat xrmask = ( null != info ) ?
+ XVisual2XRenderMask( display, info.getVisual() ) :
null ;
final int alphaMask = ( null != xrmask ) ? xrmask.getAlphaMask() : 0;
res.setBackgroundOpaque( 0 >= alphaMask );
@@ -454,7 +455,7 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem
res.setAccumBlueBits (glXGetConfig(display, info, GLX.GLX_ACCUM_BLUE_SIZE, tmp));
res.setAccumAlphaBits(glXGetConfig(display, info, GLX.GLX_ACCUM_ALPHA_SIZE, tmp));
- return (X11GLCapabilities) GLGraphicsConfigurationUtil.fixWinAttribBitsAndHwAccel(device, drawableTypeBits, res);
+ return (X11GLCapabilities) GLGraphicsConfigurationUtil.fixWinAttribBitsAndHwAccel(device, drawableTypeBits, res);
}
private static String glXGetConfigErrorCode(int err) {
@@ -478,6 +479,7 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem
return tmp.get(tmp.position());
}
+ @Override
public String toString() {
return "X11GLXGraphicsConfiguration["+getScreen()+", visualID " + toHexString(getXVisualID()) + ", fbConfigID " + toHexString(getFBConfigID()) +
",\n\trequested " + getRequestedCapabilities()+
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java
index a7c7d3fe6..6050dabbb 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -92,6 +92,7 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF
private X11GLXGraphicsConfigurationFactory() {
}
+ @Override
protected AbstractGraphicsConfiguration chooseGraphicsConfigurationImpl(
CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested, CapabilitiesChooser chooser, AbstractGraphicsScreen absScreen, int nativeVisualID) {
if (!(absScreen instanceof X11GraphicsScreen)) {
@@ -109,7 +110,7 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF
if (chooser != null && !(chooser instanceof GLCapabilitiesChooser)) {
throw new IllegalArgumentException("This NativeWindowFactory accepts only GLCapabilitiesChooser objects");
}
-
+
if(!GLXUtil.isGLXAvailableOnServer((X11GraphicsDevice)absScreen.getDevice())) {
if(null != fallbackX11GraphicsConfigurationFactory) {
if(DEBUG) {
@@ -118,7 +119,7 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF
return fallbackX11GraphicsConfigurationFactory.chooseGraphicsConfiguration(capsChosen, capsRequested, chooser, absScreen, VisualIDHolder.VID_UNDEFINED);
}
throw new InternalError("No GLX and no fallback GraphicsConfigurationFactory available for: "+absScreen);
- }
+ }
return chooseGraphicsConfigurationStatic((GLCapabilitiesImmutable)capsChosen, (GLCapabilitiesImmutable)capsRequested,
(GLCapabilitiesChooser)chooser, (X11GraphicsScreen)absScreen, nativeVisualID);
}
@@ -134,7 +135,7 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF
final GLProfile glp = GLProfile.getDefault(device);
List<GLCapabilitiesImmutable> availableCaps = null;
-
+
sharedDevice.lock();
try {
if( sharedResource.isGLXVersionGreaterEqualOneThree() ) {
@@ -219,9 +220,9 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF
if (capsChosen == null) {
capsChosen = new GLCapabilities(null);
}
- X11GraphicsDevice x11Device = (X11GraphicsDevice) x11Screen.getDevice();
+ X11GraphicsDevice x11Device = (X11GraphicsDevice) x11Screen.getDevice();
X11GLXDrawableFactory factory = (X11GLXDrawableFactory) GLDrawableFactory.getDesktopFactory();
-
+
capsChosen = GLGraphicsConfigurationUtil.fixGLCapabilities( capsChosen, factory, x11Device);
final boolean usePBuffer = !capsChosen.isOnscreen() && capsChosen.isPBuffer();
@@ -262,7 +263,7 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF
return null;
}
final X11GLXDrawableFactory factory = (X11GLXDrawableFactory) GLDrawableFactory.getDesktopFactory();
-
+
final X11GLCapabilities caps = X11GLXGraphicsConfiguration.GLXFBConfig2GLCapabilities(x11Device, glp, fbcfg, GLGraphicsConfigurationUtil.ALL_BITS, factory.isGLXMultisampleAvailable(x11Device));
return new X11GLXGraphicsConfiguration(x11Screen, caps, caps, new DefaultGLCapabilitiesChooser());
}
@@ -280,8 +281,8 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF
X11GraphicsDevice x11Device = (X11GraphicsDevice) x11Screen.getDevice();
long display = x11Device.getHandle();
int screen = x11Screen.getIndex();
-
- final X11GLXDrawableFactory factory = (X11GLXDrawableFactory) GLDrawableFactory.getDesktopFactory();
+
+ final X11GLXDrawableFactory factory = (X11GLXDrawableFactory) GLDrawableFactory.getDesktopFactory();
final boolean isMultisampleAvailable = factory.isGLXMultisampleAvailable(x11Device);
final IntBuffer attribs = X11GLXGraphicsConfiguration.GLCapabilities2AttribList(capsChosen, true, isMultisampleAvailable, display, screen);
final IntBuffer count = Buffers.newDirectIntBuffer(1);
@@ -337,14 +338,14 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF
}
}
}
-
+
if(DEBUG) {
System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationFBConfig: got configs: "+availableCaps.size());
for(int i=0; i<availableCaps.size(); i++) {
System.err.println(i+": "+availableCaps.get(i));
}
}
-
+
if( VisualIDHolder.VID_UNDEFINED != xvisualID ) {
for(int i=0; i<availableCaps.size(); ) {
VisualIDHolder vidh = (VisualIDHolder) availableCaps.get(i);
@@ -363,7 +364,7 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF
System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationFBConfig: post filter visualID "+toHexString(xvisualID)+" got configs: "+availableCaps.size());
}
}
-
+
int chosenIndex = chooseCapabilities(chooser, capsChosen, availableCaps, recommendedIndex);
if ( 0 > chosenIndex ) {
if (DEBUG) {
@@ -393,15 +394,15 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF
X11GraphicsDevice absDevice = (X11GraphicsDevice) x11Screen.getDevice();
long display = absDevice.getHandle();
int screen = x11Screen.getIndex();
-
- final X11GLXDrawableFactory factory = (X11GLXDrawableFactory) GLDrawableFactory.getDesktopFactory();
- final boolean isMultisampleAvailable = factory.isGLXMultisampleAvailable(absDevice);
+
+ final X11GLXDrawableFactory factory = (X11GLXDrawableFactory) GLDrawableFactory.getDesktopFactory();
+ final boolean isMultisampleAvailable = factory.isGLXMultisampleAvailable(absDevice);
final IntBuffer attribs = X11GLXGraphicsConfiguration.GLCapabilities2AttribList(capsChosen, false, isMultisampleAvailable, display, screen);
XVisualInfo recommendedVis = null;
// 1st choice: get GLCapabilities based on users GLCapabilities setting recommendedIndex as preferred choice
// skipped if xvisualID is given
- if( VisualIDHolder.VID_UNDEFINED == xvisualID ) {
+ if( VisualIDHolder.VID_UNDEFINED == xvisualID ) {
recommendedVis = GLX.glXChooseVisual(display, screen, attribs);
if (DEBUG) {
System.err.print("glXChooseVisual recommended ");
@@ -441,7 +442,7 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF
System.err.println(i+": "+availableCaps.get(i));
}
}
-
+
if( VisualIDHolder.VID_UNDEFINED != xvisualID ) {
for(int i=0; i<availableCaps.size(); ) {
VisualIDHolder vidh = (VisualIDHolder) availableCaps.get(i);
@@ -453,14 +454,14 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF
}
if(0==availableCaps.size()) {
if(DEBUG) {
- System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationXVisual: post filter visualID "+toHexString(xvisualID )+" no config found, failed - return null");
+ System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationXVisual: post filter visualID "+toHexString(xvisualID )+" no config found, failed - return null");
}
return null;
} else if(DEBUG) {
System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationXVisual: post filter visualID "+toHexString(xvisualID)+" got configs: "+availableCaps.size());
}
}
-
+
int chosenIndex = chooseCapabilities(chooser, capsChosen, availableCaps, recommendedIndex);
if ( 0 > chosenIndex ) {
if (DEBUG) {