aboutsummaryrefslogtreecommitdiffstats
path: root/src/classes
diff options
context:
space:
mode:
authorKenneth Russel <[email protected]>2008-12-12 02:04:47 +0000
committerKenneth Russel <[email protected]>2008-12-12 02:04:47 +0000
commitea9e7fdda3b3142682029e746ddf8cf44aeed812 (patch)
tree7f31847de07e3e945410e79a5463d2d2686c5b5e /src/classes
parent98df81306243ff09b0a60229c34381c04b86a02f (diff)
Fixed breakage of GLJPanel caused by confusion between requested and
chosen GLCapabilities. Separated these out and refactored requested GLCapabilities into GLDrawableImpl superclass. Removed setChosenGLCapabilities from the public API and made it protected on GLDrawableImpl. Removed it from all public GLDrawable implementations such as GLCanvas and GLJPanel. Fixed bug in Gears demo where mouse listener was not being hooked up correctly. Tested so far on Windows; testing on other platforms to follow. git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JOGL_2_SANDBOX@1815 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/classes')
-rw-r--r--src/classes/com/sun/javafx/newt/GLWindow.java4
-rw-r--r--src/classes/com/sun/opengl/impl/GLContextImpl.java2
-rw-r--r--src/classes/com/sun/opengl/impl/GLDrawableImpl.java15
-rw-r--r--src/classes/com/sun/opengl/impl/GLPbufferImpl.java12
-rwxr-xr-xsrc/classes/com/sun/opengl/impl/egl/EGLDrawable.java6
-rw-r--r--src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLContext.java2
-rw-r--r--src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLDrawable.java34
-rw-r--r--src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java8
-rw-r--r--src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java4
-rw-r--r--src/classes/com/sun/opengl/impl/windows/wgl/WindowsOffscreenWGLDrawable.java8
-rw-r--r--src/classes/com/sun/opengl/impl/windows/wgl/WindowsPbufferWGLContext.java2
-rw-r--r--src/classes/com/sun/opengl/impl/windows/wgl/WindowsPbufferWGLDrawable.java27
-rw-r--r--src/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLDrawable.java7
-rw-r--r--src/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawable.java8
-rw-r--r--src/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawableFactory.java4
-rw-r--r--src/classes/com/sun/opengl/impl/x11/glx/X11OffscreenGLXDrawable.java6
-rw-r--r--src/classes/com/sun/opengl/impl/x11/glx/X11OnscreenGLXDrawable.java4
-rw-r--r--src/classes/com/sun/opengl/impl/x11/glx/X11PbufferGLXDrawable.java25
-rw-r--r--src/classes/javax/media/opengl/GLDrawable.java5
-rw-r--r--src/classes/javax/media/opengl/awt/GLCanvas.java4
-rw-r--r--src/classes/javax/media/opengl/awt/gl2/GL2JPanel.java14
21 files changed, 92 insertions, 109 deletions
diff --git a/src/classes/com/sun/javafx/newt/GLWindow.java b/src/classes/com/sun/javafx/newt/GLWindow.java
index 10e1f1db5..b48d64ed2 100644
--- a/src/classes/com/sun/javafx/newt/GLWindow.java
+++ b/src/classes/com/sun/javafx/newt/GLWindow.java
@@ -473,10 +473,6 @@ public class GLWindow extends Window implements GLAutoDrawable {
return drawable.getChosenGLCapabilities();
}
- public void setChosenGLCapabilities(GLCapabilities caps) {
- drawable.setChosenGLCapabilities(caps);
- }
-
public NativeWindow getNativeWindow() {
return drawable.getNativeWindow();
}
diff --git a/src/classes/com/sun/opengl/impl/GLContextImpl.java b/src/classes/com/sun/opengl/impl/GLContextImpl.java
index 55ad32425..94b35bd89 100644
--- a/src/classes/com/sun/opengl/impl/GLContextImpl.java
+++ b/src/classes/com/sun/opengl/impl/GLContextImpl.java
@@ -378,7 +378,7 @@ public abstract class GLContextImpl extends GLContext {
* "GL_VERTEX_PROGRAM_ARB").
*/
public boolean isExtensionAvailable(String glExtensionName) {
- return extensionAvailability.isExtensionAvailable(glExtensionName);
+ return extensionAvailability.isExtensionAvailable(mapToRealGLExtensionName(glExtensionName));
}
/** Indicates which floating-point pbuffer implementation is in
diff --git a/src/classes/com/sun/opengl/impl/GLDrawableImpl.java b/src/classes/com/sun/opengl/impl/GLDrawableImpl.java
index 3053a91de..78b863a79 100644
--- a/src/classes/com/sun/opengl/impl/GLDrawableImpl.java
+++ b/src/classes/com/sun/opengl/impl/GLDrawableImpl.java
@@ -42,11 +42,16 @@ package com.sun.opengl.impl;
import javax.media.opengl.*;
public abstract class GLDrawableImpl implements GLDrawable {
- protected GLDrawableImpl(GLDrawableFactory factory, NativeWindow comp, boolean realized) {
+ private GLCapabilities requestedCapabilities;
+
+ protected GLDrawableImpl(GLDrawableFactory factory,
+ NativeWindow comp,
+ GLCapabilities requestedCapabilities,
+ boolean realized) {
this.factory = factory;
this.component = comp;
+ this.requestedCapabilities = (GLCapabilities) requestedCapabilities.clone();
this.realized = realized;
- this.chosenCapabilities=null;
}
/** For offscreen GLDrawables (pbuffers and "pixmap" drawables),
@@ -62,8 +67,8 @@ public abstract class GLDrawableImpl implements GLDrawable {
return GLContextImpl.toHexString(hex);
}
- public GLCapabilities getCapabilities() {
- return chosenCapabilities;
+ protected GLCapabilities getRequestedGLCapabilities() {
+ return requestedCapabilities;
}
public GLCapabilities getChosenGLCapabilities() {
@@ -74,7 +79,7 @@ public abstract class GLDrawableImpl implements GLDrawable {
return (GLCapabilities) chosenCapabilities.clone();
}
- public void setChosenGLCapabilities(GLCapabilities caps) {
+ protected void setChosenGLCapabilities(GLCapabilities caps) {
chosenCapabilities = (caps==null) ? null : (GLCapabilities) caps.clone();
}
diff --git a/src/classes/com/sun/opengl/impl/GLPbufferImpl.java b/src/classes/com/sun/opengl/impl/GLPbufferImpl.java
index 9589cc735..74fc0fe1a 100644
--- a/src/classes/com/sun/opengl/impl/GLPbufferImpl.java
+++ b/src/classes/com/sun/opengl/impl/GLPbufferImpl.java
@@ -159,18 +159,6 @@ public class GLPbufferImpl implements GLPbuffer {
return pbufferDrawable.getChosenGLCapabilities();
}
- public GLCapabilities getCapabilities() {
- if (pbufferDrawable == null)
- return null;
-
- return pbufferDrawable.getCapabilities();
- }
-
- public void setChosenGLCapabilities(GLCapabilities caps) {
- pbufferDrawable.setChosenGLCapabilities(caps);
- }
-
-
private boolean surfaceLocked = false;
public int lockSurface() throws GLException {
diff --git a/src/classes/com/sun/opengl/impl/egl/EGLDrawable.java b/src/classes/com/sun/opengl/impl/egl/EGLDrawable.java
index fd0405a69..5915e5cd3 100755
--- a/src/classes/com/sun/opengl/impl/egl/EGLDrawable.java
+++ b/src/classes/com/sun/opengl/impl/egl/EGLDrawable.java
@@ -49,9 +49,9 @@ public class EGLDrawable extends GLDrawableImpl {
public EGLDrawable(EGLDrawableFactory factory,
NativeWindow component,
- GLCapabilities capabilities,
+ GLCapabilities requestedCapabilities,
GLCapabilitiesChooser chooser) throws GLException {
- super(factory, component, false);
+ super(factory, component, requestedCapabilities, false);
this.chooser = chooser;
surface=EGL.EGL_NO_SURFACE;
display=0;
@@ -80,7 +80,7 @@ public class EGLDrawable extends GLDrawableImpl {
if (!EGL.eglInitialize(display, null, null)) {
throw new GLException("eglInitialize failed");
}
- config = new EGLConfig(display, capabilities);
+ config = new EGLConfig(display, requestedCapabilities);
}
setChosenGLCapabilities(config.getCapabilities());
}
diff --git a/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLContext.java b/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLContext.java
index 4959c308f..13629945e 100644
--- a/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLContext.java
+++ b/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLContext.java
@@ -110,7 +110,7 @@ public abstract class MacOSXCGLContext extends GLContextImpl
}
}
int[] viewNotReady = new int[1];
- GLCapabilities capabilities = drawable.getCapabilities();
+ GLCapabilities capabilities = drawable.getRequestedGLCapabilities();
int[] iattribs = new int[128];
int[] ivalues = new int[128];
int idx = 0;
diff --git a/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLDrawable.java b/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLDrawable.java
index c52b46c7b..01bdb80fb 100644
--- a/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLDrawable.java
+++ b/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLDrawable.java
@@ -81,29 +81,37 @@ public abstract class MacOSXCGLDrawable extends GLDrawableImpl {
public static final int CGL_MODE = 2;
public MacOSXCGLDrawable(GLDrawableFactory factory, NativeWindow comp, boolean realized,
- GLCapabilities capabilities, GLCapabilitiesChooser chooser) {
- super(factory, comp, realized);
- setChosenGLCapabilities(capabilities);
+ GLCapabilities requestedCapabilities, GLCapabilitiesChooser chooser) {
+ super(factory, comp, requestedCapabilities, realized);
this.chooser = chooser;
}
public GLCapabilities getChosenGLCapabilities() {
- int numFormats = 1;
- GLCapabilities availableCaps[] = new GLCapabilities[numFormats];
- availableCaps[0] = super.getChosenGLCapabilities();
- int pixelFormat = chooser.chooseCapabilities(getCapabilities(), availableCaps, 0);
- if ((pixelFormat < 0) || (pixelFormat >= numFormats)) {
+ int numFormats = 1;
+ GLCapabilities availableCaps[] = new GLCapabilities[numFormats];
+ availableCaps[0] = super.getChosenGLCapabilities();
+ int pixelFormat = chooser.chooseCapabilities(getRequestedGLCapabilities(), availableCaps, 0);
+ if ((pixelFormat < 0) || (pixelFormat >= numFormats)) {
throw new GLException("Invalid result " + pixelFormat +
- " from GLCapabilitiesChooser (should be between 0 and " +
- (numFormats - 1) + ")");
- }
- if (DEBUG) {
+ " from GLCapabilitiesChooser (should be between 0 and " +
+ (numFormats - 1) + ")");
+ }
+ if (DEBUG) {
System.err.println(getThreadName() + ": Chosen pixel format (" + pixelFormat + "):");
System.err.println(availableCaps[pixelFormat]);
- }
+ }
return availableCaps[pixelFormat];
}
+ // These are public to allow access from a couple of context implementations
+ public void setChosenGLCapabilities(GLCapabilities caps) {
+ super.setChosenGLCapabilities(caps);
+ }
+
+ public GLCapabilities getRequestedGLCapabilities() {
+ return super.getRequestedGLCapabilities();
+ }
+
protected static String getThreadName() {
return Thread.currentThread().getName();
}
diff --git a/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java b/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java
index bdde0c887..b128cfcbe 100644
--- a/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java
+++ b/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java
@@ -80,7 +80,7 @@ public class MacOSXPbufferCGLContext extends MacOSXCGLContext {
// Initialize render-to-texture support if requested
GL gl = getGL();
- boolean rect = gl.isGL2() && drawable.getCapabilities().getPbufferRenderToTextureRectangle();
+ boolean rect = gl.isGL2() && drawable.getRequestedGLCapabilities().getPbufferRenderToTextureRectangle();
if (rect) {
if (!gl.isExtensionAvailable("GL_EXT_texture_rectangle")) {
System.err.println("MacOSXPbufferCGLContext: WARNING: GL_EXT_texture_rectangle extension not " +
@@ -135,7 +135,7 @@ public class MacOSXPbufferCGLContext extends MacOSXCGLContext {
}
protected boolean create() {
- GLCapabilities capabilities = drawable.getCapabilities();
+ GLCapabilities capabilities = drawable.getRequestedGLCapabilities();
if (capabilities.getPbufferFloatingPointBuffers() &&
!isTigerOrLater) {
throw new GLException("Floating-point pbuffers supported only on OS X 10.4 or later");
@@ -210,7 +210,7 @@ public class MacOSXPbufferCGLContext extends MacOSXCGLContext {
// NSOpenGLContext-based implementation
class NSOpenGLImpl implements Impl {
public long create() {
- GLCapabilities capabilities = drawable.getCapabilities();
+ GLCapabilities capabilities = drawable.getRequestedGLCapabilities();
if (capabilities.getPbufferFloatingPointBuffers() &&
!isTigerOrLater) {
throw new GLException("Floating-point pbuffers supported only on OS X 10.4 or later");
@@ -265,7 +265,7 @@ public class MacOSXPbufferCGLContext extends MacOSXCGLContext {
int[] attrs = new int[256];
int i = 0;
attrs[i++] = CGL.kCGLPFAPBuffer;
- GLCapabilities capabilities = drawable.getCapabilities();
+ GLCapabilities capabilities = drawable.getRequestedGLCapabilities();
if (capabilities.getPbufferFloatingPointBuffers())
attrs[i++] = CGL.kCGLPFAColorFloat;
if (capabilities.getDoubleBuffered())
diff --git a/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java b/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java
index 9216e3e17..e114a103c 100644
--- a/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java
+++ b/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java
@@ -94,12 +94,12 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable {
// FIXME: do we need to do anything if the pbuffer is double-buffered?
}
- protected void createPbuffer() {
+ private void createPbuffer() {
NullWindow nw = (NullWindow) getNativeWindow();
getFactory().lockToolkit();
try {
int renderTarget;
- GLCapabilities capabilities = getCapabilities();
+ GLCapabilities capabilities = getRequestedGLCapabilities();
if (GLProfile.isGL2() && capabilities.getPbufferRenderToTextureRectangle()) {
renderTarget = GL2.GL_TEXTURE_RECTANGLE;
} else {
diff --git a/src/classes/com/sun/opengl/impl/windows/wgl/WindowsOffscreenWGLDrawable.java b/src/classes/com/sun/opengl/impl/windows/wgl/WindowsOffscreenWGLDrawable.java
index 59eff795b..000278070 100644
--- a/src/classes/com/sun/opengl/impl/windows/wgl/WindowsOffscreenWGLDrawable.java
+++ b/src/classes/com/sun/opengl/impl/windows/wgl/WindowsOffscreenWGLDrawable.java
@@ -47,9 +47,9 @@ public class WindowsOffscreenWGLDrawable extends WindowsWGLDrawable {
private long hbitmap;
public WindowsOffscreenWGLDrawable(GLDrawableFactory factory,
- GLCapabilities capabilities,
- GLCapabilitiesChooser chooser) {
- super(factory, new NullWindow(), true, capabilities, chooser);
+ GLCapabilities requestedCapabilities,
+ GLCapabilitiesChooser chooser) {
+ super(factory, new NullWindow(), true, requestedCapabilities, chooser);
}
public GLContext createContext(GLContext shareWith) {
@@ -66,7 +66,7 @@ public class WindowsOffscreenWGLDrawable extends WindowsWGLDrawable {
getFactory().lockToolkit();
try {
NullWindow nw = (NullWindow) getNativeWindow();
- GLCapabilities capabilities = getCapabilities();
+ GLCapabilities capabilities = getRequestedGLCapabilities();
int width = getWidth();
int height = getHeight();
BITMAPINFO info = BITMAPINFO.create();
diff --git a/src/classes/com/sun/opengl/impl/windows/wgl/WindowsPbufferWGLContext.java b/src/classes/com/sun/opengl/impl/windows/wgl/WindowsPbufferWGLContext.java
index 429f67abd..ac3a5d5c8 100644
--- a/src/classes/com/sun/opengl/impl/windows/wgl/WindowsPbufferWGLContext.java
+++ b/src/classes/com/sun/opengl/impl/windows/wgl/WindowsPbufferWGLContext.java
@@ -96,7 +96,7 @@ public class WindowsPbufferWGLContext extends WindowsWGLContext {
System.err.println("WindowsPbufferWGLContext: super.makeCurrentImpl() = " + res);
}
if (res == CONTEXT_CURRENT_NEW) {
- GLCapabilities capabilities = drawable.getCapabilities();
+ GLCapabilities capabilities = drawable.getRequestedGLCapabilities();
// Initialize render-to-texture support if requested
GL gl = getGL();
diff --git a/src/classes/com/sun/opengl/impl/windows/wgl/WindowsPbufferWGLDrawable.java b/src/classes/com/sun/opengl/impl/windows/wgl/WindowsPbufferWGLDrawable.java
index cda810d86..c7d71be0d 100644
--- a/src/classes/com/sun/opengl/impl/windows/wgl/WindowsPbufferWGLDrawable.java
+++ b/src/classes/com/sun/opengl/impl/windows/wgl/WindowsPbufferWGLDrawable.java
@@ -51,12 +51,12 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable {
private int floatMode;
public WindowsPbufferWGLDrawable(GLDrawableFactory factory,
- GLCapabilities capabilities,
- int initialWidth,
- int initialHeight,
- WindowsWGLDrawable dummyDrawable,
- WGLExt wglExt) {
- super(factory, new NullWindow(), true, capabilities, null);
+ GLCapabilities requestedCapabilities,
+ int initialWidth,
+ int initialHeight,
+ WindowsWGLDrawable dummyDrawable,
+ WGLExt wglExt) {
+ super(factory, new NullWindow(), true, requestedCapabilities, null);
if (initialWidth <= 0 || initialHeight <= 0) {
throw new GLException("Initial width and height of pbuffer must be positive (were (" +
initialWidth + ", " + initialHeight + "))");
@@ -65,10 +65,10 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable {
nw.setSize(initialWidth, initialHeight);
if (DEBUG) {
- System.out.println("Pbuffer caps on init: " + capabilities +
- (capabilities.getPbufferRenderToTexture() ? " [rtt]" : "") +
- (capabilities.getPbufferRenderToTextureRectangle() ? " [rect]" : "") +
- (capabilities.getPbufferFloatingPointBuffers() ? " [float]" : ""));
+ System.out.println("Pbuffer caps on init: " + requestedCapabilities +
+ (requestedCapabilities.getPbufferRenderToTexture() ? " [rtt]" : "") +
+ (requestedCapabilities.getPbufferRenderToTextureRectangle() ? " [rect]" : "") +
+ (requestedCapabilities.getPbufferFloatingPointBuffers() ? " [float]" : ""));
}
createPbuffer(dummyDrawable.getNativeWindow().getSurfaceHandle(), wglExt);
@@ -137,6 +137,11 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable {
*/
}
+ // This is public to allow access from PbufferContext
+ public GLCapabilities getRequestedGLCapabilities() {
+ return super.getRequestedGLCapabilities();
+ }
+
private void createPbuffer(long parentHdc, WGLExt wglExt) {
int[] iattributes = new int [2*MAX_ATTRIBS];
float[] fattributes = new float[1];
@@ -144,7 +149,7 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable {
int niattribs = 0;
int width, height;
- GLCapabilities capabilities = getCapabilities();
+ GLCapabilities capabilities = getRequestedGLCapabilities();
if (DEBUG) {
System.out.println("Pbuffer parentHdc = " + toHexString(parentHdc));
diff --git a/src/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLDrawable.java b/src/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLDrawable.java
index 2e6d03e93..c8965e0db 100644
--- a/src/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLDrawable.java
+++ b/src/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLDrawable.java
@@ -56,10 +56,9 @@ public abstract class WindowsWGLDrawable extends GLDrawableImpl {
protected static final int MAX_ATTRIBS = 256;
public WindowsWGLDrawable(GLDrawableFactory factory, NativeWindow comp, boolean realized,
- GLCapabilities capabilities,
+ GLCapabilities requestedCapabilities,
GLCapabilitiesChooser chooser) {
- super(factory, comp, realized);
- setChosenGLCapabilities(capabilities);
+ super(factory, comp, requestedCapabilities, realized);
this.chooser = chooser;
}
@@ -105,7 +104,7 @@ public abstract class WindowsWGLDrawable extends GLDrawableImpl {
PIXELFORMATDESCRIPTOR pfd = null;
int pixelFormat = 0;
GLCapabilities chosenCaps = null;
- GLCapabilities capabilities = getCapabilities();
+ GLCapabilities capabilities = getRequestedGLCapabilities();
long hdc = getNativeWindow().getSurfaceHandle();
if (onscreen) {
if ((pixelFormat = WGL.GetPixelFormat(hdc)) != 0) {
diff --git a/src/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawable.java b/src/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawable.java
index 702ceb7b4..229686428 100644
--- a/src/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawable.java
+++ b/src/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawable.java
@@ -49,10 +49,9 @@ public abstract class X11GLXDrawable extends GLDrawableImpl {
protected GLCapabilitiesChooser chooser;
protected X11GLXDrawable(GLDrawableFactory factory, NativeWindow comp, boolean realized,
- GLCapabilities capabilities,
+ GLCapabilities requestedCapabilities,
GLCapabilitiesChooser chooser) {
- super(factory, comp, realized);
- setChosenGLCapabilities(capabilities);
+ super(factory, comp, requestedCapabilities, realized);
this.chooser = chooser;
}
@@ -89,7 +88,6 @@ public abstract class X11GLXDrawable extends GLDrawableImpl {
System.err.println("!!! Fetched XVisualInfo for visual ID 0x" + Long.toHexString(visualID));
System.err.println("!!! Resulting XVisualInfo: visualid = 0x" + Long.toHexString(infos[0].visualid()));
}
-
// FIXME: the storage for the infos array is leaked (should
// clean it up somehow when we're done with the visual we're
// returning)
@@ -120,7 +118,7 @@ public abstract class X11GLXDrawable extends GLDrawableImpl {
} finally {
getFactory().unlockToolkit();
}
- GLCapabilities capabilities = getCapabilities();
+ GLCapabilities capabilities = getRequestedGLCapabilities();
int chosen = chooser.chooseCapabilities(capabilities, caps, -1);
if (chosen < 0 || chosen >= caps.length) {
throw new GLException("GLCapabilitiesChooser specified invalid index (expected 0.." + (caps.length - 1) + ")");
diff --git a/src/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawableFactory.java b/src/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawableFactory.java
index 008cb9c2b..85e0ecc21 100644
--- a/src/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawableFactory.java
+++ b/src/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawableFactory.java
@@ -176,8 +176,8 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
Runnable r = new Runnable() {
public void run() {
X11PbufferGLXDrawable pbufferDrawable = new X11PbufferGLXDrawable(factory, capabilities,
- initialWidth,
- initialHeight);
+ initialWidth,
+ initialHeight);
GLPbufferImpl pbuffer = new GLPbufferImpl(pbufferDrawable, shareWith);
returnList.add(pbuffer);
}
diff --git a/src/classes/com/sun/opengl/impl/x11/glx/X11OffscreenGLXDrawable.java b/src/classes/com/sun/opengl/impl/x11/glx/X11OffscreenGLXDrawable.java
index 74b2191ab..9289d7c02 100644
--- a/src/classes/com/sun/opengl/impl/x11/glx/X11OffscreenGLXDrawable.java
+++ b/src/classes/com/sun/opengl/impl/x11/glx/X11OffscreenGLXDrawable.java
@@ -48,9 +48,9 @@ public class X11OffscreenGLXDrawable extends X11GLXDrawable {
private boolean isDoubleBuffered;
protected X11OffscreenGLXDrawable(GLDrawableFactory factory,
- GLCapabilities capabilities,
- GLCapabilitiesChooser chooser) {
- super(factory, new NullWindow(), true, capabilities, chooser);
+ GLCapabilities requestedCapabilities,
+ GLCapabilitiesChooser chooser) {
+ super(factory, new NullWindow(), true, requestedCapabilities, chooser);
}
public GLContext createContext(GLContext shareWith) {
diff --git a/src/classes/com/sun/opengl/impl/x11/glx/X11OnscreenGLXDrawable.java b/src/classes/com/sun/opengl/impl/x11/glx/X11OnscreenGLXDrawable.java
index 107eba9d2..bc25594b6 100644
--- a/src/classes/com/sun/opengl/impl/x11/glx/X11OnscreenGLXDrawable.java
+++ b/src/classes/com/sun/opengl/impl/x11/glx/X11OnscreenGLXDrawable.java
@@ -81,4 +81,8 @@ public class X11OnscreenGLXDrawable extends X11GLXDrawable {
}
}
+ // This is public to allow access from the DrawableFactory
+ protected void setChosenGLCapabilities(GLCapabilities caps) {
+ super.setChosenGLCapabilities(caps);
+ }
}
diff --git a/src/classes/com/sun/opengl/impl/x11/glx/X11PbufferGLXDrawable.java b/src/classes/com/sun/opengl/impl/x11/glx/X11PbufferGLXDrawable.java
index 06aeba0b6..36422c994 100644
--- a/src/classes/com/sun/opengl/impl/x11/glx/X11PbufferGLXDrawable.java
+++ b/src/classes/com/sun/opengl/impl/x11/glx/X11PbufferGLXDrawable.java
@@ -52,9 +52,10 @@ public class X11PbufferGLXDrawable extends X11GLXDrawable {
protected static final int MAX_PFORMATS = 256;
protected static final int MAX_ATTRIBS = 256;
- protected X11PbufferGLXDrawable(GLDrawableFactory factory, GLCapabilities capabilities,
+ protected X11PbufferGLXDrawable(GLDrawableFactory factory,
+ GLCapabilities requestedCapabilities,
int initialWidth, int initialHeight) {
- super(factory, new NullWindow(), true, capabilities, null);
+ super(factory, new NullWindow(), true, requestedCapabilities, null);
if (initialWidth <= 0 || initialHeight <= 0) {
throw new GLException("Initial width and height of pbuffer must be positive (were (" +
initialWidth + ", " + initialHeight + "))");
@@ -63,10 +64,10 @@ public class X11PbufferGLXDrawable extends X11GLXDrawable {
nw.setSize(initialWidth, initialHeight);
if (DEBUG) {
- System.out.println("Pbuffer caps on init: " + capabilities +
- (capabilities.getPbufferRenderToTexture() ? " [rtt]" : "") +
- (capabilities.getPbufferRenderToTextureRectangle() ? " [rect]" : "") +
- (capabilities.getPbufferFloatingPointBuffers() ? " [float]" : ""));
+ System.out.println("Pbuffer caps on init: " + requestedCapabilities +
+ (requestedCapabilities.getPbufferRenderToTexture() ? " [rtt]" : "") +
+ (requestedCapabilities.getPbufferRenderToTextureRectangle() ? " [rect]" : "") +
+ (requestedCapabilities.getPbufferFloatingPointBuffers() ? " [float]" : ""));
}
nw.setDisplayHandle(X11GLXDrawableFactory.getDisplayConnection());
@@ -99,7 +100,7 @@ public class X11PbufferGLXDrawable extends X11GLXDrawable {
createPbuffer();
}
- public void createPbuffer() {
+ private void createPbuffer() {
getFactory().lockToolkit();
try {
NullWindow nw = (NullWindow) getNativeWindow();
@@ -110,15 +111,17 @@ public class X11PbufferGLXDrawable extends X11GLXDrawable {
int screen = X11Lib.DefaultScreen(display);
nw.setScreenIndex(screen);
- if (getCapabilities().getPbufferRenderToTexture()) {
+ GLCapabilities capabilities = getRequestedGLCapabilities();
+
+ if (capabilities.getPbufferRenderToTexture()) {
throw new GLException("Render-to-texture pbuffers not supported yet on X11");
}
- if (getCapabilities().getPbufferRenderToTextureRectangle()) {
+ if (capabilities.getPbufferRenderToTextureRectangle()) {
throw new GLException("Render-to-texture-rectangle pbuffers not supported yet on X11");
}
- int[] iattributes = X11GLXDrawableFactory.glCapabilities2AttribList(getCapabilities(),
+ int[] iattributes = X11GLXDrawableFactory.glCapabilities2AttribList(capabilities,
((X11GLXDrawableFactory)getFactory()).isMultisampleAvailable(),
true, display, screen);
@@ -171,7 +174,7 @@ public class X11PbufferGLXDrawable extends X11GLXDrawable {
// Pick innocent query values if multisampling or floating point buffers not available
int sbAttrib = ((X11GLXDrawableFactory)getFactory()).isMultisampleAvailable() ? GLXExt.GLX_SAMPLE_BUFFERS: GLX.GLX_RED_SIZE;
int samplesAttrib = ((X11GLXDrawableFactory)getFactory()).isMultisampleAvailable() ? GLXExt.GLX_SAMPLES: GLX.GLX_RED_SIZE;
- int floatNV = getCapabilities().getPbufferFloatingPointBuffers() ? GLXExt.GLX_FLOAT_COMPONENTS_NV : GLX.GLX_RED_SIZE;
+ int floatNV = capabilities.getPbufferFloatingPointBuffers() ? GLXExt.GLX_FLOAT_COMPONENTS_NV : GLX.GLX_RED_SIZE;
// Query the fbconfig to determine its GLCapabilities
int[] iattribs = {
diff --git a/src/classes/javax/media/opengl/GLDrawable.java b/src/classes/javax/media/opengl/GLDrawable.java
index ec1b5fc2d..f1468c475 100644
--- a/src/classes/javax/media/opengl/GLDrawable.java
+++ b/src/classes/javax/media/opengl/GLDrawable.java
@@ -139,11 +139,6 @@ public interface GLDrawable {
*/
public GLCapabilities getChosenGLCapabilities();
- /**
- * stores a copy of the passed object
- */
- public void setChosenGLCapabilities(GLCapabilities caps);
-
public NativeWindow getNativeWindow();
public GLDrawableFactory getFactory();
diff --git a/src/classes/javax/media/opengl/awt/GLCanvas.java b/src/classes/javax/media/opengl/awt/GLCanvas.java
index bead18bb9..8d4a1df86 100644
--- a/src/classes/javax/media/opengl/awt/GLCanvas.java
+++ b/src/classes/javax/media/opengl/awt/GLCanvas.java
@@ -410,10 +410,6 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable {
return drawable.getChosenGLCapabilities();
}
- public void setChosenGLCapabilities(GLCapabilities caps) {
- drawable.setChosenGLCapabilities(caps);
- }
-
public NativeWindow getNativeWindow() {
return drawable.getNativeWindow();
}
diff --git a/src/classes/javax/media/opengl/awt/gl2/GL2JPanel.java b/src/classes/javax/media/opengl/awt/gl2/GL2JPanel.java
index 5c1932513..69ecb1c99 100644
--- a/src/classes/javax/media/opengl/awt/gl2/GL2JPanel.java
+++ b/src/classes/javax/media/opengl/awt/gl2/GL2JPanel.java
@@ -887,20 +887,6 @@ public class GL2JPanel extends JPanel implements AWTGLAutoDrawable {
return null;
}
- public void setChosenGLCapabilities(GLCapabilities caps) {
- if (oglPipelineEnabled) {
- this.caps = (caps==null) ? null : (GLCapabilities) caps.clone();
- }
-
- if (hardwareAccelerationDisabled) {
- if (offscreenDrawable != null)
- offscreenDrawable.setChosenGLCapabilities(caps);
- } else {
- if (pbuffer != null)
- pbuffer.setChosenGLCapabilities(caps);
- }
- }
-
public NativeWindow getNativeWindow() {
throw new GLException("FIXME");
}