aboutsummaryrefslogtreecommitdiffstats
path: root/src/classes/com/sun/opengl/impl/macosx
diff options
context:
space:
mode:
Diffstat (limited to 'src/classes/com/sun/opengl/impl/macosx')
-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
4 files changed, 28 insertions, 20 deletions
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 {