summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/javax/media
diff options
context:
space:
mode:
authorSven Gothel <sgothel@jausoft.com>2010-11-17 21:53:16 +0100
committerSven Gothel <sgothel@jausoft.com>2010-11-17 21:53:16 +0100
commit29e3b223eae9f5775d1dd34f2aaeeb3db6d9233c (patch)
treeeae2c7d60a4cdbcdacd4057b020044bd42fb30b8 /src/jogl/classes/javax/media
parent64aa219406c1aa1d6022fedce7a52c8c19d0e35d (diff)
Finishing Immutable changes including GLCapabiltiesImmutable.
Diffstat (limited to 'src/jogl/classes/javax/media')
-rw-r--r--src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java16
-rw-r--r--src/jogl/classes/javax/media/opengl/GLCapabilities.java30
-rw-r--r--src/jogl/classes/javax/media/opengl/GLCapabilitiesImmutable.java147
-rw-r--r--src/jogl/classes/javax/media/opengl/GLDrawable.java8
-rw-r--r--src/jogl/classes/javax/media/opengl/GLDrawableFactory.java6
-rw-r--r--src/jogl/classes/javax/media/opengl/awt/GLCanvas.java40
-rw-r--r--src/jogl/classes/javax/media/opengl/awt/GLJPanel.java32
7 files changed, 230 insertions, 49 deletions
diff --git a/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java b/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java
index dc6daa645..695fad5a9 100644
--- a/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java
+++ b/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java
@@ -40,9 +40,9 @@
package javax.media.opengl;
-import javax.media.nativewindow.Capabilities;
import javax.media.nativewindow.NativeWindowException;
import com.jogamp.opengl.impl.Debug;
+import javax.media.nativewindow.CapabilitiesImmutable;
/** <P> The default implementation of the {@link
GLCapabilitiesChooser} interface, which provides consistent visual
@@ -85,11 +85,11 @@ import com.jogamp.opengl.impl.Debug;
public class DefaultGLCapabilitiesChooser implements GLCapabilitiesChooser {
private static final boolean DEBUG = Debug.debug("CapabilitiesChooser");
- public int chooseCapabilities(Capabilities desired,
- Capabilities[] available,
+ public int chooseCapabilities(CapabilitiesImmutable desired,
+ CapabilitiesImmutable[] available,
int windowSystemRecommendedChoice) {
- GLCapabilities _desired = (GLCapabilities) desired;
- GLCapabilities[] _available = (GLCapabilities[]) available;
+ GLCapabilitiesImmutable _desired = (GLCapabilitiesImmutable) desired;
+ GLCapabilitiesImmutable[] _available = (GLCapabilitiesImmutable[]) available;
int availnum = 0;
for (int i = 0; i < _available.length; i++) {
@@ -132,7 +132,7 @@ public class DefaultGLCapabilitiesChooser implements GLCapabilitiesChooser {
}
// Compute score for each
for (int i = 0; i < scores.length; i++) {
- GLCapabilities cur = _available[i];
+ GLCapabilitiesImmutable cur = _available[i];
if (cur == null) {
continue;
}
@@ -177,7 +177,7 @@ public class DefaultGLCapabilitiesChooser implements GLCapabilitiesChooser {
if (score == NO_SCORE) {
continue;
}
- GLCapabilities cur = _available[i];
+ GLCapabilitiesImmutable cur = _available[i];
if (cur.getHardwareAccelerated()) {
int absScore = Math.abs(score);
if (!gotHW ||
@@ -193,7 +193,7 @@ public class DefaultGLCapabilitiesChooser implements GLCapabilitiesChooser {
if (score == NO_SCORE) {
continue;
}
- GLCapabilities cur = _available[i];
+ GLCapabilitiesImmutable cur = _available[i];
if (!cur.getHardwareAccelerated()) {
if (score <= 0) {
score -= maxAbsoluteHWScore;
diff --git a/src/jogl/classes/javax/media/opengl/GLCapabilities.java b/src/jogl/classes/javax/media/opengl/GLCapabilities.java
index d48b95c79..3d2e2bcc9 100644
--- a/src/jogl/classes/javax/media/opengl/GLCapabilities.java
+++ b/src/jogl/classes/javax/media/opengl/GLCapabilities.java
@@ -53,7 +53,7 @@ import javax.media.nativewindow.Capabilities;
It currently contains the minimal number of routines which allow
configuration on all supported window systems. */
-public class GLCapabilities extends Capabilities implements Cloneable {
+public class GLCapabilities extends Capabilities implements Cloneable, GLCapabilitiesImmutable {
private GLProfile glProfile = null;
private boolean pbuffer = false;
private boolean doubleBuffered = true;
@@ -84,6 +84,10 @@ public class GLCapabilities extends Capabilities implements Cloneable {
glProfile = (null!=glp)?glp:GLProfile.getDefault(GLProfile.getDefaultDevice());
}
+ public Object cloneMutable() {
+ return clone();
+ }
+
public Object clone() {
try {
return super.clone();
@@ -92,12 +96,32 @@ public class GLCapabilities extends Capabilities implements Cloneable {
}
}
+ public int hashCode() {
+ // 31 * x == (x << 5) - x
+ int hash = 31 + this.glProfile.hashCode() ;
+ hash = ((hash << 5) - hash) + ( this.pbuffer ? 1 : 0 );
+ hash = ((hash << 5) - hash) + ( this.stereo ? 1 : 0 );
+ hash = ((hash << 5) - hash) + ( this.hardwareAccelerated ? 1 : 0 );
+ hash = ((hash << 5) - hash) + this.depthBits;
+ hash = ((hash << 5) - hash) + this.stencilBits;
+ hash = ((hash << 5) - hash) + this.accumRedBits;
+ hash = ((hash << 5) - hash) + this.accumGreenBits;
+ hash = ((hash << 5) - hash) + this.accumBlueBits;
+ hash = ((hash << 5) - hash) + this.accumAlphaBits;
+ hash = ((hash << 5) - hash) + ( this.sampleBuffers ? 1 : 0 );
+ hash = ((hash << 5) - hash) + this.numSamples;
+ hash = ((hash << 5) - hash) + ( this.pbufferFloatingPointBuffers ? 1 : 0 );
+ hash = ((hash << 5) - hash) + ( this.pbufferRenderToTexture ? 1 : 0 );
+ hash = ((hash << 5) - hash) + ( this.pbufferRenderToTextureRectangle ? 1 : 0 );
+ return hash;
+ }
+
public boolean equals(Object obj) {
if(this == obj) { return true; }
- if(!(obj instanceof GLCapabilities)) {
+ if(!(obj instanceof GLCapabilitiesImmutable)) {
return false;
}
- GLCapabilities other = (GLCapabilities)obj;
+ GLCapabilitiesImmutable other = (GLCapabilitiesImmutable)obj;
boolean res = super.equals(obj) &&
other.getGLProfile()==glProfile &&
other.isPBuffer()==pbuffer &&
diff --git a/src/jogl/classes/javax/media/opengl/GLCapabilitiesImmutable.java b/src/jogl/classes/javax/media/opengl/GLCapabilitiesImmutable.java
new file mode 100644
index 000000000..7224d65a8
--- /dev/null
+++ b/src/jogl/classes/javax/media/opengl/GLCapabilitiesImmutable.java
@@ -0,0 +1,147 @@
+/**
+ * Copyright 2010 JogAmp Community. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of JogAmp Community.
+ */
+
+package javax.media.opengl;
+
+import com.jogamp.common.type.WriteCloneable;
+import javax.media.nativewindow.CapabilitiesImmutable;
+
+/**
+ * Specifies an immutable set of OpenGL capabilities.<br>
+ *
+ * @see javax.media.opengl.GLCapabilities
+ * @see javax.media.nativewindow.CapabilitiesImmutable
+ */
+public interface GLCapabilitiesImmutable extends WriteCloneable, CapabilitiesImmutable {
+
+ /**
+ * Returns the number of bits requested for the accumulation
+ * buffer's alpha component. On some systems only the accumulation
+ * buffer depth, which is the sum of the red, green, and blue bits,
+ * is considered.
+ */
+ int getAccumAlphaBits();
+
+ /**
+ * Returns the number of bits requested for the accumulation
+ * buffer's blue component. On some systems only the accumulation
+ * buffer depth, which is the sum of the red, green, and blue bits,
+ * is considered.
+ */
+ int getAccumBlueBits();
+
+ /**
+ * Returns the number of bits requested for the accumulation
+ * buffer's green component. On some systems only the accumulation
+ * buffer depth, which is the sum of the red, green, and blue bits,
+ * is considered.
+ */
+ int getAccumGreenBits();
+
+ /**
+ * Returns the number of bits requested for the accumulation
+ * buffer's red component. On some systems only the accumulation
+ * buffer depth, which is the sum of the red, green, and blue bits,
+ * is considered.
+ */
+ int getAccumRedBits();
+
+ /**
+ * Returns the number of bits requested for the depth buffer.
+ */
+ int getDepthBits();
+
+ /**
+ * Indicates whether double-buffering is enabled.
+ */
+ boolean getDoubleBuffered();
+
+ /**
+ * Returns the GL profile you desire or used by the drawable.
+ */
+ GLProfile getGLProfile();
+
+ /**
+ * Indicates whether hardware acceleration is enabled.
+ */
+ boolean getHardwareAccelerated();
+
+ /**
+ * Returns the number of sample buffers to be allocated if sample
+ * buffers are enabled. Defaults to 2.
+ */
+ int getNumSamples();
+
+ /**
+ * For pbuffers only, returns whether floating-point buffers should
+ * be used if available. Defaults to false.
+ */
+ boolean getPbufferFloatingPointBuffers();
+
+ /**
+ * For pbuffers only, returns whether the render-to-texture
+ * extension should be used if available. Defaults to false.
+ */
+ boolean getPbufferRenderToTexture();
+
+ /**
+ * For pbuffers only, returns whether the render-to-texture
+ * extension should be used. Defaults to false.
+ */
+ boolean getPbufferRenderToTextureRectangle();
+
+ /**
+ * Returns whether sample buffers for full-scene antialiasing
+ * (FSAA) should be allocated for this drawable. Defaults to
+ * false.
+ */
+ boolean getSampleBuffers();
+
+ /**
+ * Returns the number of bits requested for the stencil buffer.
+ */
+ int getStencilBits();
+
+ /**
+ * Indicates whether stereo is enabled.
+ */
+ boolean getStereo();
+
+ /**
+ * Indicates whether pbuffer is used/requested.
+ */
+ boolean isPBuffer();
+
+ Object cloneMutable();
+
+ boolean equals(Object obj);
+
+ int hashCode();
+
+ String toString();
+}
diff --git a/src/jogl/classes/javax/media/opengl/GLDrawable.java b/src/jogl/classes/javax/media/opengl/GLDrawable.java
index e4861edd2..f4cd77059 100644
--- a/src/jogl/classes/javax/media/opengl/GLDrawable.java
+++ b/src/jogl/classes/javax/media/opengl/GLDrawable.java
@@ -40,7 +40,9 @@
package javax.media.opengl;
-import javax.media.nativewindow.*;
+import javax.media.nativewindow.AbstractGraphicsConfiguration;
+import javax.media.nativewindow.NativeSurface;
+
/** An abstraction for an OpenGL rendering target. A GLDrawable's
primary functionality is to create OpenGL contexts which can be
@@ -139,7 +141,7 @@ public interface GLDrawable {
automatically and should not be called by the end user. */
public void swapBuffers() throws GLException;
- /** Fetches the {@link GLCapabilities} corresponding to the chosen
+ /** Fetches the {@link GLCapabilitiesImmutable} corresponding to the chosen
OpenGL capabilities (pixel format / visual / GLProfile) for this drawable.<br>
On some platforms, the pixel format is not directly associated
with the drawable; a best attempt is made to return a reasonable
@@ -149,7 +151,7 @@ public interface GLDrawable {
they should reflect those as well.
@return A copy of the queried object.
*/
- public GLCapabilities getChosenGLCapabilities();
+ public GLCapabilitiesImmutable getChosenGLCapabilities();
/** Fetches the {@link GLProfile} for this drawable.
Returns the GLProfile object, no copy.
diff --git a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
index ab23e18f8..fd6aa7859 100644
--- a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
+++ b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
@@ -329,7 +329,7 @@ public abstract class GLDrawableFactory {
* @throws GLException if any window system-specific errors caused
* the creation of the Offscreen to fail.
*/
- public abstract GLDrawable createOffscreenDrawable(GLCapabilities capabilities,
+ public abstract GLDrawable createOffscreenDrawable(GLCapabilitiesImmutable capabilities,
GLCapabilitiesChooser chooser,
int width, int height)
throws GLException;
@@ -347,7 +347,7 @@ public abstract class GLDrawableFactory {
* @throws GLException if any window system-specific errors caused
* the creation of the GLPbuffer to fail.
*/
- public abstract GLDrawable createGLPbufferDrawable(GLCapabilities capabilities,
+ public abstract GLDrawable createGLPbufferDrawable(GLCapabilitiesImmutable capabilities,
GLCapabilitiesChooser chooser,
int initialWidth,
int initialHeight)
@@ -362,7 +362,7 @@ public abstract class GLDrawableFactory {
* @throws GLException if any window system-specific errors caused
* the creation of the GLPbuffer to fail.
*/
- public abstract GLPbuffer createGLPbuffer(GLCapabilities capabilities,
+ public abstract GLPbuffer createGLPbuffer(GLCapabilitiesImmutable capabilities,
GLCapabilitiesChooser chooser,
int initialWidth,
int initialHeight,
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
index 292bfba7c..dba041f8d 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
+++ b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
@@ -41,7 +41,6 @@
package javax.media.opengl.awt;
import com.jogamp.common.GlueGenVersion;
-import com.jogamp.common.util.VersionUtil;
import com.jogamp.nativewindow.NativeWindowVersion;
import javax.media.opengl.*;
import javax.media.nativewindow.*;
@@ -95,7 +94,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable {
private boolean sendReshape = false;
// copy of the cstr args ..
- private GLCapabilities capabilities;
+ private GLCapabilitiesImmutable capabilities;
private GLCapabilitiesChooser chooser;
private GLContext shareWith;
private GraphicsDevice device;
@@ -110,8 +109,8 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable {
/** Creates a new GLCanvas component with the requested set of
OpenGL capabilities, using the default OpenGL capabilities
selection mechanism, on the default screen device. */
- public GLCanvas(GLCapabilities capabilities) {
- this(capabilities, null, null, null);
+ public GLCanvas(GLCapabilitiesImmutable capsReqUser) {
+ this(capsReqUser, null, null, null);
}
/** Creates a new GLCanvas component. The passed GLCapabilities
@@ -129,7 +128,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable {
which to create the GLCanvas; the GLDrawableFactory uses the
default screen device of the local GraphicsEnvironment if null
is passed for this argument. */
- public GLCanvas(GLCapabilities capabilities,
+ public GLCanvas(GLCapabilitiesImmutable capsReqUser,
GLCapabilitiesChooser chooser,
GLContext shareWith,
GraphicsDevice device) {
@@ -141,12 +140,14 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable {
*/
super();
- if(null==capabilities) {
+ if(null==capsReqUser) {
capabilities = new GLCapabilities(defaultGLProfile);
+ } else {
+ // don't allow the user to change data
+ capabilities = (GLCapabilitiesImmutable) capsReqUser.cloneMutable();
}
glProfile = capabilities.getGLProfile();
- this.capabilities = capabilities;
this.chooser = chooser;
this.shareWith=shareWith;
this.device = device;
@@ -231,7 +232,9 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable {
* block, both devices should have the same visual list, and the
* same configuration should be selected here.
*/
- AWTGraphicsConfiguration config = chooseGraphicsConfiguration((GLCapabilities)awtConfig.getRequestedCapabilities(), chooser, gc.getDevice());
+ AWTGraphicsConfiguration config = chooseGraphicsConfiguration( (GLCapabilitiesImmutable)awtConfig.getChosenCapabilities(),
+ (GLCapabilitiesImmutable)awtConfig.getRequestedCapabilities(),
+ chooser, gc.getDevice());
final GraphicsConfiguration compatible = (null!=config)?config.getGraphicsConfiguration():null;
boolean equalCaps = config.getChosenCapabilities().equals(awtConfig.getChosenCapabilities());
if(DEBUG) {
@@ -429,7 +432,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable {
*/
NativeWindowFactory.getDefaultToolkitLock().lock();
try {
- awtConfig = chooseGraphicsConfiguration(capabilities, chooser, device);
+ awtConfig = chooseGraphicsConfiguration(capabilities, capabilities, chooser, device);
if(DEBUG) {
System.err.println(Thread.currentThread().getName()+" - Created Config: "+awtConfig);
}
@@ -578,20 +581,20 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable {
return glProfile;
}
- public GLCapabilities getChosenGLCapabilities() {
+ public GLCapabilitiesImmutable getChosenGLCapabilities() {
if (awtConfig == null) {
throw new GLException("No AWTGraphicsConfiguration: "+this);
}
- return (GLCapabilities)awtConfig.getChosenCapabilities();
+ return (GLCapabilitiesImmutable)awtConfig.getChosenCapabilities();
}
- public GLCapabilities getRequestedGLCapabilities() {
+ public GLCapabilitiesImmutable getRequestedGLCapabilities() {
if (awtConfig == null) {
throw new GLException("No AWTGraphicsConfiguration: "+this);
}
- return (GLCapabilities)awtConfig.getRequestedCapabilities();
+ return (GLCapabilitiesImmutable)awtConfig.getRequestedCapabilities();
}
public NativeSurface getNativeSurface() {
@@ -771,7 +774,8 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable {
}
}
- private static AWTGraphicsConfiguration chooseGraphicsConfiguration(GLCapabilities capabilities,
+ private static AWTGraphicsConfiguration chooseGraphicsConfiguration(GLCapabilitiesImmutable capsChosen,
+ GLCapabilitiesImmutable capsRequested,
GLCapabilitiesChooser chooser,
GraphicsDevice device) {
// Make GLCanvas behave better in NetBeans GUI builder
@@ -781,9 +785,9 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable {
AbstractGraphicsScreen aScreen = AWTGraphicsScreen.createScreenDevice(device, AbstractGraphicsDevice.DEFAULT_UNIT);
AWTGraphicsConfiguration config = (AWTGraphicsConfiguration)
- GraphicsConfigurationFactory.getFactory(AWTGraphicsDevice.class).chooseGraphicsConfiguration(capabilities,
- chooser,
- aScreen);
+ GraphicsConfigurationFactory.getFactory(AWTGraphicsDevice.class).chooseGraphicsConfiguration(capsChosen,
+ capsRequested,
+ chooser, aScreen);
if (config == null) {
throw new GLException("Error: Couldn't fetch AWTGraphicsConfiguration");
}
@@ -799,7 +803,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable {
System.err.println(NativeWindowVersion.getInstance());
System.err.print(JoglVersion.getInstance());
- GLCapabilities caps = new GLCapabilities( GLProfile.getDefault(GLProfile.getDefaultDesktopDevice()) );
+ GLCapabilitiesImmutable caps = new GLCapabilities( GLProfile.getDefault(GLProfile.getDefaultDesktopDevice()) );
Frame frame = new Frame("JOGL AWT Test");
GLCanvas glCanvas = new GLCanvas(caps);
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
index 955e51e69..0f724d558 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
+++ b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
@@ -91,7 +91,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable {
private volatile boolean isInitialized;
// Data used for either pbuffers or pixmap-based offscreen surfaces
- private GLCapabilities offscreenCaps;
+ private GLCapabilitiesImmutable offscreenCaps;
private GLProfile glProfile;
private GLDrawableFactoryImpl factory;
private GLCapabilitiesChooser chooser;
@@ -158,8 +158,8 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable {
/** Creates a new GLJPanel component with the requested set of
OpenGL capabilities, using the default OpenGL capabilities
selection mechanism. */
- public GLJPanel(GLCapabilities capabilities) {
- this(capabilities, null, null);
+ public GLJPanel(GLCapabilitiesImmutable userCapsRequest) {
+ this(userCapsRequest, null, null);
}
/** Creates a new GLJPanel component. The passed GLCapabilities
@@ -176,17 +176,21 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable {
Note: Sharing cannot be enabled using J2D OpenGL FBO sharing,
since J2D GL Context must be shared and we can only share one context.
*/
- public GLJPanel(GLCapabilities capabilities, GLCapabilitiesChooser chooser, GLContext shareWith) {
+ public GLJPanel(GLCapabilitiesImmutable userCapsRequest, GLCapabilitiesChooser chooser, GLContext shareWith) {
super();
// Works around problems on many vendors' cards; we don't need a
// back buffer for the offscreen surface anyway
- if (capabilities != null) {
- offscreenCaps = (GLCapabilities) capabilities.clone();
- } else {
- offscreenCaps = new GLCapabilities(null);
+ {
+ GLCapabilities caps;
+ if (userCapsRequest != null) {
+ caps = (GLCapabilities) userCapsRequest.cloneMutable();
+ } else {
+ caps = new GLCapabilities(null);
+ }
+ caps.setDoubleBuffered(false);
+ offscreenCaps = caps;
}
- offscreenCaps.setDoubleBuffered(false);
this.glProfile = offscreenCaps.getGLProfile();
this.factory = GLDrawableFactoryImpl.getFactoryImpl(glProfile);
this.chooser = ((chooser != null) ? chooser : new DefaultGLCapabilitiesChooser());
@@ -485,7 +489,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable {
return oglPipelineEnabled;
}
- public GLCapabilities getChosenGLCapabilities() {
+ public GLCapabilitiesImmutable getChosenGLCapabilities() {
return backend.getChosenGLCapabilities();
}
@@ -748,7 +752,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable {
public GLDrawable getDrawable();
// Called to fetch the "real" GLCapabilities for the backend
- public GLCapabilities getChosenGLCapabilities();
+ public GLCapabilitiesImmutable getChosenGLCapabilities();
// Called to fetch the "real" GLProfile for the backend
public GLProfile getGLProfile();
@@ -992,7 +996,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable {
return offscreenDrawable;
}
- public GLCapabilities getChosenGLCapabilities() {
+ public GLCapabilitiesImmutable getChosenGLCapabilities() {
if (offscreenDrawable == null) {
return null;
}
@@ -1090,7 +1094,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable {
return pbuffer;
}
- public GLCapabilities getChosenGLCapabilities() {
+ public GLCapabilitiesImmutable getChosenGLCapabilities() {
if (pbuffer == null) {
return null;
}
@@ -1268,7 +1272,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable {
return joglDrawable;
}
- public GLCapabilities getChosenGLCapabilities() {
+ public GLCapabilitiesImmutable getChosenGLCapabilities() {
// FIXME: should do better than this; is it possible to using only platform-independent code?
return new GLCapabilities(null);
}