diff options
author | Sven Gothel <[email protected]> | 2013-04-18 03:16:33 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-04-18 03:16:33 +0200 |
commit | fd418a69eca7b8c1bb74244982305fc6004d0a52 (patch) | |
tree | 8497ba7ce287b3295e6be8e2344e701cdb7c90e7 /src/jogl/classes/jogamp/opengl/x11 | |
parent | 3cc6fd350fe56ac5b344ee75cfa8bfe4dcc44f1b (diff) |
Fix Bug 720: Unify all platform specific GLContextImpl specializations; Fix Bug 719 - Windows BITMAP Offscreen Orientation is not propagated through API
Fix Bug 719 - Windows BITMAP Offscreen Orientation is not propagated through API
Depends on Bug 720, since cleaning up GLContextImpl* is required to move
property 'GLContext.isGLOrientationFlippedVertical()'
to 'GLDrawable.isGLOriented()' where it belongs!
Windows BITMAP GLDrawable impl. isGLOriented() shall return false,
while we keep the BITMAPINFOHEADER's height field negative
to remove the need for vertical flip when used w/ AWT or Windows, ..
Then property 'GLDrawable.isGLOriented()' has to be recognized throughout the
utility functions, i.e. TextureData's mustFlipVertically and hence TextureIO writer.
Fix Bug 720: Unify all platform specific GLContextImpl specializations
GLContextImpl shall have only _one_ unique platform derivative
to allow proper swapping of GLDrawables of any type via:
- 'GLAutoDrawable.setContext(GLContext newCtx, boolean destroyPrevCtx)', which calls
- 'GLContext.setGLDrawable(GLDrawable readWrite, boolean setWriteOnly)'
Exception: External context may be specialized.
All drawable specific property handling shall be provided
and implemented (if possible) via GLDrawable specializations.
- GLContext.isGLOrientationFlippedVertical() -> GLDrawable.isGLOriented()
- PNGImage.createFromData() takes 'isGLOriented' to properly handle vertical flipping simply by line ordering
- TextureIO's PNG writer passes TextureData's getMustFlipVertically() as isGLOriented to PNGImage.createFromData()
- GLReadBufferUtil respects GLDrawable's isGLOriented() when creating TextureData instance.
- Screenshot respects GLDrawable's isGLOriented()
- Screenshot is deprecated, use GLReadBufferUtil.
- Removed all PBuffer attributes, i.e. floatingPoint, RenderToTexture and RenderToTextureRectangle.
- Allows removal of special pbuffer handling in GLContext* implementations.
- Removed also from GLCapabilities*
- Removed from deprecated GLPbuffer
Impact:
- Low, users who desire to render into a texture shall use our FBO GLOffscreenDrawable.
- Only use case was the deprecated GLPbuffer
- floating point framebuffer technology is still patented anyways :)
- Removed Java2DGLContext, which was only used for OSX's GLJPanel Java2D bridge,
which is no more supported anyways.
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/x11')
9 files changed, 4 insertions, 231 deletions
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() { |