diff options
Diffstat (limited to 'src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl')
9 files changed, 73 insertions, 40 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLContext.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLContext.java index 46b86a557..1bb07cf9c 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLContext.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLContext.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * Copyright (c) 2010 JogAmp Community. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -114,7 +115,7 @@ public abstract class MacOSXCGLContext extends GLContextImpl throw new GLException("GLContextShareSet returned a NULL OpenGL context"); } } - MacOSXCGLGraphicsConfiguration config = (MacOSXCGLGraphicsConfiguration) drawable.getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration(); + MacOSXCGLGraphicsConfiguration config = (MacOSXCGLGraphicsConfiguration) drawable.getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration(); GLCapabilities capabilitiesRequested = (GLCapabilities)config.getRequestedCapabilities(); GLProfile glProfile = capabilitiesRequested.getGLProfile(); if(glProfile.isGL3()) { @@ -242,7 +243,7 @@ public abstract class MacOSXCGLContext extends GLContextImpl } protected void swapBuffers() { - DefaultGraphicsConfiguration config = (DefaultGraphicsConfiguration) drawable.getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration(); + DefaultGraphicsConfiguration config = (DefaultGraphicsConfiguration) drawable.getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration(); GLCapabilities caps = (GLCapabilities)config.getChosenCapabilities(); if(caps.isOnscreen()) { if(isNSContext) { diff --git a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawable.java index 23fdcbf6d..1eeaa55e1 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawable.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawable.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * Copyright (c) 2010 JogAmp Community. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -77,7 +78,7 @@ public abstract class MacOSXCGLDrawable extends GLDrawableImpl { public static final int NSOPENGL_MODE = 1; public static final int CGL_MODE = 2; - public MacOSXCGLDrawable(GLDrawableFactory factory, NativeWindow comp, boolean realized) { + public MacOSXCGLDrawable(GLDrawableFactory factory, NativeSurface comp, boolean realized) { super(factory, comp, realized); } diff --git a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java index 9694e5607..396d6aefc 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * Copyright (c) 2010 JogAmp Community. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -45,7 +46,7 @@ import javax.media.opengl.*; import com.jogamp.common.JogampRuntimeException; import com.jogamp.common.util.*; import com.jogamp.opengl.impl.*; -import com.jogamp.nativewindow.impl.NullWindow; +import com.jogamp.nativewindow.impl.ProxySurface; public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { private static final DesktopGLDynamicLookupHelper macOSXCGLDynamicLookupHelper; @@ -87,14 +88,14 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { protected final GLDrawableImpl getSharedDrawable() { return null; } protected final GLContextImpl getSharedContext() { return null; } - public GLDrawableImpl createOnscreenDrawable(NativeWindow target) { + public GLDrawableImpl createOnscreenDrawable(NativeSurface target) { if (target == null) { throw new IllegalArgumentException("Null target"); } return new MacOSXOnscreenCGLDrawable(this, target); } - protected GLDrawableImpl createOffscreenDrawable(NativeWindow target) { + protected GLDrawableImpl createOffscreenDrawable(NativeSurface target) { return new MacOSXOffscreenCGLDrawable(this, target); } @@ -102,7 +103,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { return true; } - protected GLDrawableImpl createGLPbufferDrawableImpl(final NativeWindow target) { + protected GLDrawableImpl createGLPbufferDrawableImpl(final NativeSurface target) { /** * FIXME: Think about this .. * should not be necessary ? .. @@ -119,11 +120,11 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { return new MacOSXPbufferCGLDrawable(this, target); } - protected NativeWindow createOffscreenWindow(GLCapabilities capabilities, GLCapabilitiesChooser chooser, int width, int height) { + protected NativeSurface createOffscreenSurface(GLCapabilities capabilities, GLCapabilitiesChooser chooser, int width, int height) { AbstractGraphicsScreen screen = DefaultGraphicsScreen.createDefault(); - NullWindow nw = new NullWindow(MacOSXCGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capabilities, chooser, screen, true)); - nw.setSize(width, height); - return nw; + ProxySurface ns = new ProxySurface(MacOSXCGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capabilities, chooser, screen, true)); + ns.setSize(width, height); + return ns; } public GLContext createExternalGLContext() { diff --git a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java index 889d1c333..d2be9d0de 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved. + * Copyright (c) 2010 JogAmp Community. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -148,7 +149,7 @@ public class MacOSXCGLGraphicsConfiguration extends DefaultGraphicsConfiguration // On this platform the pixel format is associated with the // context and not the drawable. However it's a reasonable // approximation to just store the chosen pixel format up in the - // NativeWindow's AbstractGraphicsConfiguration, + // NativeSurface's AbstractGraphicsConfiguration, // since the public API doesn't provide for a different GLCapabilities per context. // Note: These restrictions of the platform's API might be considered as a bug anyways. diff --git a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXExternalCGLContext.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXExternalCGLContext.java index e8518925a..973c67127 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXExternalCGLContext.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXExternalCGLContext.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2005 Sun Microsystems, Inc. All Rights Reserved. + * Copyright (c) 2010 JogAmp Community. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -43,7 +44,7 @@ import javax.media.opengl.*; import com.jogamp.opengl.impl.*; import javax.media.nativewindow.*; -import com.jogamp.nativewindow.impl.NullWindow; +import com.jogamp.nativewindow.impl.ProxySurface; public class MacOSXExternalCGLContext extends MacOSXCGLContext { private boolean firstMakeCurrent = true; @@ -99,9 +100,9 @@ public class MacOSXExternalCGLContext extends MacOSXCGLContext { AbstractGraphicsScreen aScreen = DefaultGraphicsScreen.createDefault(); MacOSXCGLGraphicsConfiguration cfg = new MacOSXCGLGraphicsConfiguration(aScreen, caps, caps, pixelFormat); - NullWindow nw = new NullWindow(cfg); - nw.setSurfaceHandle(currentDrawable); - return new MacOSXExternalCGLContext(new Drawable(factory, nw), isNSContext, contextHandle); + ProxySurface ns = new ProxySurface(cfg); + ns.setSurfaceHandle(currentDrawable); + return new MacOSXExternalCGLContext(new Drawable(factory, ns), isNSContext, contextHandle); } protected boolean createImpl() throws GLException { @@ -150,7 +151,7 @@ public class MacOSXExternalCGLContext extends MacOSXCGLContext { static class Drawable extends MacOSXCGLDrawable { MacOSXExternalCGLContext extCtx; - Drawable(GLDrawableFactory factory, NativeWindow comp) { + Drawable(GLDrawableFactory factory, NativeSurface comp) { super(factory, comp, true); } diff --git a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXOffscreenCGLDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXOffscreenCGLDrawable.java index adaa48f34..f87c89f2d 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXOffscreenCGLDrawable.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXOffscreenCGLDrawable.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * Copyright (c) 2010 JogAmp Community. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -46,7 +47,7 @@ import com.jogamp.opengl.impl.*; public class MacOSXOffscreenCGLDrawable extends MacOSXPbufferCGLDrawable { public MacOSXOffscreenCGLDrawable(GLDrawableFactory factory, - NativeWindow target) { + NativeSurface target) { super(factory, target); } diff --git a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXOnscreenCGLDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXOnscreenCGLDrawable.java index 6ee023867..798e39ef4 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXOnscreenCGLDrawable.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXOnscreenCGLDrawable.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * Copyright (c) 2010 JogAmp Community. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -51,7 +52,7 @@ public class MacOSXOnscreenCGLDrawable extends MacOSXCGLDrawable { private List/*<WeakReference<GLContext>>*/ createdContexts = new ArrayList(); - protected MacOSXOnscreenCGLDrawable(GLDrawableFactory factory, NativeWindow component) { + protected MacOSXOnscreenCGLDrawable(GLDrawableFactory factory, NativeSurface component) { super(factory, component, false); } @@ -70,14 +71,6 @@ public class MacOSXOnscreenCGLDrawable extends MacOSXCGLDrawable { return context; } - public int getWidth() { - return component.getWidth(); - } - - public int getHeight() { - return component.getHeight(); - } - protected void swapBuffersImpl() { for (Iterator iter = createdContexts.iterator(); iter.hasNext(); ) { WeakReference ref = (WeakReference) iter.next(); diff --git a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java index 3964c9771..5cf8c6eb9 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java @@ -1,3 +1,36 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * Copyright (c) 2010 JogAmp Community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + */ + package com.jogamp.opengl.impl.macosx.cgl; import com.jogamp.common.nio.PointerBuffer; @@ -53,7 +86,7 @@ public class MacOSXPbufferCGLContext extends MacOSXCGLContext { if (newCreated) { // Initialize render-to-texture support if requested - DefaultGraphicsConfiguration config = (DefaultGraphicsConfiguration) drawable.getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration(); + DefaultGraphicsConfiguration config = (DefaultGraphicsConfiguration) drawable.getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration(); GLCapabilities capabilities = (GLCapabilities)config.getChosenCapabilities(); GL gl = getGL(); boolean rect = gl.isGL2GL3() && capabilities.getPbufferRenderToTextureRectangle(); @@ -102,7 +135,7 @@ public class MacOSXPbufferCGLContext extends MacOSXCGLContext { } protected boolean createImpl() throws GLException { - DefaultGraphicsConfiguration config = (DefaultGraphicsConfiguration) drawable.getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration(); + DefaultGraphicsConfiguration config = (DefaultGraphicsConfiguration) drawable.getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration(); GLCapabilities capabilities = (GLCapabilities)config.getChosenCapabilities(); if (capabilities.getPbufferFloatingPointBuffers() && !isTigerOrLater) { @@ -190,7 +223,7 @@ public class MacOSXPbufferCGLContext extends MacOSXCGLContext { class NSOpenGLImpl implements Impl { public boolean isNSContext() { return true; } public long create() { - DefaultGraphicsConfiguration config = (DefaultGraphicsConfiguration) drawable.getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration(); + DefaultGraphicsConfiguration config = (DefaultGraphicsConfiguration) drawable.getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration(); GLCapabilities capabilities = (GLCapabilities)config.getChosenCapabilities(); if (capabilities.getPbufferFloatingPointBuffers() && !isTigerOrLater) { @@ -254,7 +287,7 @@ public class MacOSXPbufferCGLContext extends MacOSXCGLContext { int[] attrs = new int[256]; int i = 0; attrs[i++] = CGL.kCGLPFAPBuffer; - DefaultGraphicsConfiguration config = (DefaultGraphicsConfiguration) drawable.getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration(); + DefaultGraphicsConfiguration config = (DefaultGraphicsConfiguration) drawable.getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration(); GLCapabilities capabilities = (GLCapabilities)config.getChosenCapabilities(); if (capabilities.getPbufferFloatingPointBuffers()) attrs[i++] = CGL.kCGLPFAColorFloat; diff --git a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java index 64d646cfb..bc470383f 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * Copyright (c) 2010 JogAmp Community. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -53,15 +54,15 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable { // 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 + // Note that we can not store this in the NativeSurface because the // semantic is that contains an NSView protected long pBuffer; - public MacOSXPbufferCGLDrawable(GLDrawableFactory factory, NativeWindow target) { + public MacOSXPbufferCGLDrawable(GLDrawableFactory factory, NativeSurface target) { super(factory, target, true); if (DEBUG) { - System.out.println("Pbuffer config: " + getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration()); + System.out.println("Pbuffer config: " + getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration()); } initOpenGLImpl(); @@ -86,10 +87,10 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable { public void destroy() { if (this.pBuffer != 0) { - NativeWindow nw = getNativeWindow(); + NativeSurface ns = getNativeSurface(); impl.destroy(pBuffer); this.pBuffer = 0; - ((SurfaceChangeable)nw).setSurfaceHandle(0); + ((SurfaceChangeable)ns).setSurfaceHandle(0); if (DEBUG) { System.err.println("Destroyed pbuffer: " + pBuffer); } @@ -107,8 +108,8 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable { } private void createPbuffer() { - NativeWindow nw = getNativeWindow(); - DefaultGraphicsConfiguration config = (DefaultGraphicsConfiguration) nw.getGraphicsConfiguration().getNativeGraphicsConfiguration(); + NativeSurface ns = getNativeSurface(); + DefaultGraphicsConfiguration config = (DefaultGraphicsConfiguration) ns.getGraphicsConfiguration().getNativeGraphicsConfiguration(); GLCapabilities capabilities = (GLCapabilities)config.getChosenCapabilities(); GLProfile glProfile = capabilities.getGLProfile(); int renderTarget; @@ -117,7 +118,7 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable { } else { int w = getNextPowerOf2(getWidth()); int h = getNextPowerOf2(getHeight()); - ((SurfaceChangeable)nw).setSize(w, h); + ((SurfaceChangeable)ns).setSize(w, h); renderTarget = GL.GL_TEXTURE_2D; } @@ -148,7 +149,7 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable { throw new GLException("pbuffer creation error: CGL.createPBuffer() failed"); } - ((SurfaceChangeable)nw).setSurfaceHandle(pBuffer); + ((SurfaceChangeable)ns).setSurfaceHandle(pBuffer); } |