summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/jogamp
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes/com/jogamp')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/GLContextImpl.java4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/GLDrawableFactoryImpl.java48
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/GLDrawableImpl.java12
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/GLPbufferImpl.java6
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawable.java11
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawableFactory.java4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/egl/EGLGraphicsConfiguration.java19
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/egl/EGLGraphicsConfigurationFactory.java114
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/egl/EGLPbufferDrawable.java10
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLContext.java8
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java15
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLGraphicsConfigurationFactory.java41
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXExternalCGLContext.java2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java8
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/awt/MacOSXAWTCGLGraphicsConfigurationFactory.java56
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsDummyWGLDrawable.java20
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsOffscreenWGLDrawable.java4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsPbufferWGLContext.java2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsPbufferWGLDrawable.java8
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLContext.java4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java9
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfiguration.java39
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java62
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java56
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11DummyGLXDrawable.java9
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXContext.java4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawableFactory.java8
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXGraphicsConfiguration.java20
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXGraphicsConfigurationFactory.java124
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OffscreenGLXContext.java2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11PbufferGLXDrawable.java2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/x11/glx/awt/X11AWTGLXGraphicsConfigurationFactory.java21
34 files changed, 448 insertions, 310 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/GLContextImpl.java b/src/jogl/classes/com/jogamp/opengl/impl/GLContextImpl.java
index 6c15a2d92..4892303e3 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/GLContextImpl.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/GLContextImpl.java
@@ -54,7 +54,7 @@ import javax.media.nativewindow.AbstractGraphicsConfiguration;
import javax.media.nativewindow.AbstractGraphicsDevice;
import javax.media.nativewindow.NativeSurface;
import javax.media.opengl.GL;
-import javax.media.opengl.GLCapabilities;
+import javax.media.opengl.GLCapabilitiesImmutable;
import javax.media.opengl.GLContext;
import javax.media.opengl.GLDrawable;
import javax.media.opengl.GLException;
@@ -499,7 +499,7 @@ public abstract class GLContextImpl extends GLContext {
{
AbstractGraphicsConfiguration config = drawable.getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration();
AbstractGraphicsDevice device = config.getScreen().getDevice();
- GLCapabilities glCaps = (GLCapabilities) config.getChosenCapabilities();
+ GLCapabilitiesImmutable glCaps = (GLCapabilitiesImmutable) config.getChosenCapabilities();
GLProfile glp = glCaps.getGLProfile();
if (DEBUG) {
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableFactoryImpl.java b/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableFactoryImpl.java
index 43f705e34..ef5f67081 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableFactoryImpl.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableFactoryImpl.java
@@ -71,7 +71,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
throw new IllegalArgumentException("Null target");
}
AbstractGraphicsConfiguration config = target.getGraphicsConfiguration().getNativeGraphicsConfiguration();
- GLCapabilities caps = (GLCapabilities) config.getChosenCapabilities();
+ GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable) config.getChosenCapabilities();
AbstractGraphicsDevice adevice = config.getScreen().getDevice();
GLDrawable result = null;
adevice.lock();
@@ -131,7 +131,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
return createGLPbufferDrawableImpl(target);
}
- public GLDrawable createGLPbufferDrawable(GLCapabilities capabilities,
+ public GLDrawable createGLPbufferDrawable(GLCapabilitiesImmutable capsRequested,
GLCapabilitiesChooser chooser,
int width,
int height) {
@@ -139,18 +139,28 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
throw new GLException("Width and height of pbuffer must be positive (were (" +
width + ", " + height + "))");
}
- capabilities.setDoubleBuffered(false); // FIXME DBLBUFOFFSCRN
- capabilities.setOnscreen(false);
- capabilities.setPBuffer(true);
+
+ GLCapabilitiesImmutable capsChosen;
+
+ if( capsRequested.getDoubleBuffered() || capsRequested.isOnscreen() || !capsRequested.isPBuffer()) {
+ // fix caps ..
+ GLCapabilities caps2 = (GLCapabilities) capsRequested.cloneMutable();
+ caps2.setDoubleBuffered(false); // FIXME DBLBUFOFFSCRN
+ caps2.setOnscreen(false);
+ caps2.setPBuffer(true);
+ capsChosen = caps2;
+ } else {
+ capsChosen = capsRequested;
+ }
NativeWindowFactory.getDefaultToolkitLock().lock();
try {
- return createGLPbufferDrawable( createOffscreenSurfaceImpl(capabilities, chooser, height, height) );
+ return createGLPbufferDrawable( createOffscreenSurfaceImpl(capsChosen, capsRequested, chooser, height, height) );
} finally {
NativeWindowFactory.getDefaultToolkitLock().unlock();
}
}
- public GLPbuffer createGLPbuffer(GLCapabilities capabilities,
+ public GLPbuffer createGLPbuffer(GLCapabilitiesImmutable capabilities,
GLCapabilitiesChooser chooser,
int width,
int height,
@@ -167,7 +177,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
protected abstract GLDrawableImpl createOffscreenDrawableImpl(NativeSurface target) ;
- public GLDrawable createOffscreenDrawable(GLCapabilities capabilities,
+ public GLDrawable createOffscreenDrawable(GLCapabilitiesImmutable capsRequested,
GLCapabilitiesChooser chooser,
int width,
int height) {
@@ -175,12 +185,21 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
throw new GLException("Width and height of pbuffer must be positive (were (" +
width + ", " + height + "))");
}
- capabilities.setDoubleBuffered(false); // FIXME DBLBUFOFFSCRN
- capabilities.setOnscreen(false);
- capabilities.setPBuffer(false);
+ GLCapabilitiesImmutable capsChosen;
+
+ if( capsRequested.getDoubleBuffered() || capsRequested.isOnscreen() || capsRequested.isPBuffer()) {
+ // fix caps ..
+ GLCapabilities caps2 = (GLCapabilities) capsRequested.cloneMutable();
+ caps2.setDoubleBuffered(false); // FIXME DBLBUFOFFSCRN
+ caps2.setOnscreen(false);
+ caps2.setPBuffer(false);
+ capsChosen = caps2;
+ } else {
+ capsChosen = capsRequested;
+ }
NativeWindowFactory.getDefaultToolkitLock().lock();
try {
- return createOffscreenDrawableImpl( createOffscreenSurfaceImpl(capabilities, chooser, width, height) );
+ return createOffscreenDrawableImpl( createOffscreenSurfaceImpl(capsChosen, capsRequested, chooser, width, height) );
} finally {
NativeWindowFactory.getDefaultToolkitLock().unlock();
}
@@ -190,8 +209,9 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
* creates an offscreen NativeSurface, which must implement SurfaceChangeable as well,
* so the windowing system related implementation is able to set the surface handle.
*/
- protected abstract NativeSurface createOffscreenSurfaceImpl(GLCapabilities capabilities, GLCapabilitiesChooser chooser,
- int width, int height);
+ protected abstract NativeSurface createOffscreenSurfaceImpl(GLCapabilitiesImmutable capabilities, GLCapabilitiesImmutable capsRequested,
+ GLCapabilitiesChooser chooser,
+ int width, int height);
//---------------------------------------------------------------------------
//
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableImpl.java b/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableImpl.java
index e68ee3644..d7d2836aa 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableImpl.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableImpl.java
@@ -52,7 +52,7 @@ public abstract class GLDrawableImpl implements GLDrawable {
this.factory = factory;
this.surface = comp;
this.realized = realized;
- this.requestedCapabilities = (GLCapabilities)surface.getGraphicsConfiguration().getNativeGraphicsConfiguration().getRequestedCapabilities(); // a copy ..
+ this.requestedCapabilities = (GLCapabilitiesImmutable) surface.getGraphicsConfiguration().getNativeGraphicsConfiguration().getRequestedCapabilities();
}
/**
@@ -79,7 +79,7 @@ public abstract class GLDrawableImpl implements GLDrawable {
}
public final void swapBuffers() throws GLException {
- GLCapabilities caps = (GLCapabilities)surface.getGraphicsConfiguration().getNativeGraphicsConfiguration().getChosenCapabilities();
+ GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable)surface.getGraphicsConfiguration().getNativeGraphicsConfiguration().getChosenCapabilities();
if ( caps.getDoubleBuffered() ) {
if(!surface.surfaceSwap()) {
int lockRes = lockSurface(); // it's recursive, so it's ok within [makeCurrent .. release]
@@ -114,11 +114,11 @@ public abstract class GLDrawableImpl implements GLDrawable {
return requestedCapabilities.getGLProfile();
}
- public GLCapabilities getChosenGLCapabilities() {
- return (GLCapabilities)surface.getGraphicsConfiguration().getNativeGraphicsConfiguration().getChosenCapabilities(); // a copy
+ public GLCapabilitiesImmutable getChosenGLCapabilities() {
+ return (GLCapabilitiesImmutable) surface.getGraphicsConfiguration().getNativeGraphicsConfiguration().getChosenCapabilities();
}
- public GLCapabilities getRequestedGLCapabilities() {
+ public GLCapabilitiesImmutable getRequestedGLCapabilities() {
return requestedCapabilities;
}
@@ -204,7 +204,7 @@ public abstract class GLDrawableImpl implements GLDrawable {
protected GLDrawableFactory factory;
protected NativeSurface surface;
- protected GLCapabilities requestedCapabilities;
+ protected GLCapabilitiesImmutable requestedCapabilities;
// Indicates whether the surface (if an onscreen context) has been
// realized. Plausibly, before the surface is realized the JAWT
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/GLPbufferImpl.java b/src/jogl/classes/com/jogamp/opengl/impl/GLPbufferImpl.java
index 7a30f9a6f..d282d2f84 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/GLPbufferImpl.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/GLPbufferImpl.java
@@ -64,7 +64,7 @@ public class GLPbufferImpl implements GLPbuffer {
public GLPbufferImpl(GLDrawableImpl pbufferDrawable,
GLContext parentContext) {
- GLCapabilities caps = (GLCapabilities)
+ GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable)
pbufferDrawable.getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration().getChosenCapabilities();
if(caps.isOnscreen()) {
if(caps.isPBuffer()) {
@@ -195,14 +195,14 @@ public class GLPbufferImpl implements GLPbuffer {
context.releasePbufferFromTexture();
}
- public GLCapabilities getChosenGLCapabilities() {
+ public GLCapabilitiesImmutable getChosenGLCapabilities() {
if (pbufferDrawable == null)
return null;
return pbufferDrawable.getChosenGLCapabilities();
}
- public GLCapabilities getRequestedGLCapabilities() {
+ public GLCapabilitiesImmutable getRequestedGLCapabilities() {
if (pbufferDrawable == null)
return null;
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawable.java
index 81dcc12d5..88685faf7 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawable.java
@@ -69,8 +69,8 @@ public abstract class EGLDrawable extends GLDrawableImpl {
return eglConfig;
}
- public GLCapabilities getChosenGLCapabilities() {
- return (null==eglConfig)?super.getChosenGLCapabilities():(GLCapabilities)eglConfig.getChosenCapabilities();
+ public GLCapabilitiesImmutable getChosenGLCapabilities() {
+ return (null==eglConfig)?super.getChosenGLCapabilities():(GLCapabilitiesImmutable)eglConfig.getChosenCapabilities();
}
public abstract GLContext createContext(GLContext shareWith);
@@ -168,8 +168,11 @@ public abstract class EGLDrawable extends GLDrawableImpl {
}
EGLGraphicsDevice e = new EGLGraphicsDevice(eglDisplay, AbstractGraphicsDevice.DEFAULT_UNIT);
DefaultGraphicsScreen s = new DefaultGraphicsScreen(e, aConfig.getScreen().getIndex());
- GLCapabilities caps = (GLCapabilities) aConfig.getChosenCapabilities(); // yes, use the already choosen Capabilities (x11,win32,..)
- eglConfig = (EGLGraphicsConfiguration) GraphicsConfigurationFactory.getFactory(e).chooseGraphicsConfiguration(caps, null, s);
+ // yes, use the already choosen/requested Capabilities (x11,win32,..)
+ GLCapabilitiesImmutable capsChosen = (GLCapabilitiesImmutable) aConfig.getChosenCapabilities();
+ GLCapabilitiesImmutable capsRequested = (GLCapabilitiesImmutable) aConfig.getRequestedCapabilities();
+ eglConfig = (EGLGraphicsConfiguration) GraphicsConfigurationFactory.getFactory(e).chooseGraphicsConfiguration(
+ capsChosen, capsRequested, null, s);
if (null == eglConfig) {
throw new GLException("Couldn't create EGLGraphicsConfiguration from "+s);
} else if(DEBUG) {
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawableFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawableFactory.java
index 3c8c4c98f..737aa5519 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawableFactory.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawableFactory.java
@@ -163,8 +163,8 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
return new EGLPbufferDrawable(this, target);
}
- protected NativeSurface createOffscreenSurfaceImpl(GLCapabilities capabilities, GLCapabilitiesChooser chooser, int width, int height) {
- ProxySurface ns = new ProxySurface(EGLGraphicsConfigurationFactory.createOffscreenGraphicsConfiguration(capabilities, chooser));
+ protected NativeSurface createOffscreenSurfaceImpl(GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser, int width, int height) {
+ ProxySurface ns = new ProxySurface(EGLGraphicsConfigurationFactory.createOffscreenGraphicsConfiguration(capsChosen, capsRequested, chooser));
ns.setSize(width, height);
return ns;
}
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLGraphicsConfiguration.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLGraphicsConfiguration.java
index 2e4b06d94..dc74d3651 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLGraphicsConfiguration.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLGraphicsConfiguration.java
@@ -1,5 +1,6 @@
/*
* 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
@@ -36,7 +37,6 @@
package com.jogamp.opengl.impl.egl;
import com.jogamp.common.nio.PointerBuffer;
-import java.util.*;
import javax.media.nativewindow.*;
import javax.media.nativewindow.egl.*;
import javax.media.opengl.*;
@@ -54,7 +54,7 @@ public class EGLGraphicsConfiguration extends DefaultGraphicsConfiguration imple
}
public EGLGraphicsConfiguration(AbstractGraphicsScreen absScreen,
- GLCapabilities capsChosen, GLCapabilities capsRequested, GLCapabilitiesChooser chooser,
+ GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser,
long cfg, int cfgID) {
super(absScreen, capsChosen, capsRequested);
this.chooser = chooser;
@@ -62,7 +62,7 @@ public class EGLGraphicsConfiguration extends DefaultGraphicsConfiguration imple
configID = cfgID;
}
- public static EGLGraphicsConfiguration create(GLCapabilities capsRequested, AbstractGraphicsScreen absScreen, int cfgID) {
+ public static EGLGraphicsConfiguration create(GLCapabilitiesImmutable capsRequested, AbstractGraphicsScreen absScreen, int cfgID) {
AbstractGraphicsDevice absDevice = absScreen.getDevice();
if(null==absDevice || !(absDevice instanceof EGLGraphicsDevice)) {
throw new GLException("GraphicsDevice must be a valid EGLGraphicsDevice");
@@ -73,7 +73,7 @@ public class EGLGraphicsConfiguration extends DefaultGraphicsConfiguration imple
}
GLProfile glp = capsRequested.getGLProfile();
long cfg = EGLConfigId2EGLConfig(glp, dpy, cfgID);
- GLCapabilities caps = EGLConfig2Capabilities(glp, dpy, cfg, false, capsRequested.isOnscreen(), capsRequested.isPBuffer());
+ GLCapabilitiesImmutable caps = EGLConfig2Capabilities(glp, dpy, cfg, false, capsRequested.isOnscreen(), capsRequested.isPBuffer());
return new EGLGraphicsConfiguration(absScreen, caps, capsRequested, new DefaultGLCapabilitiesChooser(), cfg, cfgID);
}
@@ -83,9 +83,8 @@ public class EGLGraphicsConfiguration extends DefaultGraphicsConfiguration imple
protected void updateGraphicsConfiguration() {
EGLGraphicsConfiguration newConfig = (EGLGraphicsConfiguration)
- GraphicsConfigurationFactory.getFactory(getScreen().getDevice()).chooseGraphicsConfiguration(getRequestedCapabilities().cloneCapabilites(),
- chooser,
- getScreen());
+ GraphicsConfigurationFactory.getFactory(getScreen().getDevice()).chooseGraphicsConfiguration(
+ getChosenCapabilities(), getRequestedCapabilities(), chooser, getScreen());
if(null!=newConfig) {
// FIXME: setScreen( ... );
setChosenCapabilities(newConfig.getChosenCapabilities());
@@ -132,8 +131,8 @@ public class EGLGraphicsConfiguration extends DefaultGraphicsConfiguration imple
return res;
}
- public static GLCapabilities EGLConfig2Capabilities(GLProfile glp, long display, long config,
- boolean relaxed, boolean onscreen, boolean usePBuffer) {
+ public static GLCapabilitiesImmutable EGLConfig2Capabilities(GLProfile glp, long display, long config,
+ boolean relaxed, boolean onscreen, boolean usePBuffer) {
GLCapabilities caps = new GLCapabilities(glp);
int[] val = new int[1];
@@ -200,7 +199,7 @@ public class EGLGraphicsConfiguration extends DefaultGraphicsConfiguration imple
return caps;
}
- public static int[] GLCapabilities2AttribList(GLCapabilities caps) {
+ public static int[] GLCapabilities2AttribList(GLCapabilitiesImmutable caps) {
int[] attrs = new int[32];
int idx=0;
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLGraphicsConfigurationFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLGraphicsConfigurationFactory.java
index c678707fc..8f0f036aa 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLGraphicsConfigurationFactory.java
@@ -1,5 +1,6 @@
/*
* 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
@@ -32,12 +33,25 @@
package com.jogamp.opengl.impl.egl;
-import com.jogamp.common.nio.PointerBuffer;
import java.io.PrintStream;
-import javax.media.nativewindow.*;
-import javax.media.nativewindow.egl.*;
+import javax.media.nativewindow.AbstractGraphicsConfiguration;
+import javax.media.nativewindow.AbstractGraphicsDevice;
+import javax.media.nativewindow.AbstractGraphicsScreen;
+import javax.media.nativewindow.CapabilitiesChooser;
+import javax.media.nativewindow.CapabilitiesImmutable;
+import javax.media.nativewindow.DefaultGraphicsScreen;
+import javax.media.nativewindow.GraphicsConfigurationFactory;
+import javax.media.nativewindow.NativeWindowException;
+import javax.media.nativewindow.egl.EGLGraphicsDevice;
+
+import javax.media.opengl.DefaultGLCapabilitiesChooser;
+import javax.media.opengl.GLCapabilities;
+import javax.media.opengl.GLCapabilitiesChooser;
+import javax.media.opengl.GLCapabilitiesImmutable;
+import javax.media.opengl.GLException;
+import javax.media.opengl.GLProfile;
-import javax.media.opengl.*;
+import com.jogamp.common.nio.PointerBuffer;
/** Subclass of GraphicsConfigurationFactory used when non-AWT tookits
@@ -54,14 +68,18 @@ public class EGLGraphicsConfigurationFactory extends GraphicsConfigurationFactor
}
protected AbstractGraphicsConfiguration chooseGraphicsConfigurationImpl (
- Capabilities capabilities, CapabilitiesChooser chooser, AbstractGraphicsScreen absScreen) {
+ CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested,
+ CapabilitiesChooser chooser, AbstractGraphicsScreen absScreen) {
if (absScreen == null) {
throw new IllegalArgumentException("This NativeWindowFactory accepts only AbstractGraphicsDevice objects");
}
- if (capabilities != null &&
- !(capabilities instanceof GLCapabilities)) {
- throw new IllegalArgumentException("This NativeWindowFactory accepts only GLCapabilities objects");
+ if (! (capsChosen instanceof GLCapabilitiesImmutable) ) {
+ throw new IllegalArgumentException("This NativeWindowFactory accepts only GLCapabilities objects - chosen");
+ }
+
+ if (! (capsRequested instanceof GLCapabilitiesImmutable) ) {
+ throw new IllegalArgumentException("This NativeWindowFactory accepts only GLCapabilities objects - requested");
}
if (chooser != null &&
@@ -69,18 +87,20 @@ public class EGLGraphicsConfigurationFactory extends GraphicsConfigurationFactor
throw new IllegalArgumentException("This NativeWindowFactory accepts only GLCapabilitiesChooser objects");
}
- return chooseGraphicsConfigurationStatic((GLCapabilities) capabilities,
+ return chooseGraphicsConfigurationStatic((GLCapabilitiesImmutable) capsChosen,
+ (GLCapabilitiesImmutable) capsRequested,
(GLCapabilitiesChooser) chooser,
absScreen);
}
- private static EGLGraphicsConfiguration chooseGraphicsConfigurationStatic(GLCapabilities capabilities,
- GLCapabilitiesChooser chooser,
- AbstractGraphicsScreen absScreen) {
- if (capabilities == null) {
- capabilities = new GLCapabilities(null);
- }
- GLProfile glp = capabilities.getGLProfile();
+ private static EGLGraphicsConfiguration chooseGraphicsConfigurationStatic(GLCapabilitiesImmutable capsChosen,
+ GLCapabilitiesImmutable capsReq,
+ GLCapabilitiesChooser chooser,
+ AbstractGraphicsScreen absScreen) {
+ if (capsChosen == null) {
+ capsChosen = new GLCapabilities(null);
+ }
+ GLProfile glp = capsChosen.getGLProfile();
if(null==absScreen) {
throw new GLException("Null AbstractGraphicsScreen");
@@ -96,18 +116,19 @@ public class EGLGraphicsConfigurationFactory extends GraphicsConfigurationFactor
throw new GLException("Invalid EGL display: "+absDevice);
}
- GLCapabilities caps2 = (GLCapabilities) capabilities.clone();
- if(!caps2.isOnscreen()) {
+ if(!capsChosen.isOnscreen() && capsChosen.getDoubleBuffered()) {
// OFFSCREEN !DOUBLE_BUFFER // FIXME DBLBUFOFFSCRN
+ GLCapabilities caps2 = (GLCapabilities) capsChosen.cloneMutable();
caps2.setDoubleBuffered(false);
+ capsChosen = caps2;
}
- EGLGraphicsConfiguration res = eglChooseConfig(eglDisplay, caps2, capabilities, chooser, absScreen);
+ EGLGraphicsConfiguration res = eglChooseConfig(eglDisplay, capsChosen, capsReq, chooser, absScreen);
if(null!=res) {
return res;
}
if(DEBUG) {
- System.err.println("eglChooseConfig failed with given capabilities "+caps2);
+ System.err.println("eglChooseConfig failed with given capabilities "+capsChosen);
}
if (chooser == null) {
@@ -123,15 +144,15 @@ public class EGLGraphicsConfigurationFactory extends GraphicsConfigurationFactor
if (numConfigs[0] == 0) {
throw new GLException("Graphics configuration fetch (eglGetConfigs) - no EGLConfig found");
}
- GLCapabilities[] caps = eglConfigs2GLCaps(glp, eglDisplay, configs, numConfigs[0],
- caps2.isOnscreen(), caps2.isPBuffer());
+ GLCapabilitiesImmutable[] caps = eglConfigs2GLCaps(glp, eglDisplay, configs, numConfigs[0],
+ capsChosen.isOnscreen(), capsChosen.isPBuffer());
if(DEBUG) {
System.err.println("EGL Get Configs: "+numConfigs[0]+", Caps "+caps.length);
printCaps("eglGetConfigs", caps, System.err);
}
int chosen = -1;
try {
- chosen = chooser.chooseCapabilities(caps2, caps, -1);
+ chosen = chooser.chooseCapabilities(capsChosen, caps, -1);
} catch (NativeWindowException e) { throw new GLException(e); }
if(chosen<0) {
throw new GLException("Graphics configuration chooser failed");
@@ -139,7 +160,7 @@ public class EGLGraphicsConfigurationFactory extends GraphicsConfigurationFactor
if(DEBUG) {
System.err.println("Chosen "+caps[chosen]);
}
- res = eglChooseConfig(eglDisplay, caps[chosen], capabilities, chooser, absScreen);
+ res = eglChooseConfig(eglDisplay, caps[chosen], capsReq, chooser, absScreen);
if(null!=res) {
return res;
}
@@ -160,7 +181,7 @@ public class EGLGraphicsConfigurationFactory extends GraphicsConfigurationFactor
if(DEBUG) {
System.err.println("trying fixed caps (1): "+fixedCaps);
}
- res = eglChooseConfig(eglDisplay, fixedCaps, capabilities, chooser, absScreen);
+ res = eglChooseConfig(eglDisplay, fixedCaps, capsReq, chooser, absScreen);
if(null!=res) {
return res;
}
@@ -175,7 +196,7 @@ public class EGLGraphicsConfigurationFactory extends GraphicsConfigurationFactor
if(DEBUG) {
System.err.println("trying fixed caps (2): "+fixedCaps);
}
- res = eglChooseConfig(eglDisplay, fixedCaps, capabilities, chooser, absScreen);
+ res = eglChooseConfig(eglDisplay, fixedCaps, capsReq, chooser, absScreen);
if(null!=res) {
return res;
}
@@ -192,7 +213,7 @@ public class EGLGraphicsConfigurationFactory extends GraphicsConfigurationFactor
if(DEBUG) {
System.err.println("trying fixed caps (3): "+fixedCaps);
}
- res = eglChooseConfig(eglDisplay, fixedCaps, capabilities, chooser, absScreen);
+ res = eglChooseConfig(eglDisplay, fixedCaps, capsReq, chooser, absScreen);
if(null!=res) {
return res;
}
@@ -200,7 +221,8 @@ public class EGLGraphicsConfigurationFactory extends GraphicsConfigurationFactor
}
protected static EGLGraphicsConfiguration eglChooseConfig(long eglDisplay,
- GLCapabilities capsChosen0, GLCapabilities capsRequested, GLCapabilitiesChooser chooser,
+ GLCapabilitiesImmutable capsChosen0, GLCapabilitiesImmutable capsRequested,
+ GLCapabilitiesChooser chooser,
AbstractGraphicsScreen absScreen) {
GLProfile glp = capsChosen0.getGLProfile();
int[] attrs = EGLGraphicsConfiguration.GLCapabilities2AttribList(capsChosen0);
@@ -214,8 +236,8 @@ public class EGLGraphicsConfigurationFactory extends GraphicsConfigurationFactor
}
if (numConfigs[0] > 0) {
if(DEBUG) {
- GLCapabilities[] caps = eglConfigs2GLCaps(glp, eglDisplay, configs, numConfigs[0],
- capsChosen0.isOnscreen(), capsChosen0.isPBuffer());
+ GLCapabilitiesImmutable[] caps = eglConfigs2GLCaps(glp, eglDisplay, configs, numConfigs[0],
+ capsChosen0.isOnscreen(), capsChosen0.isPBuffer());
System.err.println("EGL Choose Configs: "+numConfigs[0]+", Caps "+caps.length);
printCaps("eglChooseConfig", caps, System.err);
}
@@ -228,8 +250,9 @@ public class EGLGraphicsConfigurationFactory extends GraphicsConfigurationFactor
}
return null;
}
- GLCapabilities capsChosen1 = EGLGraphicsConfiguration.EGLConfig2Capabilities(glp, eglDisplay, configs.get(0),
- true, capsChosen0.isOnscreen(), capsChosen0.isPBuffer());
+ GLCapabilitiesImmutable capsChosen1 = EGLGraphicsConfiguration.EGLConfig2Capabilities(
+ glp, eglDisplay, configs.get(0),
+ true, capsChosen0.isOnscreen(), capsChosen0.isPBuffer());
if(null!=capsChosen1) {
if(DEBUG) {
System.err.println("eglChooseConfig found: eglDisplay 0x"+Long.toHexString(eglDisplay)+
@@ -252,27 +275,34 @@ public class EGLGraphicsConfigurationFactory extends GraphicsConfigurationFactor
return null;
}
- protected static GLCapabilities[] eglConfigs2GLCaps(GLProfile glp, long eglDisplay, PointerBuffer configs, int num,
- boolean onscreen, boolean usePBuffer) {
- GLCapabilities[] caps = new GLCapabilities[num];
+ protected static GLCapabilitiesImmutable[] eglConfigs2GLCaps(GLProfile glp, long eglDisplay, PointerBuffer configs, int num,
+ boolean onscreen, boolean usePBuffer) {
+ GLCapabilitiesImmutable[] caps = new GLCapabilitiesImmutable[num];
for(int i=0; i<num; i++) {
caps[i] = EGLGraphicsConfiguration.EGLConfig2Capabilities(glp, eglDisplay, configs.get(i),
- true, onscreen, usePBuffer);
+ true, onscreen, usePBuffer);
}
return caps;
}
- protected static void printCaps(String prefix, GLCapabilities[] caps, PrintStream out) {
+ protected static void printCaps(String prefix, GLCapabilitiesImmutable[] caps, PrintStream out) {
for(int i=0; i<caps.length; i++) {
out.println(prefix+"["+i+"] "+caps[i]);
}
}
- protected static EGLGraphicsConfiguration createOffscreenGraphicsConfiguration(GLCapabilities caps, GLCapabilitiesChooser chooser) {
- if(caps.isOnscreen()) {
- throw new GLException("Error: Onscreen set: "+caps);
+ protected static EGLGraphicsConfiguration createOffscreenGraphicsConfiguration(GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsReq, GLCapabilitiesChooser chooser) {
+ if(capsChosen.isOnscreen()) {
+ throw new GLException("Error: Onscreen set: "+capsChosen);
}
- caps.setDoubleBuffered(false); // FIXME DBLBUFOFFSCRN
+
+ if(capsChosen.getDoubleBuffered()) {
+ // OFFSCREEN !DOUBLE_BUFFER // FIXME DBLBUFOFFSCRN
+ GLCapabilities caps2 = (GLCapabilities) capsChosen.cloneMutable();
+ caps2.setDoubleBuffered(false);
+ capsChosen = caps2;
+ }
+
long eglDisplay = EGL.eglGetDisplay(EGL.EGL_DEFAULT_DISPLAY);
if (eglDisplay == EGL.EGL_NO_DISPLAY) {
throw new GLException("Failed to created EGL default display: error 0x"+Integer.toHexString(EGL.eglGetError()));
@@ -284,7 +314,7 @@ public class EGLGraphicsConfigurationFactory extends GraphicsConfigurationFactor
}
EGLGraphicsDevice e = new EGLGraphicsDevice(eglDisplay, AbstractGraphicsDevice.DEFAULT_UNIT);
DefaultGraphicsScreen s = new DefaultGraphicsScreen(e, 0);
- EGLGraphicsConfiguration eglConfig = chooseGraphicsConfigurationStatic(caps, chooser, s);
+ EGLGraphicsConfiguration eglConfig = chooseGraphicsConfigurationStatic(capsChosen, capsReq, chooser, s);
if (null == eglConfig) {
EGL.eglTerminate(eglDisplay);
throw new GLException("Couldn't create EGLGraphicsConfiguration from "+s);
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLPbufferDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLPbufferDrawable.java
index e633d0b47..3189324d1 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLPbufferDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLPbufferDrawable.java
@@ -40,8 +40,11 @@
package com.jogamp.opengl.impl.egl;
-import javax.media.opengl.*;
-import javax.media.nativewindow.*;
+import javax.media.nativewindow.NativeSurface;
+import javax.media.nativewindow.SurfaceChangeable;
+import javax.media.opengl.GLCapabilitiesImmutable;
+import javax.media.opengl.GLContext;
+import javax.media.opengl.GLException;
public class EGLPbufferDrawable extends EGLDrawable {
private int texFormat;
@@ -52,7 +55,8 @@ public class EGLPbufferDrawable extends EGLDrawable {
ownEGLDisplay = true;
// get choosen ones ..
- GLCapabilities caps = (GLCapabilities) getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration().getChosenCapabilities();
+ GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable)
+ getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration().getChosenCapabilities();
if(useTexture) {
this.texFormat = caps.getAlphaBits() > 0 ? EGL.EGL_TEXTURE_RGBA : EGL.EGL_TEXTURE_RGB ;
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLContext.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLContext.java
index e9b543721..3cd2aa650 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLContext.java
@@ -116,13 +116,13 @@ public abstract class MacOSXCGLContext extends GLContextImpl
}
}
MacOSXCGLGraphicsConfiguration config = (MacOSXCGLGraphicsConfiguration) drawable.getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration();
- GLCapabilities capabilitiesRequested = (GLCapabilities)config.getRequestedCapabilities();
+ GLCapabilitiesImmutable capabilitiesRequested = (GLCapabilitiesImmutable) config.getRequestedCapabilities();
GLProfile glProfile = capabilitiesRequested.getGLProfile();
if(glProfile.isGL3()) {
throw new GLException("GL3 profile currently not supported on MacOSX, due to the lack of a OpenGL 3.1 implementation");
}
// HACK .. bring in OnScreen/PBuffer selection to the DrawableFactory !!
- GLCapabilities capabilities = (GLCapabilities) capabilitiesRequested.clone();
+ GLCapabilities capabilities = (GLCapabilities) capabilitiesRequested.cloneMutable();
capabilities.setPBuffer(pbuffer);
capabilities.setPbufferFloatingPointBuffers(floatingPoint);
@@ -154,7 +154,7 @@ public abstract class MacOSXCGLContext extends GLContextImpl
CGL.setContextOpacity(contextHandle, 0);
}
- GLCapabilities caps = MacOSXCGLGraphicsConfiguration.NSPixelFormat2GLCapabilities(glProfile, pixelFormat);
+ GLCapabilitiesImmutable caps = MacOSXCGLGraphicsConfiguration.NSPixelFormat2GLCapabilities(glProfile, pixelFormat);
config.setChosenCapabilities(caps);
} finally {
CGL.deletePixelFormat(pixelFormat);
@@ -260,7 +260,7 @@ public abstract class MacOSXCGLContext extends GLContextImpl
protected void swapBuffers() {
DefaultGraphicsConfiguration config = (DefaultGraphicsConfiguration) drawable.getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration();
- GLCapabilities caps = (GLCapabilities)config.getChosenCapabilities();
+ GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable)config.getChosenCapabilities();
if(caps.isOnscreen()) {
if(isNSContext) {
if (!CGL.flushBuffer(contextHandle)) {
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java
index a8a82b46a..71b99c2d5 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java
@@ -151,9 +151,9 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
return new MacOSXPbufferCGLDrawable(this, target);
}
- protected NativeSurface createOffscreenSurfaceImpl(GLCapabilities capabilities, GLCapabilitiesChooser chooser, int width, int height) {
+ protected NativeSurface createOffscreenSurfaceImpl(GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser, int width, int height) {
AbstractGraphicsScreen screen = DefaultGraphicsScreen.createDefault(NativeWindowFactory.TYPE_MACOSX);
- ProxySurface ns = new ProxySurface(MacOSXCGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capabilities, chooser, screen, true));
+ ProxySurface ns = new ProxySurface(MacOSXCGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capsChosen, capsRequested, chooser, screen, true));
ns.setSize(width, height);
return ns;
}
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java
index d2be9d0de..b912efd1f 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java
@@ -42,7 +42,8 @@ import javax.media.opengl.*;
public class MacOSXCGLGraphicsConfiguration extends DefaultGraphicsConfiguration implements Cloneable {
long pixelformat;
- public MacOSXCGLGraphicsConfiguration(AbstractGraphicsScreen screen, GLCapabilities capsChosen, GLCapabilities capsRequested,
+ public MacOSXCGLGraphicsConfiguration(AbstractGraphicsScreen screen,
+ GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested,
long pixelformat) {
super(screen, capsChosen, capsRequested);
this.pixelformat=pixelformat;
@@ -56,7 +57,7 @@ public class MacOSXCGLGraphicsConfiguration extends DefaultGraphicsConfiguration
this.pixelformat=pixelformat;
}
- protected void setChosenCapabilities(GLCapabilities caps) {
+ protected void setChosenCapabilities(GLCapabilitiesImmutable caps) {
super.setChosenCapabilities(caps);
}
@@ -73,7 +74,7 @@ public class MacOSXCGLGraphicsConfiguration extends DefaultGraphicsConfiguration
CGL.NSOpenGLPFASampleBuffers,
CGL.NSOpenGLPFASamples };
- protected static int[] GLCapabilities2AttribList(GLCapabilities caps) {
+ protected static int[] GLCapabilities2AttribList(GLCapabilitiesImmutable caps) {
int[] ivalues = new int[cglInternalAttributeToken.length];
for (int idx = 0; idx < cglInternalAttributeToken.length; idx++) {
@@ -130,20 +131,20 @@ public class MacOSXCGLGraphicsConfiguration extends DefaultGraphicsConfiguration
return ivalues;
}
- protected static long GLCapabilities2NSPixelFormat(GLCapabilities caps) {
+ protected static long GLCapabilities2NSPixelFormat(GLCapabilitiesImmutable caps) {
int[] ivalues = GLCapabilities2AttribList(caps);
return CGL.createPixelFormat(cglInternalAttributeToken, 0, cglInternalAttributeToken.length, ivalues, 0);
}
- protected static GLCapabilities NSPixelFormat2GLCapabilities(GLProfile glp, long pixelFormat) {
+ protected static GLCapabilitiesImmutable NSPixelFormat2GLCapabilities(GLProfile glp, long pixelFormat) {
return PixelFormat2GLCapabilities(glp, pixelFormat, true);
}
- protected static GLCapabilities CGLPixelFormat2GLCapabilities(GLProfile glp, long pixelFormat) {
+ protected static GLCapabilitiesImmutable CGLPixelFormat2GLCapabilities(GLProfile glp, long pixelFormat) {
return PixelFormat2GLCapabilities(glp, pixelFormat, false);
}
- private static GLCapabilities PixelFormat2GLCapabilities(GLProfile glp, long pixelFormat, boolean nsUsage) {
+ private static GLCapabilitiesImmutable PixelFormat2GLCapabilities(GLProfile glp, long pixelFormat, boolean nsUsage) {
int[] ivalues = new int[cglInternalAttributeToken.length];
// On this platform the pixel format is associated with the
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLGraphicsConfigurationFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLGraphicsConfigurationFactory.java
index 69bb245e1..f53fff168 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLGraphicsConfigurationFactory.java
@@ -1,5 +1,6 @@
/*
* 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
@@ -32,12 +33,14 @@
package com.jogamp.opengl.impl.macosx.cgl;
-import javax.media.nativewindow.*;
-import javax.media.nativewindow.macosx.*;
-import com.jogamp.nativewindow.impl.*;
+import javax.media.nativewindow.AbstractGraphicsConfiguration;
+import javax.media.nativewindow.AbstractGraphicsScreen;
+import javax.media.nativewindow.CapabilitiesChooser;
+import javax.media.nativewindow.CapabilitiesImmutable;
+import javax.media.nativewindow.GraphicsConfigurationFactory;
+import javax.media.opengl.GLCapabilitiesChooser;
+import javax.media.opengl.GLCapabilitiesImmutable;
-import javax.media.opengl.*;
-import com.jogamp.opengl.impl.*;
/** Subclass of GraphicsConfigurationFactory used when non-AWT tookits
are used on OSX platforms. Toolkits will likely need to delegate
@@ -52,20 +55,25 @@ public class MacOSXCGLGraphicsConfigurationFactory extends GraphicsConfiguration
}
protected AbstractGraphicsConfiguration chooseGraphicsConfigurationImpl(
- Capabilities capabilities, CapabilitiesChooser chooser, AbstractGraphicsScreen absScreen) {
- return chooseGraphicsConfigurationStatic(capabilities, chooser, absScreen, false);
+ CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested,
+ CapabilitiesChooser chooser, AbstractGraphicsScreen absScreen) {
+ return chooseGraphicsConfigurationStatic(capsChosen, capsRequested, chooser, absScreen, false);
}
- protected static MacOSXCGLGraphicsConfiguration chooseGraphicsConfigurationStatic(Capabilities capabilities,
- CapabilitiesChooser chooser,
- AbstractGraphicsScreen absScreen, boolean usePBuffer) {
+ protected static MacOSXCGLGraphicsConfiguration chooseGraphicsConfigurationStatic(CapabilitiesImmutable capsChosen,
+ CapabilitiesImmutable capsRequested,
+ CapabilitiesChooser chooser,
+ AbstractGraphicsScreen absScreen, boolean usePBuffer) {
if (absScreen == null) {
throw new IllegalArgumentException("AbstractGraphicsScreen is null");
}
- if (capabilities != null &&
- !(capabilities instanceof GLCapabilities)) {
- throw new IllegalArgumentException("This NativeWindowFactory accepts only GLCapabilities objects");
+ if (! (capsChosen instanceof GLCapabilitiesImmutable) ) {
+ throw new IllegalArgumentException("This NativeWindowFactory accepts only GLCapabilities objects - chosen");
+ }
+
+ if (! (capsRequested instanceof GLCapabilitiesImmutable) ) {
+ throw new IllegalArgumentException("This NativeWindowFactory accepts only GLCapabilities objects - requested");
}
if (chooser != null &&
@@ -73,11 +81,6 @@ public class MacOSXCGLGraphicsConfigurationFactory extends GraphicsConfiguration
throw new IllegalArgumentException("This NativeWindowFactory accepts only GLCapabilitiesChooser objects");
}
- if (capabilities == null) {
- capabilities = new GLCapabilities(null);
- }
-
- return new MacOSXCGLGraphicsConfiguration(absScreen, (GLCapabilities)capabilities, (GLCapabilities)capabilities, 0);
+ return new MacOSXCGLGraphicsConfiguration(absScreen, (GLCapabilitiesImmutable)capsChosen, (GLCapabilitiesImmutable)capsRequested, 0);
}
}
-
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXExternalCGLContext.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXExternalCGLContext.java
index 5dcc103b2..80a396a29 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXExternalCGLContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXExternalCGLContext.java
@@ -92,7 +92,7 @@ public class MacOSXExternalCGLContext extends MacOSXCGLContext {
if (0 == pixelFormat) {
throw new GLException("Error: current pixelformat of current Context 0x"+Long.toHexString(contextHandle)+" is null");
}
- GLCapabilities caps = MacOSXCGLGraphicsConfiguration.CGLPixelFormat2GLCapabilities(glp, pixelFormat);
+ GLCapabilitiesImmutable caps = MacOSXCGLGraphicsConfiguration.CGLPixelFormat2GLCapabilities(glp, pixelFormat);
if(DEBUG) {
System.err.println("MacOSXExternalCGLContext Create "+caps);
}
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java
index 5cf8c6eb9..93e5767b3 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java
@@ -87,7 +87,7 @@ public class MacOSXPbufferCGLContext extends MacOSXCGLContext {
if (newCreated) {
// Initialize render-to-texture support if requested
DefaultGraphicsConfiguration config = (DefaultGraphicsConfiguration) drawable.getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration();
- GLCapabilities capabilities = (GLCapabilities)config.getChosenCapabilities();
+ GLCapabilitiesImmutable capabilities = (GLCapabilitiesImmutable)config.getChosenCapabilities();
GL gl = getGL();
boolean rect = gl.isGL2GL3() && capabilities.getPbufferRenderToTextureRectangle();
if (rect) {
@@ -136,7 +136,7 @@ public class MacOSXPbufferCGLContext extends MacOSXCGLContext {
protected boolean createImpl() throws GLException {
DefaultGraphicsConfiguration config = (DefaultGraphicsConfiguration) drawable.getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration();
- GLCapabilities capabilities = (GLCapabilities)config.getChosenCapabilities();
+ GLCapabilitiesImmutable capabilities = (GLCapabilitiesImmutable)config.getChosenCapabilities();
if (capabilities.getPbufferFloatingPointBuffers() &&
!isTigerOrLater) {
throw new GLException("Floating-point pbuffers supported only on OS X 10.4 or later");
@@ -224,7 +224,7 @@ public class MacOSXPbufferCGLContext extends MacOSXCGLContext {
public boolean isNSContext() { return true; }
public long create() {
DefaultGraphicsConfiguration config = (DefaultGraphicsConfiguration) drawable.getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration();
- GLCapabilities capabilities = (GLCapabilities)config.getChosenCapabilities();
+ GLCapabilitiesImmutable capabilities = (GLCapabilitiesImmutable)config.getChosenCapabilities();
if (capabilities.getPbufferFloatingPointBuffers() &&
!isTigerOrLater) {
throw new GLException("Floating-point pbuffers supported only on OS X 10.4 or later");
@@ -288,7 +288,7 @@ public class MacOSXPbufferCGLContext extends MacOSXCGLContext {
int i = 0;
attrs[i++] = CGL.kCGLPFAPBuffer;
DefaultGraphicsConfiguration config = (DefaultGraphicsConfiguration) drawable.getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration();
- GLCapabilities capabilities = (GLCapabilities)config.getChosenCapabilities();
+ GLCapabilitiesImmutable capabilities = (GLCapabilitiesImmutable)config.getChosenCapabilities();
if (capabilities.getPbufferFloatingPointBuffers())
attrs[i++] = CGL.kCGLPFAColorFloat;
if (capabilities.getDoubleBuffered())
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java
index 14ed02918..37c6cfb70 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java
@@ -110,7 +110,7 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable {
private void createPbuffer() {
NativeSurface ns = getNativeSurface();
DefaultGraphicsConfiguration config = (DefaultGraphicsConfiguration) ns.getGraphicsConfiguration().getNativeGraphicsConfiguration();
- GLCapabilities capabilities = (GLCapabilities)config.getChosenCapabilities();
+ GLCapabilitiesImmutable capabilities = (GLCapabilitiesImmutable)config.getChosenCapabilities();
GLProfile glProfile = capabilities.getGLProfile();
int renderTarget;
if (glProfile.isGL2GL3() && capabilities.getPbufferRenderToTextureRectangle()) {
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/awt/MacOSXAWTCGLGraphicsConfigurationFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/awt/MacOSXAWTCGLGraphicsConfigurationFactory.java
index af8841d3d..690e0466b 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/awt/MacOSXAWTCGLGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/awt/MacOSXAWTCGLGraphicsConfigurationFactory.java
@@ -1,5 +1,6 @@
/*
* 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
@@ -34,17 +35,24 @@ package com.jogamp.opengl.impl.macosx.cgl.awt;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
-import java.awt.GraphicsEnvironment;
-import javax.media.nativewindow.*;
-import javax.media.nativewindow.macosx.*;
-import javax.media.nativewindow.awt.*;
-import javax.media.opengl.*;
-import javax.media.opengl.awt.*;
-
-import com.jogamp.opengl.impl.*;
-import com.jogamp.opengl.impl.macosx.cgl.*;
-import com.jogamp.nativewindow.impl.jawt.*;
-import com.jogamp.nativewindow.impl.jawt.macosx.*;
+
+import javax.media.nativewindow.AbstractGraphicsConfiguration;
+import javax.media.nativewindow.AbstractGraphicsDevice;
+import javax.media.nativewindow.AbstractGraphicsScreen;
+import javax.media.nativewindow.CapabilitiesChooser;
+import javax.media.nativewindow.CapabilitiesImmutable;
+import javax.media.nativewindow.DefaultGraphicsScreen;
+import javax.media.nativewindow.GraphicsConfigurationFactory;
+import javax.media.nativewindow.awt.AWTGraphicsConfiguration;
+import javax.media.nativewindow.awt.AWTGraphicsDevice;
+import javax.media.nativewindow.awt.AWTGraphicsScreen;
+import javax.media.nativewindow.macosx.MacOSXGraphicsDevice;
+
+import javax.media.opengl.GLCapabilitiesChooser;
+import javax.media.opengl.GLCapabilitiesImmutable;
+import javax.media.opengl.GLException;
+
+import com.jogamp.opengl.impl.macosx.cgl.MacOSXCGLGraphicsConfiguration;
public class MacOSXAWTCGLGraphicsConfigurationFactory extends GraphicsConfigurationFactory {
protected static final boolean DEBUG = com.jogamp.opengl.impl.Debug.debug("GraphicsConfiguration");
@@ -54,7 +62,8 @@ public class MacOSXAWTCGLGraphicsConfigurationFactory extends GraphicsConfigurat
}
protected AbstractGraphicsConfiguration chooseGraphicsConfigurationImpl(
- Capabilities capabilities, CapabilitiesChooser chooser, AbstractGraphicsScreen absScreen) {
+ CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested,
+ CapabilitiesChooser chooser, AbstractGraphicsScreen absScreen) {
GraphicsDevice device = null;
if (absScreen != null &&
!(absScreen instanceof AWTGraphicsScreen)) {
@@ -67,9 +76,12 @@ public class MacOSXAWTCGLGraphicsConfigurationFactory extends GraphicsConfigurat
AWTGraphicsScreen awtScreen = (AWTGraphicsScreen) absScreen;
device = ((AWTGraphicsDevice)awtScreen.getDevice()).getGraphicsDevice();
- if (capabilities != null &&
- !(capabilities instanceof GLCapabilities)) {
- throw new IllegalArgumentException("This GraphicsConfigurationFactory accepts only GLCapabilities objects");
+ if ( !(capsChosen instanceof GLCapabilitiesImmutable) ) {
+ throw new IllegalArgumentException("This GraphicsConfigurationFactory accepts only GLCapabilities objects - chosen");
+ }
+
+ if ( !(capsRequested instanceof GLCapabilitiesImmutable) ) {
+ throw new IllegalArgumentException("This GraphicsConfigurationFactory accepts only GLCapabilities objects - requested");
}
if (chooser != null &&
@@ -81,8 +93,6 @@ public class MacOSXAWTCGLGraphicsConfigurationFactory extends GraphicsConfigurat
System.err.println("MacOSXAWTCGLGraphicsConfigurationFactory: got "+absScreen);
}
- long displayHandle = 0;
-
MacOSXGraphicsDevice macDevice = new MacOSXGraphicsDevice(AbstractGraphicsDevice.DEFAULT_UNIT);
DefaultGraphicsScreen macScreen = new DefaultGraphicsScreen(macDevice, awtScreen.getIndex());
if(DEBUG) {
@@ -90,18 +100,18 @@ public class MacOSXAWTCGLGraphicsConfigurationFactory extends GraphicsConfigurat
}
GraphicsConfiguration gc = device.getDefaultConfiguration();
- AWTGraphicsConfiguration.setupCapabilitiesRGBABits(capabilities, gc);
+ capsChosen = (GLCapabilitiesImmutable) AWTGraphicsConfiguration.setupCapabilitiesRGBABits(capsChosen, gc);
if(DEBUG) {
- System.err.println("AWT Colormodel compatible: "+capabilities);
+ System.err.println("AWT Colormodel compatible: "+capsChosen);
}
MacOSXCGLGraphicsConfiguration macConfig = (MacOSXCGLGraphicsConfiguration)
- GraphicsConfigurationFactory.getFactory(macDevice).chooseGraphicsConfiguration(capabilities,
- chooser,
- macScreen);
+ GraphicsConfigurationFactory.getFactory(macDevice).chooseGraphicsConfiguration(capsChosen,
+ capsRequested,
+ chooser, macScreen);
if (macConfig == null) {
- throw new GLException("Unable to choose a GraphicsConfiguration: "+capabilities+",\n\t"+chooser+"\n\t"+macScreen);
+ throw new GLException("Unable to choose a GraphicsConfiguration: "+capsChosen+",\n\t"+chooser+"\n\t"+macScreen);
}
// FIXME: we have nothing to match .. so choose the default
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsDummyWGLDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsDummyWGLDrawable.java
index 3f7028d56..054c01fdb 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsDummyWGLDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsDummyWGLDrawable.java
@@ -40,7 +40,6 @@
package com.jogamp.opengl.impl.windows.wgl;
-import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLContext;
import javax.media.opengl.GLDrawableFactory;
import javax.media.opengl.GLProfile;
@@ -48,12 +47,14 @@ import javax.media.opengl.GLProfile;
import com.jogamp.nativewindow.impl.ProxySurface;
import com.jogamp.nativewindow.impl.windows.GDI;
import com.jogamp.nativewindow.impl.windows.PIXELFORMATDESCRIPTOR;
+import javax.media.opengl.GLCapabilities;
+import javax.media.opengl.GLCapabilitiesImmutable;
public class WindowsDummyWGLDrawable extends WindowsWGLDrawable {
private long hwnd, hdc;
- public WindowsDummyWGLDrawable(GLDrawableFactory factory, GLProfile glp) {
- super(factory, new ProxySurface(WindowsWGLGraphicsConfigurationFactory.createDefaultGraphicsConfiguration(glp, null, true, true)), true);
+ protected WindowsDummyWGLDrawable(GLDrawableFactory factory, GLCapabilitiesImmutable caps) {
+ super(factory, new ProxySurface(WindowsWGLGraphicsConfigurationFactory.createDefaultGraphicsConfiguration(caps, null)), true);
// All entries to CreateDummyWindow must synchronize on one object
// to avoid accidentally registering the dummy window class twice
synchronized (WindowsDummyWGLDrawable.class) {
@@ -64,9 +65,7 @@ public class WindowsDummyWGLDrawable extends WindowsWGLDrawable {
ns.setSurfaceHandle(hdc);
WindowsWGLGraphicsConfiguration config = (WindowsWGLGraphicsConfiguration)ns.getGraphicsConfiguration().getNativeGraphicsConfiguration();
// Choose a (hopefully hardware-accelerated) OpenGL pixel format for this device context
- GLCapabilities caps = (GLCapabilities) config.getChosenCapabilities();
- caps.setDepthBits(16);
- PIXELFORMATDESCRIPTOR pfd = WindowsWGLGraphicsConfiguration.GLCapabilities2PFD(caps);
+ PIXELFORMATDESCRIPTOR pfd = WindowsWGLGraphicsConfiguration.GLCapabilities2PFD((GLCapabilitiesImmutable)config.getChosenCapabilities());
int pixelFormat = GDI.ChoosePixelFormat(hdc, pfd);
if ((pixelFormat == 0) ||
(!GDI.SetPixelFormat(hdc, pixelFormat, pfd))) {
@@ -74,6 +73,15 @@ public class WindowsDummyWGLDrawable extends WindowsWGLDrawable {
}
}
+ public static WindowsDummyWGLDrawable create(GLDrawableFactory factory, GLProfile glp) {
+ GLCapabilities caps = new GLCapabilities(glp);
+ caps.setDepthBits(16);
+ caps.setDoubleBuffered(true);
+ caps.setOnscreen (true);
+ caps.setPBuffer (true);
+ return new WindowsDummyWGLDrawable(factory, caps);
+ }
+
public void setSize(int width, int height) {
}
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsOffscreenWGLDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsOffscreenWGLDrawable.java
index 8bb781a45..3452d3b55 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsOffscreenWGLDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsOffscreenWGLDrawable.java
@@ -42,7 +42,6 @@ package com.jogamp.opengl.impl.windows.wgl;
import javax.media.nativewindow.NativeSurface;
import javax.media.nativewindow.SurfaceChangeable;
-import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLContext;
import javax.media.opengl.GLDrawableFactory;
import javax.media.opengl.GLException;
@@ -50,6 +49,7 @@ import javax.media.opengl.GLException;
import com.jogamp.nativewindow.impl.windows.BITMAPINFO;
import com.jogamp.nativewindow.impl.windows.BITMAPINFOHEADER;
import com.jogamp.nativewindow.impl.windows.GDI;
+import javax.media.opengl.GLCapabilitiesImmutable;
public class WindowsOffscreenWGLDrawable extends WindowsWGLDrawable {
private long origbitmap;
@@ -75,7 +75,7 @@ public class WindowsOffscreenWGLDrawable extends WindowsWGLDrawable {
private void create() {
NativeSurface ns = getNativeSurface();
WindowsWGLGraphicsConfiguration config = (WindowsWGLGraphicsConfiguration)ns.getGraphicsConfiguration().getNativeGraphicsConfiguration();
- GLCapabilities capabilities = (GLCapabilities)config.getRequestedCapabilities();
+ GLCapabilitiesImmutable capabilities = (GLCapabilitiesImmutable)config.getRequestedCapabilities();
int width = getWidth();
int height = getHeight();
BITMAPINFO info = BITMAPINFO.create();
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsPbufferWGLContext.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsPbufferWGLContext.java
index abbaf5004..db86b3232 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsPbufferWGLContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsPbufferWGLContext.java
@@ -89,7 +89,7 @@ public class WindowsPbufferWGLContext extends WindowsWGLContext {
protected void makeCurrentImpl(boolean newCreated) throws GLException {
super.makeCurrentImpl(newCreated);
if (newCreated) {
- GLCapabilities capabilities = drawable.getChosenGLCapabilities();
+ GLCapabilitiesImmutable capabilities = drawable.getChosenGLCapabilities();
// Initialize render-to-texture support if requested
GL gl = getGL();
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 a5631aded..751ae5380 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
@@ -43,7 +43,6 @@ package com.jogamp.opengl.impl.windows.wgl;
import javax.media.nativewindow.NativeSurface;
import javax.media.nativewindow.SurfaceChangeable;
import javax.media.opengl.GL;
-import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLContext;
import javax.media.opengl.GLDrawableFactory;
import javax.media.opengl.GLException;
@@ -52,6 +51,7 @@ import javax.media.opengl.GLProfile;
import com.jogamp.nativewindow.impl.windows.GDI;
import com.jogamp.nativewindow.impl.windows.PIXELFORMATDESCRIPTOR;
+import javax.media.opengl.GLCapabilitiesImmutable;
public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable {
private WGLExt cachedWGLExt; // cached WGLExt instance from parent GLCanvas,
@@ -134,7 +134,7 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable {
int width, height;
WindowsWGLGraphicsConfiguration config = (WindowsWGLGraphicsConfiguration) getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration();
- GLCapabilities capabilities = (GLCapabilities)config.getRequestedCapabilities();
+ GLCapabilitiesImmutable capabilities = (GLCapabilitiesImmutable)config.getRequestedCapabilities();
GLProfile glProfile = capabilities.getGLProfile();
if (DEBUG) {
@@ -302,7 +302,7 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable {
iattributes[niattribs++] = WGLExt.WGL_DRAW_TO_PBUFFER_ARB;
int[] ivalues = new int[niattribs];
if (wglExt.wglGetPixelFormatAttribivARB(parentHdc, pformats[whichFormat], 0, niattribs, iattributes, 0, ivalues, 0)) {
- GLCapabilities newCaps = WindowsWGLGraphicsConfiguration.AttribList2GLCapabilities(glProfile, iattributes, niattribs, ivalues, true, false, true);
+ GLCapabilitiesImmutable newCaps = WindowsWGLGraphicsConfiguration.AttribList2GLCapabilities(glProfile, iattributes, niattribs, ivalues, true, false, true);
PIXELFORMATDESCRIPTOR pfd = WindowsWGLGraphicsConfiguration.createPixelFormatDescriptor();
if (GDI.DescribePixelFormat(parentHdc, pformats[whichFormat], pfd.size(), pfd) == 0) {
if (DEBUG) {
@@ -318,7 +318,7 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable {
if (GDI.DescribePixelFormat(parentHdc, pformats[whichFormat], pfd.size(), pfd) == 0) {
throw new GLException("Unable to describe pixel format " + pformats[whichFormat]);
}
- GLCapabilities newCaps = WindowsWGLGraphicsConfiguration.PFD2GLCapabilities(glProfile, pfd, false, true);
+ GLCapabilitiesImmutable newCaps = WindowsWGLGraphicsConfiguration.PFD2GLCapabilities(glProfile, pfd, false, true);
if(newCaps.isOnscreen()) {
throw new GLException("Error: Selected Onscreen Caps for PBuffer: "+newCaps+"\n\t"+newCaps);
}
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLContext.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLContext.java
index 529fda2c9..816532262 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLContext.java
@@ -46,7 +46,6 @@ import java.util.Map;
import javax.media.nativewindow.AbstractGraphicsConfiguration;
import javax.media.nativewindow.AbstractGraphicsDevice;
-import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLContext;
import javax.media.opengl.GLException;
@@ -56,6 +55,7 @@ import com.jogamp.nativewindow.impl.windows.GDI;
import com.jogamp.opengl.impl.GLContextImpl;
import com.jogamp.opengl.impl.GLContextShareSet;
import com.jogamp.opengl.impl.GLDrawableImpl;
+import javax.media.opengl.GLCapabilitiesImmutable;
public class WindowsWGLContext extends GLContextImpl {
@@ -232,7 +232,7 @@ public class WindowsWGLContext extends GLContextImpl {
AbstractGraphicsConfiguration config = drawable.getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration();
AbstractGraphicsDevice device = config.getScreen().getDevice();
WindowsWGLContext sharedContext = (WindowsWGLContext) factory.getOrCreateSharedContextImpl(device);
- GLCapabilities glCaps = drawable.getChosenGLCapabilities();
+ GLCapabilitiesImmutable glCaps = drawable.getChosenGLCapabilities();
// Windows can set up sharing of display lists after creation time
WindowsWGLContext other = (WindowsWGLContext) GLContextShareSet.getShareContext(this);
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 462079913..51c5875cc 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
@@ -55,7 +55,6 @@ import javax.media.nativewindow.DefaultGraphicsScreen;
import javax.media.nativewindow.NativeSurface;
import javax.media.nativewindow.NativeWindowFactory;
import javax.media.nativewindow.windows.WindowsGraphicsDevice;
-import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLCapabilitiesChooser;
import javax.media.opengl.GLContext;
import javax.media.opengl.GLDrawable;
@@ -66,11 +65,11 @@ import com.jogamp.common.JogampRuntimeException;
import com.jogamp.common.util.ReflectionUtil;
import com.jogamp.nativewindow.impl.ProxySurface;
import com.jogamp.nativewindow.impl.windows.GDI;
-import com.jogamp.opengl.impl.Debug;
import com.jogamp.opengl.impl.DesktopGLDynamicLookupHelper;
import com.jogamp.opengl.impl.GLDrawableFactoryImpl;
import com.jogamp.opengl.impl.GLDrawableImpl;
import com.jogamp.opengl.impl.GLDynamicLookupHelper;
+import javax.media.opengl.GLCapabilitiesImmutable;
public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
private static final DesktopGLDynamicLookupHelper windowsWGLDynamicLookupHelper;
@@ -157,7 +156,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
addDeviceTried(connection);
NativeWindowFactory.getDefaultToolkitLock().lock(); // OK
try {
- WindowsDummyWGLDrawable sharedDrawable = new WindowsDummyWGLDrawable(this, null);
+ WindowsDummyWGLDrawable sharedDrawable = WindowsDummyWGLDrawable.create(this, null);
WindowsWGLContext ctx = (WindowsWGLContext) sharedDrawable.createContext(null);
ctx.makeCurrent();
boolean canCreateGLPbuffer = ctx.getGL().isExtensionAvailable("GL_ARB_pbuffer");
@@ -276,10 +275,10 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
return (GLDrawableImpl) returnList.get(0);
}
- protected final NativeSurface createOffscreenSurfaceImpl(GLCapabilities capabilities, GLCapabilitiesChooser chooser, int width, int height) {
+ protected final NativeSurface createOffscreenSurfaceImpl(GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser, int width, int height) {
AbstractGraphicsScreen screen = DefaultGraphicsScreen.createDefault(NativeWindowFactory.TYPE_WINDOWS);
ProxySurface ns = new ProxySurface(WindowsWGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(
- capabilities, chooser, screen) );
+ capsChosen, capsRequested, chooser, screen) );
ns.setSize(width, height);
return ns;
}
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 6c006577e..f714c7719 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
@@ -49,6 +49,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 WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguration implements Cloneable {
// Keep this under the same debug flag as the drawable factory for convenience
@@ -63,7 +64,8 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio
private GLCapabilitiesChooser chooser;
private boolean choosenByWGLPixelFormat=false;
- public WindowsWGLGraphicsConfiguration(AbstractGraphicsScreen screen, GLCapabilities capsChosen, GLCapabilities capsRequested,
+ public WindowsWGLGraphicsConfiguration(AbstractGraphicsScreen screen,
+ GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested,
PIXELFORMATDESCRIPTOR pixelfmt, int pixelfmtID, GLCapabilitiesChooser chooser) {
super(screen, capsChosen, capsRequested);
this.chooser=chooser;
@@ -85,7 +87,7 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio
throw new GLException("Unable to describe pixel format " + pfdID);
}
- GLCapabilities caps = PFD2GLCapabilities(glp, pfd, onscreen, usePBuffer);
+ GLCapabilitiesImmutable caps = PFD2GLCapabilities(glp, pfd, onscreen, usePBuffer);
if(null==caps) {
throw new GLException("Couldn't choose Capabilities by: HDC 0x"+Long.toHexString(hdc)+", pfdID "+pfdID);
}
@@ -108,7 +110,7 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio
protected void updateCapabilitiesByWGL(GLContextImpl context) {
if(choosenByWGLPixelFormat) return; // already done ..
- GLCapabilities capabilities = (GLCapabilities) getRequestedCapabilities();
+ GLCapabilitiesImmutable capabilities = (GLCapabilitiesImmutable) getRequestedCapabilities();
boolean onscreen = capabilities.isOnscreen();
boolean usePBuffer = capabilities.isPBuffer();
GLProfile glp = capabilities.getGLProfile();
@@ -118,13 +120,13 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio
NativeSurface ns = drawable.getNativeSurface();
long hdc = ns.getSurfaceHandle();
- GLCapabilities[] caps = HDC2GLCapabilities(wglExt, hdc, getPixelFormatID(), glp, true, onscreen, usePBuffer);
+ GLCapabilitiesImmutable[] caps = HDC2GLCapabilities(wglExt, hdc, getPixelFormatID(), glp, true, onscreen, usePBuffer);
if(null!=caps && null!=caps[0]) {
setCapsPFD(caps[0], getPixelFormat(), getPixelFormatID(), true);
}
}
- protected void setCapsPFD(GLCapabilities caps, PIXELFORMATDESCRIPTOR pfd, int pfdID, boolean choosenByWGLPixelFormat) {
+ protected void setCapsPFD(GLCapabilitiesImmutable caps, PIXELFORMATDESCRIPTOR pfd, int pfdID, boolean choosenByWGLPixelFormat) {
this.pixelfmt = pfd;
this.pixelfmtID = pfdID;
setChosenCapabilities(caps);
@@ -146,8 +148,8 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio
private static int haveWGLChoosePixelFormatARB = -1;
private static int haveWGLARBMultisample = -1;
- public static GLCapabilities[] HDC2GLCapabilities(WGLExt wglExt, long hdc, int pfdIDOnly,
- GLProfile glp, boolean relaxed, boolean onscreen, boolean usePBuffer) {
+ public static GLCapabilitiesImmutable[] HDC2GLCapabilities(WGLExt wglExt, long hdc, int pfdIDOnly,
+ GLProfile glp, boolean relaxed, boolean onscreen, boolean usePBuffer) {
if(haveWGLChoosePixelFormatARB<0) {
haveWGLChoosePixelFormatARB = wglExt.isExtensionAvailable("WGL_ARB_pixel_format")?1:0;
@@ -168,7 +170,7 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio
// "HardwareAccelerated" bit, which is basically
// meaningless, and put in whether it can render to a
// window, to a pbuffer, or to a pixmap)
- GLCapabilities[] availableCaps = null;
+ GLCapabilitiesImmutable[] availableCaps = null;
int numFormats = 0;
int niattribs = 0;
int[] iattributes = new int [2*MAX_ATTRIBS];
@@ -212,14 +214,14 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio
}
if(pfdIDOnly>0) {
- availableCaps = new GLCapabilities[1];
+ availableCaps = new GLCapabilitiesImmutable[1];
if (!wglExt.wglGetPixelFormatAttribivARB(hdc, pfdIDOnly, 0, niattribs, iattributes, 0, iresults, 0)) {
throw new GLException("Error getting pixel format attributes for pixel format " + pfdIDOnly + " of device context");
}
availableCaps[0] = AttribList2GLCapabilities(glp, iattributes, niattribs, iresults,
relaxed, onscreen, usePBuffer);
} else {
- availableCaps = new GLCapabilities[numFormats];
+ availableCaps = new GLCapabilitiesImmutable[numFormats];
for (int i = 0; i < numFormats; i++) {
if (!wglExt.wglGetPixelFormatAttribivARB(hdc, i+1, 0, niattribs, iattributes, 0, iresults, 0)) {
throw new GLException("Error getting pixel format attributes for pixel format " + (i + 1) + " of device context");
@@ -238,11 +240,11 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio
return availableCaps;
}
- public static boolean GLCapabilities2AttribList(GLCapabilities caps,
- int[] iattributes,
- WGLExt wglExt,
- boolean pbuffer,
- int[] floatMode) throws GLException {
+ public static boolean GLCapabilities2AttribList(GLCapabilitiesImmutable caps,
+ int[] iattributes,
+ WGLExt wglExt,
+ boolean pbuffer,
+ int[] floatMode) throws GLException {
if (!wglExt.isExtensionAvailable("WGL_ARB_pixel_format")) {
return false;
}
@@ -436,7 +438,8 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio
return res;
}
- public static GLCapabilities AttribList2GLCapabilities(GLProfile glp, int[] iattribs,
+ public static GLCapabilitiesImmutable AttribList2GLCapabilities(
+ GLProfile glp, int[] iattribs,
int niattribs,
int[] iresults,
boolean relaxed, boolean onscreen, boolean usePBuffer) {
@@ -552,7 +555,7 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio
// PIXELFORMAT
- public static GLCapabilities PFD2GLCapabilities(GLProfile glp, PIXELFORMATDESCRIPTOR pfd, boolean onscreen, boolean usePBuffer) {
+ public static GLCapabilitiesImmutable PFD2GLCapabilities(GLProfile glp, PIXELFORMATDESCRIPTOR pfd, boolean onscreen, boolean usePBuffer) {
if ((pfd.getDwFlags() & GDI.PFD_SUPPORT_OPENGL) == 0) {
return null;
}
@@ -586,7 +589,7 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio
return res;
}
- public static PIXELFORMATDESCRIPTOR GLCapabilities2PFD(GLCapabilities caps) {
+ public static PIXELFORMATDESCRIPTOR GLCapabilities2PFD(GLCapabilitiesImmutable caps) {
int colorDepth = (caps.getRedBits() +
caps.getGreenBits() +
caps.getBlueBits());
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 1d8f14d94..46b169343 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
@@ -36,7 +36,6 @@ package com.jogamp.opengl.impl.windows.wgl;
import javax.media.nativewindow.AbstractGraphicsConfiguration;
import javax.media.nativewindow.AbstractGraphicsDevice;
import javax.media.nativewindow.AbstractGraphicsScreen;
-import javax.media.nativewindow.Capabilities;
import javax.media.nativewindow.CapabilitiesChooser;
import javax.media.nativewindow.DefaultGraphicsScreen;
import javax.media.nativewindow.GraphicsConfigurationFactory;
@@ -51,6 +50,8 @@ import javax.media.opengl.GLProfile;
import com.jogamp.nativewindow.impl.windows.GDI;
import com.jogamp.nativewindow.impl.windows.PIXELFORMATDESCRIPTOR;
+import javax.media.nativewindow.CapabilitiesImmutable;
+import javax.media.opengl.GLCapabilitiesImmutable;
/** Subclass of GraphicsConfigurationFactory used when non-AWT tookits
are used on Windows platforms. Toolkits will likely need to delegate
@@ -65,36 +66,44 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio
}
protected AbstractGraphicsConfiguration chooseGraphicsConfigurationImpl(
- Capabilities capabilities, CapabilitiesChooser chooser, AbstractGraphicsScreen absScreen) {
- GLCapabilities caps = (GLCapabilities)capabilities;
- return chooseGraphicsConfigurationStatic(caps, chooser, absScreen);
- }
+ CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested, CapabilitiesChooser chooser, AbstractGraphicsScreen absScreen) {
+
+ if (! (capsChosen instanceof GLCapabilitiesImmutable) ) {
+ throw new IllegalArgumentException("This NativeWindowFactory accepts only GLCapabilities objects - chosen");
+ }
- protected static WindowsWGLGraphicsConfiguration createDefaultGraphicsConfiguration(GLProfile glp, AbstractGraphicsScreen absScreen, boolean onscreen, boolean usePBuffer) {
- GLCapabilities caps = new GLCapabilities(glp);
- caps.setDoubleBuffered(onscreen); // FIXME DBLBUFOFFSCRN
- caps.setOnscreen (onscreen);
- caps.setPBuffer (usePBuffer);
+ if (! (capsRequested instanceof GLCapabilitiesImmutable) ) {
+ throw new IllegalArgumentException("This NativeWindowFactory accepts only GLCapabilities objects - requested");
+ }
+
+ return chooseGraphicsConfigurationStatic((GLCapabilitiesImmutable)capsChosen, (GLCapabilitiesImmutable)capsRequested, chooser, absScreen);
+ }
+ protected static WindowsWGLGraphicsConfiguration createDefaultGraphicsConfiguration(GLCapabilitiesImmutable caps,
+ AbstractGraphicsScreen absScreen) {
if(null==absScreen) {
absScreen = DefaultGraphicsScreen.createDefault(NativeWindowFactory.TYPE_WINDOWS);
}
return new WindowsWGLGraphicsConfiguration(absScreen, caps, caps, WindowsWGLGraphicsConfiguration.GLCapabilities2PFD(caps), -1, null);
-
}
- protected static WindowsWGLGraphicsConfiguration chooseGraphicsConfigurationStatic(GLCapabilities caps,
+ protected static WindowsWGLGraphicsConfiguration chooseGraphicsConfigurationStatic(GLCapabilitiesImmutable capsChosen,
+ GLCapabilitiesImmutable capsReq,
CapabilitiesChooser chooser,
AbstractGraphicsScreen absScreen) {
if(null==absScreen) {
absScreen = DefaultGraphicsScreen.createDefault(NativeWindowFactory.TYPE_WINDOWS);
}
- GLCapabilities caps2 = (GLCapabilities) caps.clone();
- if(!caps2.isOnscreen()) {
+
+ if(!capsChosen.isOnscreen() && capsChosen.getDoubleBuffered()) {
// OFFSCREEN !DOUBLE_BUFFER // FIXME DBLBUFOFFSCRN
+ GLCapabilities caps2 = (GLCapabilities) capsChosen.cloneMutable();
caps2.setDoubleBuffered(false);
+ capsChosen = caps2;
}
- return new WindowsWGLGraphicsConfiguration(absScreen, caps2, caps, WindowsWGLGraphicsConfiguration.GLCapabilities2PFD(caps2), -1,
+
+ return new WindowsWGLGraphicsConfiguration(absScreen, capsChosen, capsReq,
+ WindowsWGLGraphicsConfiguration.GLCapabilities2PFD(capsChosen), -1,
(GLCapabilitiesChooser)chooser);
}
@@ -117,7 +126,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio
throw new InternalError("SharedContext is null: "+device);
}
boolean choosenBywGLPixelFormat = false;
- GLCapabilities capabilities = (GLCapabilities) config.getRequestedCapabilities();
+ GLCapabilitiesImmutable capabilities = (GLCapabilitiesImmutable) config.getChosenCapabilities();
boolean onscreen = capabilities.isOnscreen();
boolean usePBuffer = capabilities.isPBuffer();
GLProfile glProfile = capabilities.getGLProfile();
@@ -134,7 +143,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio
PIXELFORMATDESCRIPTOR pfd = null;
int pixelFormat = -1; // 1-based pixel format
boolean pixelFormatSet = false;
- GLCapabilities chosenCaps = null;
+ GLCapabilitiesImmutable chosenCaps = null;
if (onscreen) {
if ((pixelFormat = GDI.GetPixelFormat(hdc)) != 0) {
@@ -149,7 +158,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio
pixelFormatSet = true;
}
- GLCapabilities[] availableCaps = null;
+ GLCapabilitiesImmutable[] availableCaps = null;
int numFormats = 0;
pfd = WindowsWGLGraphicsConfiguration.createPixelFormatDescriptor();
// Produce a recommended pixel format selection for the GLCapabilitiesChooser.
@@ -234,7 +243,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio
throw new GLException("Unable to enumerate pixel formats of window " +
toHexString(hdc) + " for GLCapabilitiesChooser (LastError: "+GDI.GetLastError()+")");
}
- availableCaps = new GLCapabilities[numFormats];
+ availableCaps = new GLCapabilitiesImmutable[numFormats];
for (int i = 0; i < numFormats; i++) {
if (GDI.DescribePixelFormat(hdc, 1 + i, pfd.size(), pfd) == 0) {
throw new GLException("Error describing pixel format " + (1 + i) + " of device context");
@@ -255,7 +264,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio
pixelFormat = chooser.chooseCapabilities(capabilities, availableCaps, recommendedPixelFormat) + 1;
} catch (NativeWindowException e) {
if(DEBUG) {
- e.printStackTrace();
+ e.printStackTrace();
}
pixelFormat = -1;
}
@@ -315,11 +324,12 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio
config.setCapsPFD(capabilities, pfd, pixelFormat, choosenBywGLPixelFormat);
}
- protected static String getThreadName() {
- return Thread.currentThread().getName();
- }
- public static String toHexString(long hex) {
- return "0x" + Long.toHexString(hex);
- }
+ protected static String getThreadName() {
+ return Thread.currentThread().getName();
+ }
+
+ public static String toHexString(long hex) {
+ return "0x" + Long.toHexString(hex);
+ }
}
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 48850440d..363881ef0 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
@@ -32,19 +32,27 @@
package com.jogamp.opengl.impl.windows.wgl.awt;
+
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
-import java.awt.GraphicsEnvironment;
-import javax.media.nativewindow.*;
-import javax.media.nativewindow.windows.*;
-import javax.media.nativewindow.awt.*;
-import javax.media.opengl.*;
-import javax.media.opengl.awt.*;
-
-import com.jogamp.opengl.impl.*;
-import com.jogamp.opengl.impl.windows.wgl.*;
-import com.jogamp.nativewindow.impl.jawt.*;
-import com.jogamp.nativewindow.impl.jawt.windows.*;
+
+import javax.media.nativewindow.AbstractGraphicsConfiguration;
+import javax.media.nativewindow.AbstractGraphicsDevice;
+import javax.media.nativewindow.AbstractGraphicsScreen;
+import javax.media.nativewindow.CapabilitiesChooser;
+import javax.media.nativewindow.CapabilitiesImmutable;
+import javax.media.nativewindow.DefaultGraphicsScreen;
+import javax.media.nativewindow.GraphicsConfigurationFactory;
+import javax.media.nativewindow.awt.AWTGraphicsConfiguration;
+import javax.media.nativewindow.awt.AWTGraphicsDevice;
+import javax.media.nativewindow.awt.AWTGraphicsScreen;
+import javax.media.nativewindow.windows.WindowsGraphicsDevice;
+
+import javax.media.opengl.GLCapabilitiesChooser;
+import javax.media.opengl.GLCapabilitiesImmutable;
+import javax.media.opengl.GLException;
+
+import com.jogamp.opengl.impl.windows.wgl.WindowsWGLGraphicsConfiguration;
public class WindowsAWTWGLGraphicsConfigurationFactory extends GraphicsConfigurationFactory {
protected static final boolean DEBUG = com.jogamp.opengl.impl.Debug.debug("GraphicsConfiguration");
@@ -54,7 +62,8 @@ public class WindowsAWTWGLGraphicsConfigurationFactory extends GraphicsConfigura
}
protected AbstractGraphicsConfiguration chooseGraphicsConfigurationImpl(
- Capabilities capabilities, CapabilitiesChooser chooser, AbstractGraphicsScreen absScreen) {
+ CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested,
+ CapabilitiesChooser chooser, AbstractGraphicsScreen absScreen) {
GraphicsDevice device = null;
if (absScreen != null &&
!(absScreen instanceof AWTGraphicsScreen)) {
@@ -67,9 +76,12 @@ public class WindowsAWTWGLGraphicsConfigurationFactory extends GraphicsConfigura
AWTGraphicsScreen awtScreen = (AWTGraphicsScreen) absScreen;
device = ((AWTGraphicsDevice)awtScreen.getDevice()).getGraphicsDevice();
- if (capabilities != null &&
- !(capabilities instanceof GLCapabilities)) {
- throw new IllegalArgumentException("This GraphicsConfigurationFactory accepts only GLCapabilities objects");
+ if ( !(capsChosen instanceof GLCapabilitiesImmutable) ) {
+ throw new IllegalArgumentException("This GraphicsConfigurationFactory accepts only GLCapabilities objects - chosen");
+ }
+
+ if ( !(capsRequested instanceof GLCapabilitiesImmutable) ) {
+ throw new IllegalArgumentException("This GraphicsConfigurationFactory accepts only GLCapabilities objects - requested");
}
if (chooser != null &&
@@ -81,13 +93,11 @@ public class WindowsAWTWGLGraphicsConfigurationFactory extends GraphicsConfigura
System.err.println("WindowsAWTWGLGraphicsConfigurationFactory: got "+absScreen);
}
GraphicsConfiguration gc = device.getDefaultConfiguration();
- AWTGraphicsConfiguration.setupCapabilitiesRGBABits(capabilities, gc);
+ capsChosen = AWTGraphicsConfiguration.setupCapabilitiesRGBABits(capsChosen, gc);
if(DEBUG) {
- System.err.println("AWT Colormodel compatible: "+capabilities);
+ System.err.println("AWT Colormodel compatible: "+capsChosen);
}
- long displayHandle = 0;
-
WindowsGraphicsDevice winDevice = new WindowsGraphicsDevice(AbstractGraphicsDevice.DEFAULT_UNIT);
DefaultGraphicsScreen winScreen = new DefaultGraphicsScreen(winDevice, awtScreen.getIndex());
if(DEBUG) {
@@ -95,12 +105,12 @@ public class WindowsAWTWGLGraphicsConfigurationFactory extends GraphicsConfigura
}
WindowsWGLGraphicsConfiguration winConfig = (WindowsWGLGraphicsConfiguration)
- GraphicsConfigurationFactory.getFactory(winDevice).chooseGraphicsConfiguration(capabilities,
- chooser,
- winScreen);
+ GraphicsConfigurationFactory.getFactory(winDevice).chooseGraphicsConfiguration(capsChosen,
+ capsRequested,
+ chooser, winScreen);
if (winConfig == null) {
- throw new GLException("Unable to choose a GraphicsConfiguration: "+capabilities+",\n\t"+chooser+"\n\t"+winScreen);
+ throw new GLException("Unable to choose a GraphicsConfiguration: "+capsChosen+",\n\t"+chooser+"\n\t"+winScreen);
}
if(DEBUG) {
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11DummyGLXDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11DummyGLXDrawable.java
index e77735637..6c8d1fc91 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11DummyGLXDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11DummyGLXDrawable.java
@@ -43,10 +43,10 @@ public class X11DummyGLXDrawable extends X11OnscreenGLXDrawable {
* we cannot switch the Display as we please,
* hence we reuse the target's screen configuration.
*/
- public X11DummyGLXDrawable(X11GraphicsScreen screen, GLDrawableFactory factory, GLProfile glp) {
+ public X11DummyGLXDrawable(X11GraphicsScreen screen, GLDrawableFactory factory, GLCapabilitiesImmutable caps) {
super(factory,
new ProxySurface(X11GLXGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(
- new GLCapabilities(glp), null, screen)));
+ caps, caps, null, screen)));
this.realized = true;
ProxySurface ns = (ProxySurface) getNativeSurface();
@@ -63,6 +63,11 @@ public class X11DummyGLXDrawable extends X11OnscreenGLXDrawable {
updateHandle();
}
+ public static X11DummyGLXDrawable create(X11GraphicsScreen screen, GLDrawableFactory factory, GLProfile glp) {
+ GLCapabilities caps = new GLCapabilities(glp);
+ return new X11DummyGLXDrawable(screen, factory, caps);
+ }
+
public void setSize(int width, int height) {
}
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXContext.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXContext.java
index 63b758da3..1dadc2edf 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXContext.java
@@ -268,7 +268,7 @@ public abstract class X11GLXContext extends GLContextImpl {
direct = GLX.glXIsDirect(display, share);
}
- GLCapabilities glCaps = (GLCapabilities) config.getChosenCapabilities();
+ GLCapabilitiesImmutable glCaps = (GLCapabilitiesImmutable) config.getChosenCapabilities();
GLProfile glp = glCaps.getGLProfile();
isVendorATI = factory.isVendorATI(device);
@@ -494,7 +494,7 @@ public abstract class X11GLXContext extends GLContextImpl {
protected void setSwapIntervalImpl(int interval) {
X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)drawable.getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration();
- GLCapabilities glCaps = (GLCapabilities) config.getChosenCapabilities();
+ GLCapabilitiesImmutable glCaps = (GLCapabilitiesImmutable) config.getChosenCapabilities();
if(!glCaps.isOnscreen()) return;
GLXExt glXExt = getGLXExt();
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 d98d8a436..d4df76315 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
@@ -210,7 +210,8 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
try {
String vendorName = GLXUtil.getVendorName(sharedDevice.getHandle());
X11GraphicsScreen sharedScreen = new X11GraphicsScreen(sharedDevice, 0);
- X11DummyGLXDrawable sharedDrawable = new X11DummyGLXDrawable(sharedScreen, X11GLXDrawableFactory.this, GLProfile.getDefault(sharedDevice));
+ X11DummyGLXDrawable sharedDrawable = X11DummyGLXDrawable.create(sharedScreen, X11GLXDrawableFactory.this,
+ GLProfile.getDefault(sharedDevice));
if (null == sharedScreen || null == sharedDrawable) {
throw new GLException("Couldn't init shared screen(" + sharedScreen + ")/drawable(" + sharedDrawable + ")");
}
@@ -482,7 +483,8 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
}
- protected final NativeSurface createOffscreenSurfaceImpl(GLCapabilities capabilities, GLCapabilitiesChooser chooser, int width, int height) {
+ protected final NativeSurface createOffscreenSurfaceImpl(GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser,
+ int width, int height) {
X11GraphicsScreen screen = null;
SharedResource sr = getOrCreateShared(defaultDevice);
if(null!=sr) {
@@ -493,7 +495,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
}
ProxySurface ns = new ProxySurface(
- X11GLXGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capabilities, chooser, screen) );
+ X11GLXGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capsChosen, capsRequested, chooser, screen) );
if(ns != null) {
ns.setSize(width, height);
}
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXGraphicsConfiguration.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXGraphicsConfiguration.java
index b2bc59578..9cb00b198 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXGraphicsConfiguration.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXGraphicsConfiguration.java
@@ -1,5 +1,6 @@
/*
* 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
@@ -48,7 +49,7 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem
private GLCapabilitiesChooser chooser;
public X11GLXGraphicsConfiguration(X11GraphicsScreen screen,
- GLCapabilities capsChosen, GLCapabilities capsRequested, GLCapabilitiesChooser chooser,
+ GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser,
XVisualInfo info, long fbcfg, int fbcfgID) {
super(screen, capsChosen, capsRequested, info);
this.chooser=chooser;
@@ -69,7 +70,7 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem
if(null==glp) {
glp = GLProfile.getDefault(x11Screen.getDevice());
}
- GLCapabilities caps = GLXFBConfig2GLCapabilities(glp, display, fbcfg, true, true, true, GLXUtil.isMultisampleAvailable(display));
+ GLCapabilitiesImmutable caps = GLXFBConfig2GLCapabilities(glp, display, fbcfg, true, true, true, GLXUtil.isMultisampleAvailable(display));
if(null==caps) {
throw new GLException("GLCapabilities null of "+toHexString(fbcfg));
}
@@ -89,9 +90,8 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem
protected void updateGraphicsConfiguration() {
X11GLXGraphicsConfiguration newConfig = (X11GLXGraphicsConfiguration)
- GraphicsConfigurationFactory.getFactory(getScreen().getDevice()).chooseGraphicsConfiguration(getRequestedCapabilities().cloneCapabilites(),
- chooser,
- getScreen());
+ GraphicsConfigurationFactory.getFactory(getScreen().getDevice()).chooseGraphicsConfiguration(
+ getChosenCapabilities(), getRequestedCapabilities(), chooser, getScreen());
if(null!=newConfig) {
// FIXME: setScreen( ... );
setXVisualInfo(newConfig.getXVisualInfo());
@@ -108,7 +108,7 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem
return value != 0 ? value : (int)GLX.GLX_DONT_CARE ;
}
- public static int[] GLCapabilities2AttribList(GLCapabilities caps,
+ public static int[] GLCapabilities2AttribList(GLCapabilitiesImmutable caps,
boolean forFBAttr,
boolean isMultisampleAvailable,
long display,
@@ -236,8 +236,9 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem
return res;
}
- public static GLCapabilities GLXFBConfig2GLCapabilities(GLProfile glp, long display, long fbcfg,
- boolean relaxed, boolean onscreen, boolean usePBuffer, boolean isMultisampleEnabled) {
+ public static GLCapabilitiesImmutable GLXFBConfig2GLCapabilities(GLProfile glp, long display, long fbcfg,
+ boolean relaxed, boolean onscreen, boolean usePBuffer,
+ boolean isMultisampleEnabled) {
int[] tmp = new int[1];
int val;
val = glXGetFBConfig(display, fbcfg, GLX.GLX_RENDER_TYPE, tmp, 0);
@@ -351,7 +352,8 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem
return res;
}
- public static GLCapabilities XVisualInfo2GLCapabilities(GLProfile glp, long display, XVisualInfo info, boolean onscreen, boolean usePBuffer, boolean isMultisampleEnabled) {
+ public static GLCapabilitiesImmutable XVisualInfo2GLCapabilities(GLProfile glp, long display, XVisualInfo info,
+ boolean onscreen, boolean usePBuffer, boolean isMultisampleEnabled) {
int[] tmp = new int[1];
int val = glXGetConfig(display, info, GLX.GLX_USE_GL, tmp, 0);
if (val == 0) {
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXGraphicsConfigurationFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXGraphicsConfigurationFactory.java
index 8dbd69dce..1b20040b0 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXGraphicsConfigurationFactory.java
@@ -1,5 +1,6 @@
/*
* 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
@@ -32,13 +33,26 @@
package com.jogamp.opengl.impl.x11.glx;
-import com.jogamp.common.nio.PointerBuffer;
-import javax.media.nativewindow.*;
-import javax.media.nativewindow.x11.*;
-import com.jogamp.nativewindow.impl.x11.*;
+import javax.media.nativewindow.AbstractGraphicsConfiguration;
+import javax.media.nativewindow.AbstractGraphicsDevice;
+import javax.media.nativewindow.AbstractGraphicsScreen;
+import javax.media.nativewindow.CapabilitiesChooser;
+import javax.media.nativewindow.CapabilitiesImmutable;
+import javax.media.nativewindow.GraphicsConfigurationFactory;
+import javax.media.nativewindow.NativeWindowException;
+import javax.media.nativewindow.x11.X11GraphicsScreen;
+import javax.media.opengl.DefaultGLCapabilitiesChooser;
+import javax.media.opengl.GLCapabilities;
+import javax.media.opengl.GLCapabilitiesChooser;
+import javax.media.opengl.GLCapabilitiesImmutable;
+import javax.media.opengl.GLException;
+import javax.media.opengl.GLProfile;
-import javax.media.opengl.*;
-import com.jogamp.opengl.impl.*;
+import com.jogamp.common.nio.PointerBuffer;
+import com.jogamp.nativewindow.impl.x11.X11Lib;
+import com.jogamp.nativewindow.impl.x11.X11Util;
+import com.jogamp.nativewindow.impl.x11.XVisualInfo;
+import com.jogamp.opengl.impl.Debug;
/** Subclass of GraphicsConfigurationFactory used when non-AWT toolkits
@@ -54,19 +68,24 @@ public class X11GLXGraphicsConfigurationFactory extends GraphicsConfigurationFac
}
protected AbstractGraphicsConfiguration chooseGraphicsConfigurationImpl(
- Capabilities capabilities, CapabilitiesChooser chooser, AbstractGraphicsScreen absScreen) {
+ CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested, CapabilitiesChooser chooser, AbstractGraphicsScreen absScreen) {
if (!(absScreen instanceof X11GraphicsScreen)) {
throw new IllegalArgumentException("Only X11GraphicsScreen are allowed here");
}
- if (capabilities != null && !(capabilities instanceof GLCapabilities)) {
- throw new IllegalArgumentException("This NativeWindowFactory accepts only GLCapabilities objects");
+ if ( !(capsChosen instanceof GLCapabilitiesImmutable) ) {
+ throw new IllegalArgumentException("This NativeWindowFactory accepts only GLCapabilities objects - chosen");
+ }
+
+ if ( !(capsRequested instanceof GLCapabilitiesImmutable)) {
+ throw new IllegalArgumentException("This NativeWindowFactory accepts only GLCapabilities objects - requested");
}
if (chooser != null && !(chooser instanceof GLCapabilitiesChooser)) {
throw new IllegalArgumentException("This NativeWindowFactory accepts only GLCapabilitiesChooser objects");
}
- return chooseGraphicsConfigurationStatic((GLCapabilities)capabilities, (GLCapabilitiesChooser)chooser, (X11GraphicsScreen)absScreen);
+ return chooseGraphicsConfigurationStatic((GLCapabilitiesImmutable)capsChosen, (GLCapabilitiesImmutable)capsRequested,
+ (GLCapabilitiesChooser)chooser, (X11GraphicsScreen)absScreen);
}
/**
@@ -119,56 +138,58 @@ public class X11GLXGraphicsConfigurationFactory extends GraphicsConfigurationFac
return new X11GLXGraphicsConfiguration(x11Screen, (null!=capsFB)?capsFB:caps, caps, null, xvis, fbcfg, fbid);
} */
- protected static X11GLXGraphicsConfiguration chooseGraphicsConfigurationStatic(GLCapabilities capabilities,
- GLCapabilitiesChooser chooser,
- X11GraphicsScreen x11Screen) {
+ protected static X11GLXGraphicsConfiguration chooseGraphicsConfigurationStatic(GLCapabilitiesImmutable capsChosen,
+ GLCapabilitiesImmutable capsReq,
+ GLCapabilitiesChooser chooser,
+ X11GraphicsScreen x11Screen) {
if (x11Screen == null) {
throw new IllegalArgumentException("AbstractGraphicsScreen is null");
}
- if (capabilities == null) {
- capabilities = new GLCapabilities(null);
+ if (capsChosen == null) {
+ capsChosen = new GLCapabilities(null);
}
- GLCapabilities caps2 = (GLCapabilities) capabilities.clone();
-
- boolean usePBuffer = caps2.isPBuffer();
-
- if(!caps2.isOnscreen()) {
+ if(!capsChosen.isOnscreen() && capsChosen.getDoubleBuffered()) {
// OFFSCREEN !DOUBLE_BUFFER // FIXME DBLBUFOFFSCRN
+ GLCapabilities caps2 = (GLCapabilities) capsChosen.cloneMutable();
caps2.setDoubleBuffered(false);
+ capsChosen = caps2;
}
+
+ boolean usePBuffer = capsChosen.isPBuffer();
X11GLXGraphicsConfiguration res;
- res = chooseGraphicsConfigurationFBConfig(caps2, chooser, x11Screen);
+ res = chooseGraphicsConfigurationFBConfig(capsChosen, capsReq, chooser, x11Screen);
if(null==res) {
if(usePBuffer) {
- throw new GLException("Error: Couldn't create X11GLXGraphicsConfiguration based on FBConfig for "+caps2);
+ throw new GLException("Error: Couldn't create X11GLXGraphicsConfiguration based on FBConfig for "+capsChosen);
}
- res = chooseGraphicsConfigurationXVisual(caps2, chooser, x11Screen);
+ res = chooseGraphicsConfigurationXVisual(capsChosen, capsReq, chooser, x11Screen);
}
if(null==res) {
- throw new GLException("Error: Couldn't create X11GLXGraphicsConfiguration based on FBConfig and XVisual for "+caps2);
+ throw new GLException("Error: Couldn't create X11GLXGraphicsConfiguration based on FBConfig and XVisual for "+capsChosen);
}
if(DEBUG) {
- System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationStatic("+x11Screen+","+caps2+"): "+res);
+ System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationStatic("+x11Screen+","+capsChosen+"): "+res);
}
return res;
}
- private static X11GLXGraphicsConfiguration chooseGraphicsConfigurationFBConfig(GLCapabilities capabilities,
- GLCapabilitiesChooser chooser,
- X11GraphicsScreen x11Screen) {
+ private static X11GLXGraphicsConfiguration chooseGraphicsConfigurationFBConfig(GLCapabilitiesImmutable capsChosen,
+ GLCapabilitiesImmutable capsReq,
+ GLCapabilitiesChooser chooser,
+ X11GraphicsScreen x11Screen) {
long recommendedFBConfig = 0;
int recommendedIndex = -1;
- GLCapabilities[] caps = null;
+ GLCapabilitiesImmutable[] caps = null;
PointerBuffer fbcfgsL = null;
int chosen=-1;
int retFBID=-1;
XVisualInfo retXVisualInfo = null;
- GLProfile glProfile = capabilities.getGLProfile();
- boolean onscreen = capabilities.isOnscreen();
- boolean usePBuffer = capabilities.isPBuffer();
+ GLProfile glProfile = capsChosen.getGLProfile();
+ boolean onscreen = capsChosen.isOnscreen();
+ boolean usePBuffer = capsChosen.isPBuffer();
// Utilizing FBConfig
//
@@ -177,18 +198,18 @@ public class X11GLXGraphicsConfigurationFactory extends GraphicsConfigurationFac
int screen = x11Screen.getIndex();
boolean isMultisampleAvailable = GLXUtil.isMultisampleAvailable(display);
- int[] attribs = X11GLXGraphicsConfiguration.GLCapabilities2AttribList(capabilities, true, isMultisampleAvailable, display, screen);
+ int[] attribs = X11GLXGraphicsConfiguration.GLCapabilities2AttribList(capsChosen, true, isMultisampleAvailable, display, screen);
int[] count = { -1 };
// determine the recommended FBConfig ..
fbcfgsL = GLX.glXChooseFBConfig(display, screen, attribs, 0, count, 0);
if (fbcfgsL == null || fbcfgsL.limit()<1) {
if(DEBUG) {
- System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationFBConfig: Failed glXChooseFBConfig ("+x11Screen+","+capabilities+"): "+fbcfgsL+", "+count[0]);
+ System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationFBConfig: Failed glXChooseFBConfig ("+x11Screen+","+capsChosen+"): "+fbcfgsL+", "+count[0]);
}
} else if( !X11GLXGraphicsConfiguration.GLXFBConfigValid( display, fbcfgsL.get(0) ) ) {
if(DEBUG) {
- System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationFBConfig: Failed - GLX FBConfig invalid: ("+x11Screen+","+capabilities+"): "+fbcfgsL+", fbcfg: "+toHexString(fbcfgsL.get(0)));
+ System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationFBConfig: Failed - GLX FBConfig invalid: ("+x11Screen+","+capsChosen+"): "+fbcfgsL+", fbcfg: "+toHexString(fbcfgsL.get(0)));
}
} else {
recommendedFBConfig = fbcfgsL.get(0);
@@ -204,11 +225,11 @@ public class X11GLXGraphicsConfigurationFactory extends GraphicsConfigurationFac
}
// make GLCapabilities and seek the recommendedIndex
- caps = new GLCapabilities[fbcfgsL.limit()];
+ caps = new GLCapabilitiesImmutable[fbcfgsL.limit()];
for (int i = 0; i < fbcfgsL.limit(); i++) {
if( !X11GLXGraphicsConfiguration.GLXFBConfigValid( display, fbcfgsL.get(i) ) ) {
if(DEBUG) {
- System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationFBConfig: FBConfig invalid: ("+x11Screen+","+capabilities+"): fbcfg: "+toHexString(fbcfgsL.get(i)));
+ System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationFBConfig: FBConfig invalid: ("+x11Screen+","+capsChosen+"): fbcfg: "+toHexString(fbcfgsL.get(i)));
}
} else {
caps[i] = X11GLXGraphicsConfiguration.GLXFBConfig2GLCapabilities(glProfile, display, fbcfgsL.get(i),
@@ -232,7 +253,7 @@ public class X11GLXGraphicsConfigurationFactory extends GraphicsConfigurationFac
chooser = new DefaultGLCapabilitiesChooser();
}
try {
- chosen = chooser.chooseCapabilities(capabilities, caps, recommendedIndex);
+ chosen = chooser.chooseCapabilities(capsChosen, caps, recommendedIndex);
} catch (NativeWindowException e) {
if(DEBUG) {
e.printStackTrace();
@@ -246,7 +267,9 @@ public class X11GLXGraphicsConfigurationFactory extends GraphicsConfigurationFac
System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationFBConfig Failed .. unable to choose config, using first");
}
// seek first available one ..
- for(chosen = 0; chosen < caps.length && caps[chosen]==null; chosen++) ;
+ for(chosen = 0; chosen < caps.length && caps[chosen]==null; chosen++) {
+ // nop
+ }
if(chosen==caps.length) {
// give up ..
if(DEBUG) {
@@ -274,12 +297,13 @@ public class X11GLXGraphicsConfigurationFactory extends GraphicsConfigurationFac
}
}
- return new X11GLXGraphicsConfiguration(x11Screen, caps[chosen], capabilities, chooser, retXVisualInfo, fbcfgsL.get(chosen), retFBID);
+ return new X11GLXGraphicsConfiguration(x11Screen, caps[chosen], capsReq, chooser, retXVisualInfo, fbcfgsL.get(chosen), retFBID);
}
- private static X11GLXGraphicsConfiguration chooseGraphicsConfigurationXVisual(GLCapabilities capabilities,
- GLCapabilitiesChooser chooser,
- X11GraphicsScreen x11Screen) {
+ private static X11GLXGraphicsConfiguration chooseGraphicsConfigurationXVisual(GLCapabilitiesImmutable capsChosen,
+ GLCapabilitiesImmutable capsReq,
+ GLCapabilitiesChooser chooser,
+ X11GraphicsScreen x11Screen) {
if (chooser == null) {
chooser = new DefaultGLCapabilitiesChooser();
}
@@ -288,9 +312,9 @@ public class X11GLXGraphicsConfigurationFactory extends GraphicsConfigurationFac
// in pure Java, we're going to provide the underlying window
// system's selection to the chooser as a hint
- GLProfile glProfile = capabilities.getGLProfile();
- boolean onscreen = capabilities.isOnscreen();
- GLCapabilities[] caps = null;
+ GLProfile glProfile = capsChosen.getGLProfile();
+ boolean onscreen = capsChosen.isOnscreen();
+ GLCapabilitiesImmutable[] caps = null;
int recommendedIndex = -1;
XVisualInfo retXVisualInfo = null;
int chosen=-1;
@@ -300,7 +324,7 @@ public class X11GLXGraphicsConfigurationFactory extends GraphicsConfigurationFac
int screen = x11Screen.getIndex();
boolean isMultisampleAvailable = GLXUtil.isMultisampleAvailable(display);
- int[] attribs = X11GLXGraphicsConfiguration.GLCapabilities2AttribList(capabilities, false, isMultisampleAvailable, display, screen);
+ int[] attribs = X11GLXGraphicsConfiguration.GLCapabilities2AttribList(capsChosen, false, isMultisampleAvailable, display, screen);
XVisualInfo[] infos = null;
XVisualInfo recommendedVis = GLX.glXChooseVisual(display, screen, attribs, 0);
@@ -319,7 +343,7 @@ public class X11GLXGraphicsConfigurationFactory extends GraphicsConfigurationFac
if (infos == null || infos.length<1) {
throw new GLException("Error while enumerating available XVisualInfos");
}
- caps = new GLCapabilities[infos.length];
+ caps = new GLCapabilitiesImmutable[infos.length];
for (int i = 0; i < infos.length; i++) {
caps[i] = X11GLXGraphicsConfiguration.XVisualInfo2GLCapabilities(glProfile, display, infos[i], onscreen, false, isMultisampleAvailable);
// Attempt to find the visual chosen by glXChooseVisual
@@ -328,7 +352,7 @@ public class X11GLXGraphicsConfigurationFactory extends GraphicsConfigurationFac
}
}
try {
- chosen = chooser.chooseCapabilities(capabilities, caps, recommendedIndex);
+ chosen = chooser.chooseCapabilities(capsChosen, caps, recommendedIndex);
} catch (NativeWindowException e) {
if(DEBUG) {
e.printStackTrace();
@@ -348,7 +372,7 @@ public class X11GLXGraphicsConfigurationFactory extends GraphicsConfigurationFac
throw new GLException("GLCapabilitiesChooser chose an invalid visual for "+caps[chosen]);
}
retXVisualInfo = XVisualInfo.create(infos[chosen]);
- return new X11GLXGraphicsConfiguration(x11Screen, caps[chosen], capabilities, chooser, retXVisualInfo, 0, -1);
+ return new X11GLXGraphicsConfiguration(x11Screen, caps[chosen], capsReq, chooser, retXVisualInfo, 0, -1);
}
public static String toHexString(int val) {
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OffscreenGLXContext.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OffscreenGLXContext.java
index 7054faa0c..5ae641278 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OffscreenGLXContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OffscreenGLXContext.java
@@ -55,7 +55,7 @@ public class X11OffscreenGLXContext extends X11GLXContext {
}
public int getOffscreenContextReadBuffer() {
- GLCapabilities caps = (GLCapabilities)drawable.getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration().getChosenCapabilities();
+ GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable)drawable.getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration().getChosenCapabilities();
if (caps.getDoubleBuffered()) {
return GL.GL_BACK;
}
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11PbufferGLXDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11PbufferGLXDrawable.java
index b86394cc6..41cd543aa 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11PbufferGLXDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11PbufferGLXDrawable.java
@@ -94,7 +94,7 @@ public class X11PbufferGLXDrawable extends X11GLXDrawable {
NativeSurface ns = getNativeSurface();
- GLCapabilities capabilities = (GLCapabilities)config.getChosenCapabilities();
+ GLCapabilitiesImmutable capabilities = (GLCapabilitiesImmutable)config.getChosenCapabilities();
if (capabilities.getPbufferRenderToTexture()) {
throw new GLException("Render-to-texture pbuffers not supported yet on X11");
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/awt/X11AWTGLXGraphicsConfigurationFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/awt/X11AWTGLXGraphicsConfigurationFactory.java
index d4af56aca..03955b439 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/awt/X11AWTGLXGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/awt/X11AWTGLXGraphicsConfigurationFactory.java
@@ -1,5 +1,6 @@
/*
* 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
@@ -51,7 +52,8 @@ public class X11AWTGLXGraphicsConfigurationFactory extends GraphicsConfiguration
}
protected AbstractGraphicsConfiguration chooseGraphicsConfigurationImpl(
- Capabilities capabilities, CapabilitiesChooser chooser, AbstractGraphicsScreen absScreen) {
+ CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested,
+ CapabilitiesChooser chooser, AbstractGraphicsScreen absScreen) {
GraphicsDevice device = null;
if (absScreen != null &&
!(absScreen instanceof AWTGraphicsScreen)) {
@@ -64,9 +66,12 @@ public class X11AWTGLXGraphicsConfigurationFactory extends GraphicsConfiguration
AWTGraphicsScreen awtScreen = (AWTGraphicsScreen) absScreen;
device = ((AWTGraphicsDevice)awtScreen.getDevice()).getGraphicsDevice();
- if (capabilities != null &&
- !(capabilities instanceof GLCapabilities)) {
- throw new IllegalArgumentException("This GraphicsConfigurationFactory accepts only GLCapabilities objects");
+ if ( !(capsChosen instanceof GLCapabilitiesImmutable) ) {
+ throw new IllegalArgumentException("This GraphicsConfigurationFactory accepts only GLCapabilities objects - chosen");
+ }
+
+ if ( !(capsRequested instanceof GLCapabilitiesImmutable) ) {
+ throw new IllegalArgumentException("This GraphicsConfigurationFactory accepts only GLCapabilities objects - requested");
}
if (chooser != null &&
@@ -103,14 +108,14 @@ public class X11AWTGLXGraphicsConfigurationFactory extends GraphicsConfiguration
}
gc = device.getDefaultConfiguration();
- AWTGraphicsConfiguration.setupCapabilitiesRGBABits(capabilities, gc);
+ capsChosen = AWTGraphicsConfiguration.setupCapabilitiesRGBABits(capsChosen, gc);
if(DEBUG) {
- System.err.println("AWT Colormodel compatible: "+capabilities);
+ System.err.println("AWT Colormodel compatible: "+capsChosen);
}
GraphicsConfigurationFactory factory = GraphicsConfigurationFactory.getFactory(x11Device);
- x11Config = (X11GraphicsConfiguration)factory.chooseGraphicsConfiguration(capabilities, chooser, x11Screen);
+ x11Config = (X11GraphicsConfiguration)factory.chooseGraphicsConfiguration(capsChosen, capsRequested, chooser, x11Screen);
if (x11Config == null) {
- throw new GLException("Unable to choose a GraphicsConfiguration: "+capabilities+",\n\t"+chooser+"\n\t"+x11Screen);
+ throw new GLException("Unable to choose a GraphicsConfiguration: "+capsChosen+",\n\t"+chooser+"\n\t"+x11Screen);
}
long visualID = x11Config.getVisualID();