aboutsummaryrefslogtreecommitdiffstats
path: root/src/classes/com/sun/opengl/impl/macosx
diff options
context:
space:
mode:
authorKenneth Russel <[email protected]>2008-12-12 23:48:49 +0000
committerKenneth Russel <[email protected]>2008-12-12 23:48:49 +0000
commitbc7dc7d61ba7eac6c943de12efb5460d4becdc77 (patch)
tree94bb80c7632525df1ce19ebe5c2d3dcd7fbc4c2e /src/classes/com/sun/opengl/impl/macosx
parentea9e7fdda3b3142682029e746ddf8cf44aeed812 (diff)
Fixed bug in pbuffer support on Mac OS X due to confusion about what
the native window's surface handle contains. Fixed bug in computation of chosen GLCapabilities on Mac OS X. git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JOGL_2_SANDBOX@1816 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/classes/com/sun/opengl/impl/macosx')
-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();
}