aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLDrawable.java17
-rw-r--r--src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java22
2 files changed, 12 insertions, 27 deletions
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 01bdb80fb..efce08706 100644
--- a/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLDrawable.java
+++ b/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLDrawable.java
@@ -86,23 +86,6 @@ public abstract class MacOSXCGLDrawable extends GLDrawableImpl {
this.chooser = chooser;
}
- public GLCapabilities getChosenGLCapabilities() {
- 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) {
- 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);
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 e114a103c..3444bd57a 100644
--- a/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java
+++ b/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java
@@ -49,6 +49,12 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable {
private int textureTarget; // e.g. GL_TEXTURE_2D, GL_TEXTURE_RECTANGLE_NV
private int texture; // actual texture object
+ // NSOpenGLPbuffer (for normal mode)
+ // CGLPbufferObj (for CGL_MODE situation, i.e., when Java2D/JOGL bridge is active)
+ // Note that we can not store this in the NativeWindow because the
+ // semantic is that contains an NSView
+ protected long pBuffer;
+
public MacOSXPbufferCGLDrawable(GLDrawableFactory factory, GLCapabilities capabilities, int initialWidth, int initialHeight) {
super(factory, new NullWindow(), true, capabilities, null);
NullWindow nw = (NullWindow) getNativeWindow();
@@ -64,14 +70,11 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable {
public void destroy() {
getFactory().lockToolkit();
try {
- NullWindow nw = (NullWindow) getNativeWindow();
-
- if (nw.getSurfaceHandle() != 0) {
- impl.destroy(nw.getSurfaceHandle());
- nw.setSurfaceHandle(0);
-
+ if (this.pBuffer != 0) {
+ impl.destroy(pBuffer);
+ this.pBuffer = 0;
if (DEBUG) {
- System.err.println("Destroyed pbuffer: " + nw);
+ System.err.println("Destroyed pbuffer: " + pBuffer);
}
}
} finally {
@@ -87,7 +90,7 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable {
}
public long getPbuffer() {
- return getNativeWindow().getSurfaceHandle();
+ return pBuffer;
}
public void swapBuffers() throws GLException {
@@ -131,11 +134,10 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable {
}
}
- long pBuffer = impl.create(renderTarget, internalFormat, getWidth(), getHeight());
+ pBuffer = impl.create(renderTarget, internalFormat, getWidth(), getHeight());
if (pBuffer == 0) {
throw new GLException("pbuffer creation error: CGL.createPBuffer() failed");
}
- nw.setSurfaceHandle(pBuffer);
} finally {
getFactory().unlockToolkit();
}