diff options
author | Kenneth Russel <[email protected]> | 2008-12-12 02:04:47 +0000 |
---|---|---|
committer | Kenneth Russel <[email protected]> | 2008-12-12 02:04:47 +0000 |
commit | ea9e7fdda3b3142682029e746ddf8cf44aeed812 (patch) | |
tree | 7f31847de07e3e945410e79a5463d2d2686c5b5e /src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLDrawable.java | |
parent | 98df81306243ff09b0a60229c34381c04b86a02f (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/com/sun/opengl/impl/macosx/cgl/MacOSXCGLDrawable.java')
-rw-r--r-- | src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLDrawable.java | 34 |
1 files changed, 21 insertions, 13 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 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(); } |