diff options
author | Sven Gothel <[email protected]> | 2009-10-05 15:26:28 -0700 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2009-10-05 15:26:28 -0700 |
commit | 62fb860ffc454fc00ed73f9b6da54bba34a6d64f (patch) | |
tree | cd753aa602beeb429902f1c2b8096e13861fdbb6 /src/jogl/classes/com/sun/opengl/impl/x11 | |
parent | 906e3698f1493daab5cf196b893e65b11b2f0d12 (diff) |
Fix On-/Offscreen and PBuffer.
Demos are working again:
demos.jrefract.JRefract
- X11, Win32, OSX
-Dsun.java2d.opengl=true demos.jrefract.JRefract
- X11, Win32
demos.readbuffer.Main [-GL2,-GL2ES1] -test 0 demos.es1.RedSquare
- X11, Win32, OSX, EGL
demos.readbuffer.Main [-GL2,-GL2ES1] -test [12] demos.es1.RedSquare
- X11, Win32
- OSX not, because of the missing feature of
attaching a read surface.
- EGL not, because the emulation I used didn't support
attaching a read surface. Emulation bug .. probably ..
MacOSXWindowSystemInterface.m createContext():
- Verify if passed surface handle _is_ a view,
now it could be a pbuffer etc .. handle as well.
Cleanup GLDrawableImpl.setRealized(boolean realized)
- Calls setRealizedImpl() (implementation) now,
and only if new stated differs ..
- setRealizedImpl() fixed for:
MacOSXPbufferCGLDrawable: recreate/destroy
WindowsOffscreenWGLDrawable: recreate/destroy
WindowsPbufferWGLDrawable: no-recreate/destroy
X11OffscreenGLXDrawable: recreate/destroy
X11PbufferGLXDrawable: recreate/destroy
WindowsWGLContext:
- wglMakeContextCurrent(): uses isFunctionAvailable ..
- create():
Uses WGL.MakeCurrent() and releases the created context,
due to unavailable MakeContextCurrent extensions
before updating the procaddress tables.
Diffstat (limited to 'src/jogl/classes/com/sun/opengl/impl/x11')
4 files changed, 34 insertions, 14 deletions
diff --git a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawable.java b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawable.java index 1abc36c58..c2a1987cc 100644 --- a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawable.java +++ b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawable.java @@ -54,9 +54,7 @@ public abstract class X11GLXDrawable extends GLDrawableImpl { return (X11GLXDrawableFactory) getFactoryImpl() ; } - public void setRealized(boolean realized) { - super.setRealized(realized); - + protected void setRealizedImpl() { if(!realized) { return; // nothing to do } diff --git a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawableFactory.java b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawableFactory.java index f6c911c63..ebf650ae4 100644 --- a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawableFactory.java +++ b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawableFactory.java @@ -110,10 +110,24 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl implements Dyna return canCreateGLPbuffer; } - protected GLDrawableImpl createGLPbufferDrawableImpl(NativeWindow target) { + protected GLDrawableImpl createGLPbufferDrawableImpl(final NativeWindow target) { + /** + * FIXME: Think about this .. + * should not be necessary ? .. + final List returnList = new ArrayList(); + final GLDrawableFactory factory = this; + Runnable r = new Runnable() { + public void run() { + returnList.add(new X11PbufferGLXDrawable(factory, target)); + } + }; + maybeDoSingleThreadedWorkaround(r); + return (GLDrawableImpl) returnList.get(0); + */ return new X11PbufferGLXDrawable(this, target); } + protected NativeWindow createOffscreenWindow(GLCapabilities capabilities, GLCapabilitiesChooser chooser, int width, int height) { AbstractGraphicsScreen screen = X11GraphicsScreen.createDefault(); NullWindow nw = new NullWindow(X11GLXGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capabilities, chooser, screen)); @@ -147,15 +161,6 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl implements Dyna return res; } - private void maybeDoSingleThreadedWorkaround(Runnable action) { - if (Threading.isSingleThreaded() && - !Threading.isOpenGLThread()) { - Threading.invokeOnOpenGLThread(action); - } else { - action.run(); - } - } - public boolean canCreateContextOnJava2DSurface() { return false; } diff --git a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11OffscreenGLXDrawable.java b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11OffscreenGLXDrawable.java index 98eca44d9..c8b8851f8 100644 --- a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11OffscreenGLXDrawable.java +++ b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11OffscreenGLXDrawable.java @@ -52,6 +52,14 @@ public class X11OffscreenGLXDrawable extends X11GLXDrawable { create(); } + protected void setRealizedImpl() { + if(realized) { + create(); + } else { + destroy(); + } + } + public GLContext createContext(GLContext shareWith) { return new X11OffscreenGLXContext(this, shareWith); } @@ -123,6 +131,7 @@ public class X11OffscreenGLXDrawable extends X11GLXDrawable { drawable = 0; pixmap = 0; display = 0; + ((SurfaceChangeable)nw).setSurfaceHandle(0); } finally { getFactoryImpl().unlockToolkit(); } diff --git a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11PbufferGLXDrawable.java b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11PbufferGLXDrawable.java index ddb96ae6b..e87ef54ac 100644 --- a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11PbufferGLXDrawable.java +++ b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11PbufferGLXDrawable.java @@ -63,6 +63,14 @@ public class X11PbufferGLXDrawable extends X11GLXDrawable { } } + protected void setRealizedImpl() { + if(realized) { + createPbuffer(); + } else { + destroy(); + } + } + public GLContext createContext(GLContext shareWith) { return new X11PbufferGLXContext(this, shareWith); } @@ -74,7 +82,7 @@ public class X11PbufferGLXDrawable extends X11GLXDrawable { if (nw.getSurfaceHandle() != 0) { GLX.glXDestroyPbuffer(nw.getDisplayHandle(), nw.getSurfaceHandle()); } - nw.invalidate(); + ((SurfaceChangeable)nw).setSurfaceHandle(0); } finally { getFactoryImpl().unlockToolkit(); } |