diff options
Diffstat (limited to 'src/jogl/classes/jogamp')
42 files changed, 103 insertions, 1362 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java b/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java index 705f8b94e..53fe6c3c9 100644 --- a/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java +++ b/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java @@ -655,6 +655,12 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe } @Override + public boolean isGLOriented() { + final GLDrawable _drawable = drawable; + return null != _drawable ? _drawable.isGLOriented() : true; + } + + @Override public final GLCapabilitiesImmutable getChosenGLCapabilities() { final GLDrawable _drawable = drawable; return null != _drawable ? _drawable.getChosenGLCapabilities() : null; diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java index 7b760ed0e..883f90591 100644 --- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java @@ -1766,11 +1766,6 @@ public abstract class GLContextImpl extends GLContext { } @Override - public boolean isGLOrientationFlippedVertical() { - return true; - } - - @Override public int getDefaultPixelDataType() { if(!pixelDataTypeEvaluated) { synchronized(this) { @@ -1804,6 +1799,8 @@ public abstract class GLContextImpl extends GLContext { pixelDataFormat=GL.GL_RGBA; pixelDataType = GL.GL_UNSIGNED_BYTE; } + // TODO: Consider: + // return gl.isGL2GL3()?GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV:GL.GL_UNSIGNED_SHORT_5_5_5_1; } //---------------------------------------------------------------------- diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java b/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java index 92ec96ad7..7ef99b241 100644 --- a/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java @@ -469,17 +469,6 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { return (GLDrawableFactoryImpl) getFactory(glp); } - //--------------------------------------------------------------------------- - // Support for Java2D/JOGL bridge on Mac OS X; the external - // GLDrawable mechanism in the public API is sufficient to - // implement this functionality on all other platforms - // - - public abstract boolean canCreateContextOnJava2DSurface(AbstractGraphicsDevice device); - - public abstract GLContext createContextOnJava2DSurface(Object graphics, GLContext shareWith) - throws GLException; - //---------------------------------------------------------------------- // Gamma adjustment support // Thanks to the LWJGL team for illustrating how to make these diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java b/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java index a2b99c7da..877e7b60b 100644 --- a/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java @@ -283,6 +283,11 @@ public abstract class GLDrawableImpl implements GLDrawable { return surface.getHeight(); } + @Override + public boolean isGLOriented() { + return true; + } + /** * {@link NativeSurface#lockSurface() Locks} the underlying windowing toolkit's {@link NativeSurface surface}. * <p> diff --git a/src/jogl/classes/jogamp/opengl/GLPbufferImpl.java b/src/jogl/classes/jogamp/opengl/GLPbufferImpl.java index ddc6d5917..b8841d6e2 100644 --- a/src/jogl/classes/jogamp/opengl/GLPbufferImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLPbufferImpl.java @@ -49,7 +49,6 @@ import com.jogamp.common.util.locks.RecursiveLock; @SuppressWarnings("deprecation") public class GLPbufferImpl extends GLAutoDrawableBase implements GLPbuffer { - private int floatMode; public GLPbufferImpl(GLDrawableImpl pbufferDrawable, GLContextImpl pbufferContext) { super(pbufferDrawable, pbufferContext, true); // drawable := pbufferDrawable, context := pbufferContext @@ -59,28 +58,6 @@ public class GLPbufferImpl extends GLAutoDrawableBase implements GLPbuffer { // pbuffer specifics // - @Override - public void bindTexture() { - // Doesn't make much sense to try to do this on the event dispatch - // thread given that it has to be called while the context is current - context.bindPbufferToTexture(); - } - - @Override - public void releaseTexture() { - // Doesn't make much sense to try to do this on the event dispatch - // thread given that it has to be called while the context is current - context.releasePbufferFromTexture(); - } - - @Override - public int getFloatingPointMode() { - if (floatMode == 0) { - throw new GLException("Pbuffer not initialized, or floating-point support not requested"); - } - return floatMode; - } - // // GLDrawable delegation // @@ -119,22 +96,10 @@ public class GLPbufferImpl extends GLAutoDrawableBase implements GLPbuffer { _lock.lock(); // sync: context/drawable could been recreated/destroyed while animating try { if( null != context ) { - helper.invokeGL(drawable, context, defaultDisplayAction, initAction); + helper.invokeGL(drawable, context, defaultDisplayAction, defaultInitAction); } } finally { _lock.unlock(); } } - - //---------------------------------------------------------------------- - // Internals only below this point - // - - protected final Runnable initAction = new Runnable() { - @Override - public final void run() { - floatMode = context.getFloatingPointMode(); - defaultInitAction.run(); - } }; - } diff --git a/src/jogl/classes/jogamp/opengl/awt/Java2DGLContext.java b/src/jogl/classes/jogamp/opengl/awt/Java2DGLContext.java deleted file mode 100644 index 4a5b1db54..000000000 --- a/src/jogl/classes/jogamp/opengl/awt/Java2DGLContext.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2006 Sun Microsystems, Inc. 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. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package jogamp.opengl.awt; - -import jogamp.opengl.*; -import java.awt.Graphics; - -/** Provides a construct by which the shared GLJPanel code can - * interact with a few methods in the Mac OS X-specific Java2D/JOGL - * bridge implementation. - */ - -public interface Java2DGLContext { - public void setGraphics(Graphics g); -} diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java index 1c0cd0d3c..2b8ca31c9 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java @@ -56,7 +56,7 @@ import com.jogamp.gluegen.runtime.opengl.GLProcAddressResolver; import com.jogamp.nativewindow.egl.EGLGraphicsDevice; import com.jogamp.opengl.GLRendererQuirks; -public abstract class EGLContext extends GLContextImpl { +public class EGLContext extends GLContextImpl { private boolean eglQueryStringInitialized; private boolean eglQueryStringAvailable; private EGLExt _eglExt; diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java index 9b87860cb..431de5159 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java @@ -779,15 +779,4 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { protected GLDrawable createExternalGLDrawableImpl() { throw new GLException("Not yet implemented"); } - - @Override - public boolean canCreateContextOnJava2DSurface(AbstractGraphicsDevice device) { - return false; - } - - @Override - public GLContext createContextOnJava2DSurface(Object graphics, GLContext shareWith) - throws GLException { - throw new GLException("Unimplemented on this platform"); - } } diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLOnscreenContext.java b/src/jogl/classes/jogamp/opengl/egl/EGLOnscreenContext.java deleted file mode 100644 index 325ad6142..000000000 --- a/src/jogl/classes/jogamp/opengl/egl/EGLOnscreenContext.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2008 Sun Microsystems, Inc. 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. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package jogamp.opengl.egl; - -import javax.media.opengl.*; - -public class EGLOnscreenContext extends EGLContext { - public EGLOnscreenContext(EGLOnscreenDrawable drawable, GLContext shareWith) { - super(drawable, shareWith); - } -} - diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLOnscreenDrawable.java b/src/jogl/classes/jogamp/opengl/egl/EGLOnscreenDrawable.java index 6440cf1e5..19084ba19 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLOnscreenDrawable.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLOnscreenDrawable.java @@ -50,7 +50,7 @@ public class EGLOnscreenDrawable extends EGLDrawable { @Override public GLContext createContext(GLContext shareWith) { - return new EGLOnscreenContext(this, shareWith); + return new EGLContext(this, shareWith); } @Override diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLPbufferContext.java b/src/jogl/classes/jogamp/opengl/egl/EGLPbufferContext.java deleted file mode 100644 index bb9eeb892..000000000 --- a/src/jogl/classes/jogamp/opengl/egl/EGLPbufferContext.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2008 Sun Microsystems, Inc. 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. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package jogamp.opengl.egl; - -import javax.media.opengl.*; - -public class EGLPbufferContext extends EGLContext { - public EGLPbufferContext(EGLPbufferDrawable drawable, GLContext shareWith) { - super(drawable, shareWith); - } - - @Override - public int getFloatingPointMode() { - return 0; // FIXME ?? - } -} - diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLPbufferDrawable.java b/src/jogl/classes/jogamp/opengl/egl/EGLPbufferDrawable.java index 9e5d9327b..45e39f5d1 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLPbufferDrawable.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLPbufferDrawable.java @@ -57,7 +57,7 @@ public class EGLPbufferDrawable extends EGLDrawable { @Override public GLContext createContext(GLContext shareWith) { - return new EGLPbufferContext(this, shareWith); + return new EGLContext(this, shareWith); } } diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java index 6cab369cf..666cd30af 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java @@ -80,7 +80,7 @@ import com.jogamp.opengl.util.PMVMatrix; import com.jogamp.opengl.util.glsl.ShaderCode; import com.jogamp.opengl.util.glsl.ShaderProgram; -public abstract class MacOSXCGLContext extends GLContextImpl +public class MacOSXCGLContext extends GLContextImpl { // Abstract interface for implementation of this context (either // NSOpenGL-based or CGL-based) @@ -184,6 +184,9 @@ public abstract class MacOSXCGLContext extends GLContextImpl // CGL extension functions. private CGLExtProcAddressTable cglExtProcAddressTable; + private long updateHandle = 0; + private int lastWidth, lastHeight; + protected MacOSXCGLContext(GLDrawableImpl drawable, GLContext shareWith) { super(drawable, shareWith); @@ -280,9 +283,6 @@ public abstract class MacOSXCGLContext extends GLContextImpl MacOSXCGLGraphicsConfiguration config = (MacOSXCGLGraphicsConfiguration) drawable.getNativeSurface().getGraphicsConfiguration(); GLCapabilitiesImmutable capabilitiesChosen = (GLCapabilitiesImmutable) config.getChosenCapabilities(); - if (capabilitiesChosen.getPbufferFloatingPointBuffers() && !isTigerOrLater) { - throw new GLException("Floating-point pbuffers supported only on OS X 10.4 or later"); - } GLProfile glp = capabilitiesChosen.getGLProfile(); if(glp.isGLES1() || glp.isGLES2() || glp.isGL4() || glp.isGL3() && !isLionOrLater) { throw new GLException("OpenGL profile not supported on MacOSX "+Platform.getOSVersionNumber()+": "+glp); @@ -311,6 +311,7 @@ public abstract class MacOSXCGLContext extends GLContextImpl if (!impl.makeCurrent(contextHandle)) { throw new GLException("Error making Context current: "+this); } + drawableUpdatedNotify(); } @Override @@ -322,18 +323,70 @@ public abstract class MacOSXCGLContext extends GLContextImpl @Override protected void destroyImpl() throws GLException { + releaseUpdateHandle(); if(!impl.destroy(contextHandle)) { throw new GLException("Error destroying OpenGL Context: "+this); } } + private final long getUpdateHandle() { + if( 0 == updateHandle ) { + lastWidth = -1; + lastHeight = -1; + if( isCreated() && drawable.getChosenGLCapabilities().isOnscreen() && isNSContext() ) { + final boolean incompleteView; + final NativeSurface surface = drawable.getNativeSurface(); + if( surface instanceof ProxySurface ) { + incompleteView = ((ProxySurface)surface).containsUpstreamOptionBits( ProxySurface.OPT_UPSTREAM_WINDOW_INVISIBLE ); + } else { + incompleteView = false; + } + if(!incompleteView) { + updateHandle = CGL.updateContextRegister(contextHandle, drawable.getHandle()); + if(0 == updateHandle) { + throw new InternalError("XXX2"); + } + } + } + } + return updateHandle; + } + + private final void releaseUpdateHandle() { + if ( 0 != updateHandle ) { + CGL.updateContextUnregister(updateHandle); + updateHandle = 0; + } + } + + @Override + protected void drawableUpdatedNotify() throws GLException { + if( drawable.getChosenGLCapabilities().isOnscreen() ) { + final long _updateHandle = getUpdateHandle(); + final int w = drawable.getWidth(); + final int h = drawable.getHeight(); + final boolean updateContext = ( 0!=_updateHandle && CGL.updateContextNeedsUpdate(_updateHandle) ) || + w != lastWidth || h != lastHeight; + if(updateContext) { + lastWidth = w; + lastHeight = h; + if (contextHandle == 0) { + throw new GLException("Context not created"); + } + CGL.updateContext(contextHandle); + } + } + } + @Override protected void associateDrawable(boolean bound) { // context stuff depends on drawable stuff if(bound) { super.associateDrawable(true); // 1) init drawable stuff impl.associateDrawable(true); // 2) init context stuff + getUpdateHandle(); } else { + releaseUpdateHandle(); impl.associateDrawable(false); // 1) free context stuff super.associateDrawable(false); // 2) free drawable stuff } diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java index 6c647108f..39178290a 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java @@ -405,17 +405,6 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { throw new GLException("Not yet implemented"); } - @Override - public boolean canCreateContextOnJava2DSurface(AbstractGraphicsDevice device) { - return false; - } - - @Override - public GLContext createContextOnJava2DSurface(Object graphics, GLContext shareWith) - throws GLException { - throw new GLException("not supported in non AWT enviroment"); - } - //------------------------------------------------------ // Gamma-related functionality // diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java index fa8e8d468..86e1ef481 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java @@ -104,7 +104,8 @@ public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration break; case CGL.kCGLPFAColorFloat: - ivalues.put(idx, ( !caps.isOnscreen() && caps.isPBuffer() && caps.getPbufferFloatingPointBuffers() ) ? 1 : 0); + // ivalues.put(idx, ( !caps.isOnscreen() && caps.isPBuffer() && caps.getPbufferFloatingPointBuffers() ) ? 1 : 0); + ivalues.put(idx, 0); break; case CGL.NSOpenGLPFAPixelBuffer: @@ -176,12 +177,13 @@ public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration attrs.put(i++, CGL.kCGLPFAOpenGLProfile); attrs.put(i++, MacOSXCGLContext.GLProfile2CGLOGLProfileValue(ctp, major, minor)); } + /** if(!caps.isOnscreen() && caps.isPBuffer()) { attrs.put(i++, CGL.kCGLPFAPBuffer); if (caps.getPbufferFloatingPointBuffers()) { attrs.put(i++, CGL.kCGLPFAColorFloat); } - } + } */ if (caps.getDoubleBuffered()) { attrs.put(i++, CGL.kCGLPFADoubleBuffer); } @@ -284,7 +286,7 @@ public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration break; case CGL.kCGLPFAColorFloat: - caps.setPbufferFloatingPointBuffers(ivalue != 0); + // caps.setPbufferFloatingPointBuffers(ivalue != 0); break; case CGL.NSOpenGLPFAPixelBuffer: diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLContext.java deleted file mode 100644 index f2e636796..000000000 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLContext.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. 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. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package jogamp.opengl.macosx.cgl; - -import javax.media.opengl.*; - -public class MacOSXOffscreenCGLContext extends MacOSXPbufferCGLContext -{ - public MacOSXOffscreenCGLContext(MacOSXPbufferCGLDrawable drawable, - GLContext shareWith) { - super(drawable, shareWith); - } - - @Override - public int getDefaultPixelDataType() { - final GL gl = getGL(); - return gl.isGL2GL3()?GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV:GL.GL_UNSIGNED_SHORT_5_5_5_1; - } -} diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLDrawable.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLDrawable.java index 4f9005504..446a834b9 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLDrawable.java @@ -53,6 +53,6 @@ public class MacOSXOffscreenCGLDrawable extends MacOSXPbufferCGLDrawable { @Override public GLContext createContext(GLContext shareWith) { - return new MacOSXOffscreenCGLContext(this, shareWith); + return new MacOSXCGLContext(this, shareWith); } } diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLContext.java deleted file mode 100644 index 447d18f68..000000000 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLContext.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. 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. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package jogamp.opengl.macosx.cgl; - -import javax.media.nativewindow.NativeSurface; -import javax.media.nativewindow.ProxySurface; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLException; - -import jogamp.opengl.GLContextImpl; - -public class MacOSXOnscreenCGLContext extends MacOSXCGLContext { - - public MacOSXOnscreenCGLContext(MacOSXOnscreenCGLDrawable drawable, - GLContext shareWith) { - super(drawable, shareWith); - } - - @Override - protected void makeCurrentImpl() throws GLException { - super.makeCurrentImpl(); - drawableUpdatedNotify(); - } - - @Override - protected void drawableUpdatedNotify() throws GLException { - final int w = drawable.getWidth(); - final int h = drawable.getHeight(); - final boolean updateContext = ( 0!=updateHandle && CGL.updateContextNeedsUpdate(updateHandle) ) || - w != lastWidth || h != lastHeight; - if(updateContext) { - lastWidth = w; - lastHeight = h; - if (contextHandle == 0) { - throw new GLException("Context not created"); - } - CGL.updateContext(contextHandle); - } - } - - @Override - protected boolean createImpl(GLContextImpl sharedWith) { - boolean res = super.createImpl(sharedWith); - lastWidth = -1; - lastHeight = -1; - if(res && isNSContext()) { - if(0 != updateHandle) { - throw new InternalError("XXX1"); - } - final boolean incompleteView; - final NativeSurface surface = drawable.getNativeSurface(); - if( surface instanceof ProxySurface ) { - incompleteView = ((ProxySurface)surface).containsUpstreamOptionBits( ProxySurface.OPT_UPSTREAM_WINDOW_INVISIBLE ); - } else { - incompleteView = false; - } - if(!incompleteView) { - updateHandle = CGL.updateContextRegister(contextHandle, drawable.getHandle()); - if(0 == updateHandle) { - throw new InternalError("XXX2"); - } - } - } - return res; - } - - @Override - protected void destroyImpl() throws GLException { - if ( 0 != updateHandle ) { - CGL.updateContextUnregister(updateHandle); - updateHandle = 0; - } - super.destroyImpl(); - } - - private long updateHandle = 0; - private int lastWidth, lastHeight; -} diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLDrawable.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLDrawable.java index ec9628004..c6f0c1383 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLDrawable.java @@ -52,7 +52,7 @@ public class MacOSXOnscreenCGLDrawable extends MacOSXCGLDrawable { @Override public GLContext createContext(GLContext shareWith) { - return new MacOSXOnscreenCGLContext(this, shareWith); + return new MacOSXCGLContext(this, shareWith); } } diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLContext.java deleted file mode 100644 index 7e2d8cf10..000000000 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLContext.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * 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 jogamp.opengl.macosx.cgl; - -import javax.media.opengl.GL; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLPbuffer; - -import jogamp.opengl.GLContextImpl; - -@SuppressWarnings("deprecation") -public class MacOSXPbufferCGLContext extends MacOSXCGLContext { - - // State for render-to-texture and render-to-texture-rectangle support - private int texture; // actual texture object - - public MacOSXPbufferCGLContext(MacOSXPbufferCGLDrawable drawable, - GLContext shareWith) { - super(drawable, shareWith); - } - - @Override - public void bindPbufferToTexture() { - GL gl = getGL(); - gl.glBindTexture(((MacOSXPbufferCGLDrawable)drawable).getTextureTarget(), texture); - // FIXME: not clear whether this is really necessary, but since - // the API docs seem to imply it is and since it doesn't seem to - // impact performance, leaving it in - CGL.setContextTextureImageToPBuffer(contextHandle, drawable.getHandle(), GL.GL_FRONT); - } - - @Override - public void releasePbufferFromTexture() { - } - - @Override - protected boolean createImpl(GLContextImpl shareWith) { - boolean res = super.createImpl(shareWith); - if(res) { - // Initialize render-to-texture support if requested - final GL gl = getGL(); - final MacOSXPbufferCGLDrawable osxPDrawable = (MacOSXPbufferCGLDrawable)drawable; - final int textureTarget = osxPDrawable.getTextureTarget(); - - int[] tmp = new int[1]; - gl.glGenTextures(1, tmp, 0); - texture = tmp[0]; - gl.glBindTexture(textureTarget, texture); - gl.glTexParameteri(textureTarget, GL.GL_TEXTURE_MIN_FILTER, GL.GL_NEAREST); - gl.glTexParameteri(textureTarget, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST); - gl.glTexParameteri(textureTarget, GL.GL_TEXTURE_WRAP_S, GL.GL_CLAMP_TO_EDGE); - gl.glTexParameteri(textureTarget, GL.GL_TEXTURE_WRAP_T, GL.GL_CLAMP_TO_EDGE); - gl.glTexImage2D(textureTarget, 0, GL.GL_RGB, osxPDrawable.getTextureWidth(), osxPDrawable.getTextureHeight(), - 0, GL.GL_RGB, GL.GL_UNSIGNED_BYTE, null); - gl.glCopyTexSubImage2D(textureTarget, 0, 0, 0, 0, 0, drawable.getWidth(), drawable.getHeight()); - } - return res; - } - - @Override - public int getFloatingPointMode() { - return GLPbuffer.APPLE_FLOAT; - } -} diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java index 1e845d179..982bb57e1 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java @@ -47,7 +47,6 @@ import javax.media.nativewindow.NativeSurface; import javax.media.nativewindow.MutableSurface; import javax.media.opengl.GL; import javax.media.opengl.GL2; -import javax.media.opengl.GL2GL3; import javax.media.opengl.GLCapabilitiesImmutable; import javax.media.opengl.GLContext; import javax.media.opengl.GLDrawableFactory; @@ -89,7 +88,7 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable { @Override public GLContext createContext(GLContext shareWith) { - return new MacOSXPbufferCGLContext(this, shareWith); + return new MacOSXCGLContext(this, shareWith); } protected int getTextureTarget() { return pBufferTexTarget; } @@ -134,12 +133,8 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable { } } - if ( capabilities.getPbufferRenderToTextureRectangle() && null!=sr && sr.isRECTTextureAvailable() ) { - pBufferTexTarget = GL2GL3.GL_TEXTURE_RECTANGLE; - } else { - pBufferTexTarget = GL.GL_TEXTURE_2D; - } - if ( GL2GL3.GL_TEXTURE_RECTANGLE == pBufferTexTarget || ( null!=sr && sr.isNPOTTextureAvailable() ) ) { + pBufferTexTarget = GL.GL_TEXTURE_2D; + if ( null!=sr && sr.isNPOTTextureAvailable() ) { pBufferTexWidth = getWidth(); pBufferTexHeight = getHeight(); } else { @@ -147,18 +142,7 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable { pBufferTexHeight = GLBuffers.getNextPowerOf2(getHeight()); } - int internalFormat = GL.GL_RGBA; - if (capabilities.getPbufferFloatingPointBuffers()) { - if(!glProfile.isGL2GL3() || null==sr || sr.isAppleFloatPixelsAvailable()) { - throw new GLException("Floating-point support (GL_APPLE_float_pixels) not available"); - } - switch (capabilities.getRedBits()) { - case 16: internalFormat = GL2.GL_RGBA_FLOAT16_APPLE; break; - case 32: internalFormat = GL2.GL_RGBA_FLOAT32_APPLE; break; - default: throw new GLException("Invalid floating-point bit depth (only 16 and 32 supported)"); - } - } - + final int internalFormat = GL.GL_RGBA; final long pBuffer = impl.create(pBufferTexTarget, internalFormat, getWidth(), getHeight()); if(DEBUG) { System.err.println("MacOSXPbufferCGLDrawable tex: target "+toHexString(pBufferTexTarget)+ diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/awt/MacOSXAWTCGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/awt/MacOSXAWTCGLDrawableFactory.java deleted file mode 100644 index fe60710f0..000000000 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/awt/MacOSXAWTCGLDrawableFactory.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. 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. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package jogamp.opengl.macosx.cgl.awt; - -import javax.media.nativewindow.*; -import javax.media.opengl.*; -import jogamp.opengl.macosx.cgl.*; - -public class MacOSXAWTCGLDrawableFactory extends MacOSXCGLDrawableFactory { - - public MacOSXAWTCGLDrawableFactory() { - super(); - } - - public boolean canCreateContextOnJava2DSurface(AbstractGraphicsDevice device) { - return true; - } - - public GLContext createContextOnJava2DSurface(Object graphics, GLContext shareWith) - throws GLException { - return new MacOSXJava2DCGLContext(shareWith); - } -} diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/awt/MacOSXJava2DCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/awt/MacOSXJava2DCGLContext.java deleted file mode 100644 index bd183b900..000000000 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/awt/MacOSXJava2DCGLContext.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) 2006 Sun Microsystems, Inc. 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. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package jogamp.opengl.macosx.cgl.awt; - -import java.awt.Graphics; - -import javax.media.opengl.GLContext; -import javax.media.opengl.GLException; - -import jogamp.opengl.GLContextImpl; -import jogamp.opengl.awt.Java2D; -import jogamp.opengl.awt.Java2DGLContext; -import jogamp.opengl.macosx.cgl.MacOSXCGLContext; -import jogamp.opengl.macosx.cgl.MacOSXCGLDrawable.GLBackendType; - - -/** MacOSXCGLContext implementation supporting the Java2D/JOGL bridge - * on Mac OS X. The external GLDrawable mechanism does not work on Mac - * OS X due to how drawables and contexts are operated upon on this - * platform, so it is necessary to supply an alternative means to - * create, make current, and destroy contexts on the Java2D "drawable" - * on the Mac platform. - */ - -public class MacOSXJava2DCGLContext extends MacOSXCGLContext implements Java2DGLContext { - private Graphics graphics; - - // FIXME: ignoring context sharing for the time being; will need to - // rethink this in particular if using FBOs to implement the - // Java2D/OpenGL pipeline on Mac OS X - - MacOSXJava2DCGLContext(GLContext shareWith) { - super(null, shareWith); - } - - public void setGraphics(Graphics g) { - this.graphics = g; - } - - protected void makeCurrentImpl() throws GLException { - if (!Java2D.makeOGLContextCurrentOnSurface(graphics, contextHandle)) { - throw new GLException("Error making context current"); - } - } - - protected boolean createImpl(GLContextImpl shareWith) { - long share = createImplPreset(shareWith); - - long ctx = Java2D.createOGLContextOnSurface(graphics, share); - if (ctx == 0) { - if(DEBUG) { - System.err.println("Error creating current: "+this); - } - return false; - } - if (!Java2D.makeOGLContextCurrentOnSurface(graphics, contextHandle)) { - Java2D.destroyOGLContext(ctx); - if(DEBUG) { - System.err.println("Error making created context current: "+this); - } - return false; - } - setGLFunctionAvailability(true, 0, 0, CTX_PROFILE_COMPAT, false); // use GL_VERSION - contextHandle = ctx; - return true; - } - - protected void releaseImpl() throws GLException { - // FIXME: would need another primitive in the Java2D class in - // order to implement this; hopefully should not matter for - // correctness - } - - protected void destroyImpl() throws GLException { - Java2D.destroyOGLContext(contextHandle); - } - - public void setOpenGLMode(GLBackendType mode) { - if (mode != GLBackendType.CGL) { - throw new GLException("OpenGL mode switching not supported for Java2D GLContexts"); - } - super.setOpenGLMode(mode); - } -} diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WGLGLCapabilities.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WGLGLCapabilities.java index 10a4b56d5..4444e9d63 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WGLGLCapabilities.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WGLGLCapabilities.java @@ -32,9 +32,7 @@ import java.nio.IntBuffer; import jogamp.nativewindow.windows.GDI; import jogamp.nativewindow.windows.PIXELFORMATDESCRIPTOR; -import jogamp.opengl.GLGraphicsConfigurationUtil; -import javax.media.nativewindow.AbstractGraphicsDevice; import javax.media.nativewindow.NativeWindowException; import javax.media.opengl.GL; import javax.media.opengl.GLCapabilities; @@ -161,19 +159,13 @@ public class WGLGLCapabilities extends GLCapabilities { } if (res == WGLExt.WGL_TYPE_RGBA_FLOAT_ARB) { - setPbufferFloatingPointBuffers(true); + return false; // not supported } // normal RGBA FB: WGLExt.WGL_TYPE_RGBA_ARB // ignore unknown results here break; - case WGLExt.WGL_FLOAT_COMPONENTS_NV: - if (res != 0) { - setPbufferFloatingPointBuffers(true); - } - break; - case WGLExt.WGL_RED_BITS_ARB: setRedBits(res); break; diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLContext.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLContext.java deleted file mode 100644 index c8aac7f7b..000000000 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLContext.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package jogamp.opengl.windows.wgl; - -import javax.media.opengl.*; - -public class WindowsBitmapWGLContext extends WindowsWGLContext { - public WindowsBitmapWGLContext(WindowsBitmapWGLDrawable drawable, - GLContext shareWith) { - super(drawable, shareWith); - } - - @Override - public int getDefaultPixelDataType() { - return GL.GL_UNSIGNED_BYTE; - } - - @Override - public boolean isGLOrientationFlippedVertical() { - // We can take care of this in the DIB creation (see below) - return false; - } -} diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLDrawable.java index bd018105a..a7f62fccf 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLDrawable.java @@ -73,9 +73,14 @@ public class WindowsBitmapWGLDrawable extends WindowsWGLDrawable { @Override public GLContext createContext(GLContext shareWith) { - return new WindowsBitmapWGLContext(this, shareWith); + return new WindowsWGLContext(this, shareWith); } + @Override + public boolean isGLOriented() { + return false; + } + private void createBitmap() { int werr; final NativeSurface ns = getNativeSurface(); @@ -111,9 +116,9 @@ public class WindowsBitmapWGLDrawable extends WindowsWGLDrawable { bitsPerPixel = 24; // RGB888 only! header.setBiSize(BITMAPINFOHEADER.size()); header.setBiWidth(width); - // NOTE: negating the height causes the DIB to be in top-down row - // order rather than bottom-up; ends up being correct during pixel - // readback + // NOTE: Positive height causes the DIB's origin at bottom-left (OpenGL), + // a negative height causes the DIB's origin at top-left (Java AWT, Windows, ..). + // We use !OpenGL origin to remove the need for vertical flip, see 'isGLOriented()' above. header.setBiHeight(-1 * height); header.setBiPlanes((short) 1); header.setBiBitCount((short) bitsPerPixel); diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsOnscreenWGLContext.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsOnscreenWGLContext.java deleted file mode 100644 index aef55efc6..000000000 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsOnscreenWGLContext.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. 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. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package jogamp.opengl.windows.wgl; - -import javax.media.opengl.*; - -public class WindowsOnscreenWGLContext extends WindowsWGLContext { - public WindowsOnscreenWGLContext(WindowsOnscreenWGLDrawable drawable, - GLContext shareWith) { - super(drawable, shareWith); - } -} diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsOnscreenWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsOnscreenWGLDrawable.java index ddbb29d51..61fb787c6 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsOnscreenWGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsOnscreenWGLDrawable.java @@ -51,7 +51,7 @@ public class WindowsOnscreenWGLDrawable extends WindowsWGLDrawable { @Override public GLContext createContext(GLContext shareWith) { - return new WindowsOnscreenWGLContext(this, shareWith); + return new WindowsWGLContext(this, shareWith); } } diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLContext.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLContext.java deleted file mode 100644 index 7dda6a1f1..000000000 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLContext.java +++ /dev/null @@ -1,156 +0,0 @@ -/* - * 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. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package jogamp.opengl.windows.wgl; - -import javax.media.opengl.*; - -import com.jogamp.opengl.GLExtensions; - -import jogamp.opengl.GLContextImpl; - -public class WindowsPbufferWGLContext extends WindowsWGLContext { - // State for render-to-texture and render-to-texture-rectangle support - private boolean rtt; // render-to-texture? - private boolean hasRTT; // render-to-texture extension available? - private boolean rect; // render-to-texture-rectangle? - private int textureTarget; // e.g. GL_TEXTURE_2D, GL_TEXTURE_RECTANGLE_NV - private int texture; // actual texture object - - protected WindowsPbufferWGLContext(WindowsPbufferWGLDrawable drawable, - GLContext shareWith) { - super(drawable, shareWith); - } - - @Override - public void bindPbufferToTexture() { - if (!rtt) { - throw new GLException("Shouldn't try to bind a pbuffer to a texture if render-to-texture hasn't been " + - "specified in its GLCapabilities"); - } - GL gl = getGL(); - WGLExt wglExt = getWGLExt(); - gl.glBindTexture(textureTarget, texture); - if (rtt && hasRTT) { - if (!wglExt.wglBindTexImageARB(((WindowsPbufferWGLDrawable)drawable).getPbufferHandle(), WGLExt.WGL_FRONT_LEFT_ARB)) { - throw new GLException("Binding of pbuffer to texture failed: " + wglGetLastError()); - } - } - // FIXME: comment is wrong now - // Note that if the render-to-texture extension is not supported, - // we perform a glCopyTexImage2D in swapBuffers(). - } - - @Override - public void releasePbufferFromTexture() { - if (!rtt) { - throw new GLException("Shouldn't try to bind a pbuffer to a texture if render-to-texture hasn't been " + - "specified in its GLCapabilities"); - } - if (rtt && hasRTT) { - WGLExt wglExt = getWGLExt(); - if (!wglExt.wglReleaseTexImageARB(((WindowsPbufferWGLDrawable)drawable).getPbufferHandle(), WGLExt.WGL_FRONT_LEFT_ARB)) { - throw new GLException("Releasing of pbuffer from texture failed: " + wglGetLastError()); - } - } - } - - @Override - protected boolean createImpl(GLContextImpl shareWith) { - boolean res = super.createImpl(shareWith); - if(res) { - GLCapabilitiesImmutable capabilities = drawable.getChosenGLCapabilities(); - - // Initialize render-to-texture support if requested - GL gl = getGL(); - rtt = capabilities.getPbufferRenderToTexture(); - rect = gl.isGL2GL3() && capabilities.getPbufferRenderToTextureRectangle(); - - if (rtt) { - if (DEBUG) { - System.err.println("Initializing render-to-texture support"); - } - - if (!gl.isExtensionAvailable("WGL_ARB_render_texture")) { - System.err.println("WindowsPbufferWGLContext: WARNING: WGL_ARB_render_texture extension not " + - "supported; implementing render_to_texture support using slow texture readback"); - } else { - hasRTT = true; - - if (rect && !gl.isExtensionAvailable(GLExtensions.NV_texture_rectangle)) { - System.err.println("WindowsPbufferWGLContext: WARNING: GL_NV_texture_rectangle extension not " + - "supported; skipping requested render_to_texture_rectangle support for pbuffer"); - rect = false; - } - if (rect) { - if (DEBUG) { - System.err.println(" Using render-to-texture-rectangle"); - } - textureTarget = GL2GL3.GL_TEXTURE_RECTANGLE_ARB; - } else { - if (DEBUG) { - System.err.println(" Using vanilla render-to-texture"); - } - textureTarget = GL.GL_TEXTURE_2D; - } - int[] tmp = new int[1]; - gl.glGenTextures(1, tmp, 0); - texture = tmp[0]; - gl.glBindTexture(textureTarget, texture); - gl.glTexParameteri(textureTarget, GL.GL_TEXTURE_MIN_FILTER, GL.GL_NEAREST); - gl.glTexParameteri(textureTarget, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST); - gl.glTexParameteri(textureTarget, GL.GL_TEXTURE_WRAP_S, GL.GL_CLAMP_TO_EDGE); - gl.glTexParameteri(textureTarget, GL.GL_TEXTURE_WRAP_T, GL.GL_CLAMP_TO_EDGE); - gl.glCopyTexImage2D(textureTarget, 0, GL.GL_RGB, 0, 0, drawable.getWidth(), drawable.getHeight(), 0); - } - } - } - return res; - } - - @Override - public int getFloatingPointMode() { - return ((WindowsPbufferWGLDrawable)drawable).getFloatingPointMode(); - } - - private static String wglGetLastError() { - return WindowsWGLDrawableFactory.wglGetLastError(); - } -} diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java index b65f5dd2f..2a0f2596e 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java @@ -47,7 +47,6 @@ import javax.media.nativewindow.AbstractGraphicsDevice; import javax.media.nativewindow.NativeSurface; import javax.media.nativewindow.NativeWindowException; import javax.media.nativewindow.MutableSurface; -import javax.media.opengl.GL; import javax.media.opengl.GLCapabilitiesImmutable; import javax.media.opengl.GLContext; import javax.media.opengl.GLDrawableFactory; @@ -60,15 +59,12 @@ import jogamp.nativewindow.windows.GDI; import jogamp.opengl.GLDrawableImpl; import jogamp.opengl.GLGraphicsConfigurationUtil; import jogamp.opengl.windows.wgl.WindowsWGLDrawableFactory.SharedResource; -// import javax.media.opengl.GLPbuffer; public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable { private WGLExt cachedWGLExt; // cached WGLExt instance from parent GLCanvas, // needed to destroy pbuffer private long buffer; // pbuffer handle - private int floatMode; - protected WindowsPbufferWGLDrawable(GLDrawableFactory factory, NativeSurface target) { super(factory, target, false); } @@ -84,7 +80,7 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable { @Override public GLContext createContext(GLContext shareWith) { - return new WindowsPbufferWGLContext(this, shareWith); + return new WindowsWGLContext(this, shareWith); } protected void destroyPbuffer() { @@ -115,10 +111,6 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable { return buffer; } - public int getFloatingPointMode() { - return floatMode; - } - private void createPbuffer() { WindowsWGLGraphicsConfiguration config = (WindowsWGLGraphicsConfiguration) getNativeSurface().getGraphicsConfiguration(); SharedResource sharedResource = ((WindowsWGLDrawableFactory)factory).getOrCreateSharedResource(config.getScreen().getDevice()); @@ -155,17 +147,6 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable { throw new GLException("Pbuffer-related extensions not supported"); } - floatMode = floatModeTmp[0]; - boolean rtt = chosenCaps.getPbufferRenderToTexture(); - boolean rect = chosenCaps.getPbufferRenderToTextureRectangle(); - boolean useFloat = chosenCaps.getPbufferFloatingPointBuffers(); - // boolean ati = false; - - /** - if (useFloat) { - ati = (floatMode == GLPbuffer.ATI_FLOAT); - } */ - final IntBuffer pformats = Buffers.newDirectIntBuffer(WindowsWGLGraphicsConfiguration.MAX_PFORMATS); final IntBuffer nformatsTmp = Buffers.newDirectIntBuffer(1); if (!wglExt.wglChoosePixelFormatARB(sharedHdc, @@ -198,24 +179,6 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable { // Create the p-buffer. niattribs = 0; - if (rtt) { - iattributes.put(niattribs++, WGLExt.WGL_TEXTURE_FORMAT_ARB); - if (useFloat) { - iattributes.put(niattribs++, WGLExt.WGL_TEXTURE_FLOAT_RGB_NV); - } else { - iattributes.put(niattribs++, WGLExt.WGL_TEXTURE_RGBA_ARB); - } - - iattributes.put(niattribs++, WGLExt.WGL_TEXTURE_TARGET_ARB); - iattributes.put(niattribs++, rect ? WGLExt.WGL_TEXTURE_RECTANGLE_NV : WGLExt.WGL_TEXTURE_2D_ARB); - - iattributes.put(niattribs++, WGLExt.WGL_MIPMAP_TEXTURE_ARB); - iattributes.put(niattribs++, GL.GL_FALSE); - - iattributes.put(niattribs++, WGLExt.WGL_PBUFFER_LARGEST_ARB); // exact - iattributes.put(niattribs++, GL.GL_FALSE); - } - iattributes.put(niattribs++, 0); tmpBuffer = wglExt.wglCreatePbufferARB(sharedHdc, format, getWidth(), getHeight(), iattributes); diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java index 9f034adb1..1f41563ba 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java @@ -540,15 +540,4 @@ public class WindowsWGLContext extends GLContextImpl { public ByteBuffer glAllocateMemoryNV(int arg0, float arg1, float arg2, float arg3) { return getWGLExt().wglAllocateMemoryNV(arg0, arg1, arg2, arg3); } - - @Override - public void bindPbufferToTexture() { - throw new GLException("Should not call this"); - } - - @Override - public void releasePbufferFromTexture() { - throw new GLException("Should not call this"); - } - } diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java index d7d6ceab4..26d73638f 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java @@ -617,17 +617,6 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { return detail; } - @Override - public final boolean canCreateContextOnJava2DSurface(AbstractGraphicsDevice device) { - return false; - } - - @Override - public final GLContext createContextOnJava2DSurface(Object graphics, GLContext shareWith) - throws GLException { - throw new GLException("Unimplemented on this platform"); - } - //------------------------------------------------------ // Gamma-related functionality // diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java index fdff20daa..3b71c4462 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java @@ -46,12 +46,10 @@ import javax.media.opengl.GLCapabilitiesImmutable; import javax.media.opengl.GLCapabilitiesChooser; import javax.media.opengl.GLDrawableFactory; import javax.media.opengl.GLException; -import javax.media.opengl.GLPbuffer; import javax.media.opengl.GLProfile; import com.jogamp.common.nio.Buffers; import com.jogamp.nativewindow.MutableGraphicsConfiguration; -import com.jogamp.opengl.GLExtensions; import jogamp.nativewindow.windows.DWM_BLURBEHIND; import jogamp.nativewindow.windows.GDI; @@ -61,7 +59,6 @@ import jogamp.nativewindow.windows.PIXELFORMATDESCRIPTOR; import jogamp.opengl.GLContextImpl; import jogamp.opengl.GLGraphicsConfigurationUtil; -@SuppressWarnings("deprecation") public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguration implements Cloneable { protected static final int MAX_PFORMATS = 256; protected static final int MAX_ATTRIBS = 256; @@ -257,15 +254,6 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio iattributes.put(niattribs++, WGLExt.WGL_SAMPLE_BUFFERS_ARB); iattributes.put(niattribs++, WGLExt.WGL_SAMPLES_ARB); } - - if(sharedResource.hasARBPBuffer()) { - GLContextImpl sharedCtx = sharedResource.getContext(); - if(null != sharedCtx && sharedCtx.isExtensionAvailable(WindowsWGLDrawableFactory.WGL_NV_float_buffer)) { - // pbo float buffer - iattributes.put(niattribs++, WGLExt.WGL_FLOAT_COMPONENTS_NV); // nvidia - } - } - return niattribs; } @@ -511,85 +499,8 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio iattributes.put(niattribs++, caps.getNumSamples()); } - boolean rtt = caps.getPbufferRenderToTexture(); - boolean rect = caps.getPbufferRenderToTextureRectangle(); - boolean useFloat = caps.getPbufferFloatingPointBuffers(); - boolean ati = false; - boolean nvidia = false; - if ( usePBuffer ) { - // Check some invariants and set up some state - if (rect && !rtt) { - throw new GLException("Render-to-texture-rectangle requires render-to-texture to be specified"); - } - - GLContextImpl sharedCtx = sharedResource.getContext(); - if (rect) { - if (!sharedCtx.isExtensionAvailable(GLExtensions.NV_texture_rectangle)) { - throw new GLException("Render-to-texture-rectangle requires GL_NV_texture_rectangle extension"); - } - } - - if (useFloat) { - // Prefer NVidia extension over ATI - nvidia = sharedCtx.isExtensionAvailable(WindowsWGLDrawableFactory.WGL_NV_float_buffer); - if(nvidia) { - floatMode[0] = GLPbuffer.NV_FLOAT; - } else { - ati = sharedCtx.isExtensionAvailable("WGL_ATI_pixel_format_float"); - if(ati) { - floatMode[0] = GLPbuffer.ATI_FLOAT; - } else { - throw new GLException("Floating-point pbuffers not supported by this hardware"); - } - } - - if (DEBUG) { - System.err.println("Using " + (ati ? "ATI" : ( nvidia ? "NVidia" : "NONE" ) ) + " floating-point extension"); - } - } - - // See whether we need to change the pixel type to support ATI's - // floating-point pbuffers - if (useFloat && ati) { - if (rtt) { - throw new GLException("Render-to-floating-point-texture not supported on ATI hardware"); - } else { - iattributes.put(niattribs++, WGLExt.WGL_PIXEL_TYPE_ARB); - iattributes.put(niattribs++, WGLExt.WGL_TYPE_RGBA_FLOAT_ARB); - } - } else { - if (!rtt) { - // Currently we don't support non-truecolor visuals in the - // GLCapabilities, so we don't offer the option of making - // color-index pbuffers. - iattributes.put(niattribs++, WGLExt.WGL_PIXEL_TYPE_ARB); - iattributes.put(niattribs++, WGLExt.WGL_TYPE_RGBA_ARB); - } - } - - if (useFloat && nvidia) { - iattributes.put(niattribs++, WGLExt.WGL_FLOAT_COMPONENTS_NV); - iattributes.put(niattribs++, GL.GL_TRUE); - } - - if (rtt) { - if (useFloat) { - assert(!ati); - assert(nvidia); - if (!rect) { - throw new GLException("Render-to-floating-point-texture only supported on NVidia hardware with render-to-texture-rectangle"); - } - iattributes.put(niattribs++, WGLExt.WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV); - iattributes.put(niattribs++, GL.GL_TRUE); - } else { - iattributes.put(niattribs++, rect ? WGLExt.WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV : WGLExt.WGL_BIND_TO_TEXTURE_RGB_ARB); - iattributes.put(niattribs++, GL.GL_TRUE); - } - } - } else { - iattributes.put(niattribs++, WGLExt.WGL_PIXEL_TYPE_ARB); - iattributes.put(niattribs++, WGLExt.WGL_TYPE_RGBA_ARB); - } + iattributes.put(niattribs++, WGLExt.WGL_PIXEL_TYPE_ARB); + iattributes.put(niattribs++, WGLExt.WGL_TYPE_RGBA_ARB); iattributes.put(niattribs++, 0); return true; diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java index 575ff51b8..c60619452 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java @@ -65,7 +65,7 @@ import com.jogamp.gluegen.runtime.opengl.GLProcAddressResolver; import com.jogamp.nativewindow.x11.X11GraphicsDevice; import com.jogamp.opengl.GLExtensions; -public abstract class X11GLXContext extends GLContextImpl { +public class X11GLXContext extends GLContextImpl { private static final Map<String, String> functionNameMap; private static final Map<String, String> extensionNameMap; private GLXExt _glXExt; @@ -624,16 +624,6 @@ public abstract class X11GLXContext extends GLContextImpl { } @Override - public void bindPbufferToTexture() { - throw new GLException("Should not call this"); - } - - @Override - public void releasePbufferFromTexture() { - throw new GLException("Should not call this"); - } - - @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append(getClass().getSimpleName()); diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java index 9486b5875..19005e48c 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java @@ -571,17 +571,6 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { return X11ExternalGLXDrawable.create(this, null); } - @Override - public final boolean canCreateContextOnJava2DSurface(AbstractGraphicsDevice device) { - return false; - } - - @Override - public final GLContext createContextOnJava2DSurface(Object graphics, GLContext shareWith) - throws GLException { - throw new GLException("Unimplemented on this platform"); - } - //---------------------------------------------------------------------- // Gamma-related functionality // diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java index 12ce22392..523364389 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java @@ -225,17 +225,6 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem res.put(idx++, GLX.GLX_SAMPLES); res.put(idx++, caps.getNumSamples()); } - if (caps.isPBuffer()) { - if (caps.getPbufferFloatingPointBuffers()) { - String glXExtensions = GLX.glXQueryExtensionsString(display, screen); - if (glXExtensions == null || - glXExtensions.indexOf("GLX_NV_float_buffer") < 0) { - throw new GLException("Floating-point pbuffers on X11 currently require NVidia hardware: "+glXExtensions); - } - res.put(idx++, GLXExt.GLX_FLOAT_COMPONENTS_NV); - res.put(idx++, GL.GL_TRUE); - } - } res.put(idx++, 0); return res; } @@ -341,10 +330,6 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem res.setDepthBits (glXGetFBConfig(display, fbcfg, GLX.GLX_DEPTH_SIZE, tmp)); res.setStencilBits (glXGetFBConfig(display, fbcfg, GLX.GLX_STENCIL_SIZE, tmp)); - try { - res.setPbufferFloatingPointBuffers(glXGetFBConfig(display, fbcfg, GLXExt.GLX_FLOAT_COMPONENTS_NV, tmp) != GL.GL_FALSE); - } catch (Exception e) {} - return (X11GLCapabilities) GLGraphicsConfigurationUtil.fixWinAttribBitsAndHwAccel(device, drawableTypeBits, res); } diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11OnscreenGLXContext.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11OnscreenGLXContext.java deleted file mode 100644 index 460dc10ca..000000000 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11OnscreenGLXContext.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. 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. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ -package jogamp.opengl.x11.glx; - -import javax.media.opengl.*; - -public class X11OnscreenGLXContext extends X11GLXContext { - - public X11OnscreenGLXContext(X11OnscreenGLXDrawable drawable, GLContext shareWith) { - super(drawable, shareWith); - } -} diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11OnscreenGLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11OnscreenGLXDrawable.java index 6b239a43d..9da189290 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11OnscreenGLXDrawable.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11OnscreenGLXDrawable.java @@ -104,6 +104,6 @@ public class X11OnscreenGLXDrawable extends X11GLXDrawable { @Override public GLContext createContext(GLContext shareWith) { - return new X11OnscreenGLXContext(this, shareWith); + return new X11GLXContext(this, shareWith); } } diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXContext.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXContext.java deleted file mode 100644 index a34e050cd..000000000 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXContext.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. 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. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package jogamp.opengl.x11.glx; - -import javax.media.opengl.*; - -public class X11PbufferGLXContext extends X11GLXContext { - - public X11PbufferGLXContext(X11PbufferGLXDrawable drawable, GLContext shareWith) { - super(drawable, shareWith); - } - - @Override - public void bindPbufferToTexture() { - // FIXME: figure out how to implement this - throw new GLException("Not yet implemented"); - } - - @Override - public void releasePbufferFromTexture() { - // FIXME: figure out how to implement this - throw new GLException("Not yet implemented"); - } - - - @Override - public int getFloatingPointMode() { - return ((X11PbufferGLXDrawable)drawable).getFloatingPointMode(); - } -} diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java index d2d0c6789..0e771fd0f 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java @@ -46,15 +46,12 @@ import javax.media.nativewindow.AbstractGraphicsDevice; import javax.media.nativewindow.AbstractGraphicsScreen; import javax.media.nativewindow.NativeSurface; import javax.media.nativewindow.MutableSurface; -import javax.media.opengl.GLCapabilitiesImmutable; import javax.media.opengl.GLContext; import javax.media.opengl.GLDrawableFactory; import javax.media.opengl.GLException; -import javax.media.opengl.GLPbuffer; import com.jogamp.common.nio.Buffers; -@SuppressWarnings("deprecation") public class X11PbufferGLXDrawable extends X11GLXDrawable { protected X11PbufferGLXDrawable(GLDrawableFactory factory, NativeSurface target) { /* GLCapabilities caps, @@ -74,7 +71,7 @@ public class X11PbufferGLXDrawable extends X11GLXDrawable { @Override public GLContext createContext(GLContext shareWith) { - return new X11PbufferGLXContext(this, shareWith); + return new X11GLXContext(this, shareWith); } protected void destroyPbuffer() { @@ -103,16 +100,6 @@ public class X11PbufferGLXDrawable extends X11GLXDrawable { throw new GLException("Null display"); } - GLCapabilitiesImmutable chosenCaps = (GLCapabilitiesImmutable)config.getChosenCapabilities(); - - if (chosenCaps.getPbufferRenderToTexture()) { - throw new GLException("Render-to-texture pbuffers not supported yet on X11"); - } - - if (chosenCaps.getPbufferRenderToTextureRectangle()) { - throw new GLException("Render-to-texture-rectangle pbuffers not supported yet on X11"); - } - // Create the p-buffer. int niattribs = 0; IntBuffer iattributes = Buffers.newDirectIntBuffer(7); @@ -138,9 +125,4 @@ public class X11PbufferGLXDrawable extends X11GLXDrawable { System.err.println(getThreadName()+": Created pbuffer " + this); } } - - public int getFloatingPointMode() { - // Floating-point pbuffers currently require NVidia hardware on X11 - return GLPbuffer.NV_FLOAT; - } } diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXContext.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXContext.java deleted file mode 100644 index 1cfb7e427..000000000 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXContext.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package jogamp.opengl.x11.glx; - -import javax.media.opengl.*; - -public class X11PixmapGLXContext extends X11GLXContext { - - public X11PixmapGLXContext(X11PixmapGLXDrawable drawable, - GLContext shareWith) { - super(drawable, shareWith); - } - - @Override - public int getDefaultPixelDataType() { - GL gl = getGL(); - return gl.isGL2GL3()?GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV:GL.GL_UNSIGNED_SHORT_5_5_5_1; - } - -} diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXDrawable.java index ab25e4ef4..c1388db8a 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXDrawable.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXDrawable.java @@ -69,7 +69,7 @@ public class X11PixmapGLXDrawable extends X11GLXDrawable { @Override public GLContext createContext(GLContext shareWith) { - return new X11PixmapGLXContext(this, shareWith); + return new X11GLXContext(this, shareWith); } private void createPixmap() { |