diff options
author | Gerard Ziemski <[email protected]> | 2006-02-15 01:36:08 +0000 |
---|---|---|
committer | Gerard Ziemski <[email protected]> | 2006-02-15 01:36:08 +0000 |
commit | bceb098ac0a594198301b35df7f0b14f532501e6 (patch) | |
tree | d62b1c0e86cc2a1340a5af04cf55bf8fcc6b9910 /src/classes/com | |
parent | 29d159cf5fc3351d49387835296f03cdb2c94734 (diff) |
expose JOGL built-in gl pixel format to users
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@610 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/classes/com')
-rw-r--r-- | src/classes/com/sun/opengl/impl/macosx/MacOSXGLDrawable.java | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/classes/com/sun/opengl/impl/macosx/MacOSXGLDrawable.java b/src/classes/com/sun/opengl/impl/macosx/MacOSXGLDrawable.java index aad5390d7..16f2410de 100644 --- a/src/classes/com/sun/opengl/impl/macosx/MacOSXGLDrawable.java +++ b/src/classes/com/sun/opengl/impl/macosx/MacOSXGLDrawable.java @@ -48,12 +48,12 @@ public abstract class MacOSXGLDrawable extends GLDrawableImpl { protected long nsView; // NSView protected GLCapabilities capabilities; protected GLCapabilitiesChooser chooser; - + public MacOSXGLDrawable(GLCapabilities capabilities, GLCapabilitiesChooser chooser) { this.capabilities = (GLCapabilities) capabilities.clone(); this.chooser = chooser; - } + } public void setRealized(boolean val) { throw new GLException("Should not call this (should only be called for onscreen GLDrawables)"); @@ -67,10 +67,27 @@ public abstract class MacOSXGLDrawable extends GLDrawableImpl { } public GLCapabilities getCapabilities() { - return capabilities; + int numFormats = 1; + GLCapabilities availableCaps[] = new GLCapabilities[numFormats]; + availableCaps[0] = capabilities; + int pixelFormat = chooser.chooseCapabilities(capabilities, 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]; } public long getView() { return nsView; } + + protected static String getThreadName() { + return Thread.currentThread().getName(); + } } |