diff options
Diffstat (limited to 'src/jogl')
13 files changed, 67 insertions, 150 deletions
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java index b6f5dabd3..f81e5a70e 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java @@ -43,7 +43,7 @@ import javax.media.opengl.*; import com.jogamp.common.JogampRuntimeException; import com.jogamp.common.util.*; import jogamp.opengl.*; -import jogamp.nativewindow.ProxySurface; +import jogamp.nativewindow.WrappedSurface; import java.util.HashMap; import java.util.List; @@ -220,7 +220,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } protected NativeSurface createOffscreenSurfaceImpl(AbstractGraphicsDevice device, GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser, int width, int height) { - ProxySurface ns = new ProxySurface(EGLGraphicsConfigurationFactory.createOffscreenGraphicsConfiguration(device, capsChosen, capsRequested, chooser)); + WrappedSurface ns = new WrappedSurface(EGLGraphicsConfigurationFactory.createOffscreenGraphicsConfiguration(device, capsChosen, capsRequested, chooser)); ns.setSize(width, height); return ns; } diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLExternalContext.java b/src/jogl/classes/jogamp/opengl/egl/EGLExternalContext.java index 78c23f710..dd06dc148 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLExternalContext.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLExternalContext.java @@ -40,7 +40,6 @@ import jogamp.opengl.*; import javax.media.nativewindow.*; public class EGLExternalContext extends EGLContext { - private boolean firstMakeCurrent = true; private GLContext lastContext; public EGLExternalContext(AbstractGraphicsScreen screen) { @@ -68,9 +67,6 @@ public class EGLExternalContext extends EGLContext { } protected void makeCurrentImpl(boolean newCreated) throws GLException { - if (firstMakeCurrent) { - firstMakeCurrent = false; - } } protected void releaseImpl() throws GLException { diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java index 19f3ce640..8e27c217b 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java @@ -51,7 +51,7 @@ import javax.media.opengl.*; import com.jogamp.common.JogampRuntimeException; import com.jogamp.common.util.*; import jogamp.opengl.*; -import jogamp.nativewindow.ProxySurface; +import jogamp.nativewindow.WrappedSurface; public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { private static final DesktopGLDynamicLookupHelper macOSXCGLDynamicLookupHelper; @@ -167,7 +167,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { protected NativeSurface createOffscreenSurfaceImpl(AbstractGraphicsDevice device,GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser, int width, int height) { AbstractGraphicsScreen screen = DefaultGraphicsScreen.createDefault(NativeWindowFactory.TYPE_MACOSX); - ProxySurface ns = new ProxySurface(MacOSXCGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capsChosen, capsRequested, chooser, screen, true)); + WrappedSurface ns = new WrappedSurface(MacOSXCGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capsChosen, capsRequested, chooser, screen, true)); ns.setSize(width, height); return ns; } diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXExternalCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXExternalCGLContext.java index e0ee8ea73..af055913d 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXExternalCGLContext.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXExternalCGLContext.java @@ -44,10 +44,9 @@ import javax.media.opengl.*; import jogamp.opengl.*; import javax.media.nativewindow.*; -import jogamp.nativewindow.ProxySurface; +import jogamp.nativewindow.WrappedSurface; public class MacOSXExternalCGLContext extends MacOSXCGLContext { - private boolean firstMakeCurrent = true; private GLContext lastContext; private MacOSXExternalCGLContext(Drawable drawable, boolean isNSContext, long handle) { @@ -100,7 +99,7 @@ public class MacOSXExternalCGLContext extends MacOSXCGLContext { AbstractGraphicsScreen aScreen = DefaultGraphicsScreen.createDefault(NativeWindowFactory.TYPE_MACOSX); MacOSXCGLGraphicsConfiguration cfg = new MacOSXCGLGraphicsConfiguration(aScreen, caps, caps, pixelFormat); - ProxySurface ns = new ProxySurface(cfg); + WrappedSurface ns = new WrappedSurface(cfg); ns.setSurfaceHandle(currentDrawable); return new MacOSXExternalCGLContext(new Drawable(factory, ns), isNSContext, contextHandle); } @@ -127,9 +126,6 @@ public class MacOSXExternalCGLContext extends MacOSXCGLContext { } protected void makeCurrentImpl(boolean newCreated) throws GLException { - if (firstMakeCurrent) { - firstMakeCurrent = false; - } } protected void releaseImpl() throws GLException { diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsDummyWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsDummyWGLDrawable.java index 27d7b342e..3d0cce725 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsDummyWGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsDummyWGLDrawable.java @@ -45,29 +45,21 @@ import javax.media.opengl.GLDrawableFactory; import javax.media.opengl.GLProfile; import javax.media.nativewindow.AbstractGraphicsScreen; -import jogamp.nativewindow.ProxySurface; import jogamp.nativewindow.windows.GDI; -import javax.media.nativewindow.AbstractGraphicsDevice; import javax.media.nativewindow.NativeSurface; import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; import javax.media.opengl.GLException; +import jogamp.nativewindow.windows.GDISurface; public class WindowsDummyWGLDrawable extends WindowsWGLDrawable { - private static final int f_dim = 64; - private long hwnd, hdc; + private long hwnd; + private boolean handleHwndLifecycle; - protected WindowsDummyWGLDrawable(GLDrawableFactory factory, GLCapabilitiesImmutable caps, AbstractGraphicsScreen absScreen) { - super(factory, new ProxySurface(WindowsWGLGraphicsConfigurationFactory.createDefaultGraphicsConfiguration(caps, absScreen)), true); - hwnd = GDI.CreateDummyWindow(0, 0, f_dim, f_dim); - if(0 == hwnd) { - throw new GLException("Error hwnd 0, werr: "+GDI.GetLastError()); - } - // manual debug only - GDI.ShowWindow(hwnd, GDI.SW_SHOW); - ProxySurface ns = (ProxySurface) getNativeSurface(); - ns.setSize(f_dim, f_dim); + private WindowsDummyWGLDrawable(GLDrawableFactory factory, GDISurface ns, boolean handleHwndLifecycle) { + super(factory, ns, true); + this.handleHwndLifecycle = handleHwndLifecycle; - if(NativeSurface.LOCK_SURFACE_NOT_READY >= lockSurface()) { + if(NativeSurface.LOCK_SURFACE_NOT_READY >= ns.lockSurface()) { throw new GLException("WindowsDummyWGLDrawable: surface not ready (lockSurface)"); } try { @@ -84,70 +76,16 @@ public class WindowsDummyWGLDrawable extends WindowsWGLDrawable { } } - public static WindowsDummyWGLDrawable create(GLDrawableFactory factory, GLProfile glp, AbstractGraphicsScreen absScreen) { - GLCapabilities caps = new GLCapabilities(glp); - caps.setDepthBits(16); - caps.setDoubleBuffered(true); - caps.setOnscreen (true); - return new WindowsDummyWGLDrawable(factory, caps, absScreen); - } - - public int lockSurface() throws GLException { - int res = NativeSurface.LOCK_SURFACE_NOT_READY; - ProxySurface ns = (ProxySurface) getNativeSurface(); - AbstractGraphicsDevice adevice = ns.getGraphicsConfiguration().getNativeGraphicsConfiguration().getScreen().getDevice(); - adevice.lock(); - try { - res = ns.lockSurface(); - if(NativeSurface.LOCK_SUCCESS == res) { - if(0 == hdc) { - hdc = GDI.GetDC(hwnd); - ns.setSurfaceHandle(hdc); - if(0 == hdc) { - res = NativeSurface.LOCK_SURFACE_NOT_READY; - ns.unlockSurface(); - throw new GLException("Error hdc 0, werr: "+GDI.GetLastError()); - // finally will unlock adevice - } - } - } else { - Throwable t = new Throwable("Error lock failed - res "+res+", hwnd "+toHexString(hwnd)+", hdc "+toHexString(hdc)); - t.printStackTrace(); - } - } finally { - if( NativeSurface.LOCK_SURFACE_NOT_READY == res ) { - adevice.unlock(); - } + public static WindowsDummyWGLDrawable create(GLDrawableFactory factory, GLProfile glp, AbstractGraphicsScreen absScreen, + long windowHandle, int width, int height, boolean handleWindowLifecycle) { + if(0 == windowHandle) { + throw new GLException("Error windowHandle 0, werr: "+GDI.GetLastError()); } - return res; - } - - public void unlockSurface() { - ProxySurface ns = (ProxySurface) getNativeSurface(); - ns.validateSurfaceLocked(); - AbstractGraphicsDevice adevice = ns.getGraphicsConfiguration().getNativeGraphicsConfiguration().getScreen().getDevice(); - - try { - if ( 0 != hdc && 0 != hwnd && ns.getSurfaceRecursionCount() == 0) { - GDI.ReleaseDC(hwnd, hdc); - hdc=0; - ns.setSurfaceHandle(hdc); - } - surface.unlockSurface(); - } finally { - adevice.unlock(); - } - } - - public void setSize(int width, int height) { - } - - public int getWidth() { - return 1; - } - - public int getHeight() { - return 1; + GLCapabilities caps = new GLCapabilities(glp); + WindowsWGLGraphicsConfiguration cfg = WindowsWGLGraphicsConfigurationFactory.createDefaultGraphicsConfiguration(caps, absScreen); + GDISurface ns = new GDISurface(cfg, windowHandle); + ns.setSize(width, height); + return new WindowsDummyWGLDrawable(factory, ns, handleWindowLifecycle); } public GLContext createContext(GLContext shareWith) { @@ -156,13 +94,7 @@ public class WindowsDummyWGLDrawable extends WindowsWGLDrawable { } protected void destroyImpl() { - if (hdc != 0) { - GDI.ReleaseDC(hwnd, hdc); - hdc = 0; - ProxySurface ns = (ProxySurface) getNativeSurface(); - ns.setSurfaceHandle(hdc); - } - if (hwnd != 0) { + if (handleHwndLifecycle && hwnd != 0) { GDI.ShowWindow(hwnd, GDI.SW_HIDE); GDI.DestroyDummyWindow(hwnd); hwnd = 0; diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLContext.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLContext.java index 845460c58..0e2575bd9 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLContext.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLContext.java @@ -44,18 +44,18 @@ import javax.media.nativewindow.AbstractGraphicsScreen; import javax.media.nativewindow.DefaultGraphicsScreen; import javax.media.nativewindow.NativeSurface; import javax.media.nativewindow.NativeWindowFactory; +import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLContext; import javax.media.opengl.GLDrawableFactory; import javax.media.opengl.GLException; import javax.media.opengl.GLProfile; -import jogamp.nativewindow.ProxySurface; +import jogamp.nativewindow.WrappedSurface; import jogamp.nativewindow.windows.GDI; import jogamp.opengl.GLContextShareSet; public class WindowsExternalWGLContext extends WindowsWGLContext { - private boolean firstMakeCurrent = true; private GLContext lastContext; private WindowsExternalWGLContext(Drawable drawable, long ctx, WindowsWGLGraphicsConfiguration cfg) { @@ -70,40 +70,38 @@ public class WindowsExternalWGLContext extends WindowsWGLContext { } protected static WindowsExternalWGLContext create(GLDrawableFactory factory, GLProfile glp) { - /** - * Added thorough debug code, since we currently have problems with this code with use case: - * - WinXP [32bit] - * - GDI (Software GL) - * - SWT - * However, it works on other combinations, eg Win7 [64bit], GDI, SWT, etc .. - */ if(DEBUG) { System.err.println("WindowsExternalWGLContext 0: werr: " + GDI.GetLastError()); } - long ctx = WGL.wglGetCurrentContext(); + final long ctx = WGL.wglGetCurrentContext(); if (0 == ctx) { throw new GLException("Error: attempted to make an external GLContext without a context current, werr " + GDI.GetLastError()); } - long hdc = WGL.wglGetCurrentDC(); + final long hdc = WGL.wglGetCurrentDC(); if (0 == hdc) { throw new GLException("Error: attempted to make an external GLDrawable without a drawable current, werr " + GDI.GetLastError()); } - int hdcType = GDI.GetObjectType(hdc); - if( GDI.OBJ_DC != hdcType ) { - // FIXME: Turns out in above use case (WinXP-32bit, GDI, SWT) the returned DC (not 0) is invalid! - throw new GLException("Error: current WGL DC ("+toHexString(hdc)+") is not a DC but: "+hdcType+", werr " + GDI.GetLastError()); - } - - int pfdID = GDI.GetPixelFormat(hdc); + AbstractGraphicsScreen aScreen = DefaultGraphicsScreen.createDefault(NativeWindowFactory.TYPE_WINDOWS); + WindowsWGLGraphicsConfiguration cfg; + final int pfdID = GDI.GetPixelFormat(hdc); if (0 == pfdID) { - throw new GLException("Error: attempted to make an external GLContext without a valid pixelformat, werr " + GDI.GetLastError()); + // This could have happened if the HDC was released right after the GL ctx made current (SWT), + // WinXP-32bit will not be able to use this HDC afterwards. + // Workaround: Use a fake default configuration + final int werr = GDI.GetLastError(); + cfg = WindowsWGLGraphicsConfigurationFactory.createDefaultGraphicsConfiguration(new GLCapabilities(GLProfile.getDefault()), aScreen); + if(DEBUG) { + System.err.println("WindowsExternalWGLContext invalid hdc/pfd werr "+werr+", using default cfg: " + cfg); + } + } else { + cfg = WindowsWGLGraphicsConfiguration.createFromCurrent(factory, hdc, pfdID, glp, aScreen, true); + if(DEBUG) { + System.err.println("WindowsExternalWGLContext valid hdc/pfd, retrieved cfg: " + cfg); + } } - - AbstractGraphicsScreen aScreen = DefaultGraphicsScreen.createDefault(NativeWindowFactory.TYPE_WINDOWS); - WindowsWGLGraphicsConfiguration cfg = WindowsWGLGraphicsConfiguration.createFromCurrent(factory, hdc, pfdID, glp, aScreen, true); - return new WindowsExternalWGLContext(new Drawable(factory, new ProxySurface(cfg, hdc)), ctx, cfg); + return new WindowsExternalWGLContext(new Drawable(factory, new WrappedSurface(cfg, hdc)), ctx, cfg); } public int makeCurrent() throws GLException { @@ -124,9 +122,6 @@ public class WindowsExternalWGLContext extends WindowsWGLContext { } protected void makeCurrentImpl(boolean newCreated) throws GLException { - if (firstMakeCurrent) { - firstMakeCurrent = false; - } } protected void releaseImpl() throws GLException { diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLDrawable.java index 742a42709..7666ae350 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLDrawable.java @@ -49,7 +49,7 @@ import javax.media.opengl.GLDrawableFactory; import javax.media.opengl.GLException; import javax.media.opengl.GLProfile; -import jogamp.nativewindow.ProxySurface; +import jogamp.nativewindow.WrappedSurface; import jogamp.nativewindow.windows.GDI; public class WindowsExternalWGLDrawable extends WindowsWGLDrawable { @@ -70,7 +70,7 @@ public class WindowsExternalWGLDrawable extends WindowsWGLDrawable { AbstractGraphicsScreen aScreen = DefaultGraphicsScreen.createDefault(NativeWindowFactory.TYPE_WINDOWS); WindowsWGLGraphicsConfiguration cfg = WindowsWGLGraphicsConfiguration.createFromCurrent(factory, hdc, pfdID, glp, aScreen, true); - return new WindowsExternalWGLDrawable(factory, new ProxySurface(cfg, hdc)); + return new WindowsExternalWGLDrawable(factory, new WrappedSurface(cfg, hdc)); } diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java index 2c078dd98..5afbb9218 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java @@ -51,6 +51,7 @@ import javax.media.nativewindow.AbstractGraphicsDevice; import javax.media.nativewindow.AbstractGraphicsScreen; import javax.media.nativewindow.DefaultGraphicsScreen; import javax.media.nativewindow.NativeSurface; +import javax.media.nativewindow.ProxySurface; import javax.media.nativewindow.NativeWindowFactory; import javax.media.nativewindow.windows.WindowsGraphicsDevice; import javax.media.nativewindow.AbstractGraphicsConfiguration; @@ -64,11 +65,11 @@ import javax.media.opengl.GLProfile; import com.jogamp.common.JogampRuntimeException; import com.jogamp.common.nio.PointerBuffer; import com.jogamp.common.util.ReflectionUtil; -import jogamp.nativewindow.ProxySurface; +import jogamp.nativewindow.WrappedSurface; import jogamp.nativewindow.windows.GDI; +import jogamp.nativewindow.windows.GDISurface; import jogamp.nativewindow.windows.RegisteredClassFactory; import jogamp.opengl.DesktopGLDynamicLookupHelper; -import jogamp.opengl.GLContextImpl; import jogamp.opengl.GLDrawableFactoryImpl; import jogamp.opengl.GLDrawableImpl; import jogamp.opengl.GLDynamicLookupHelper; @@ -228,7 +229,9 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { if (null == glp) { throw new GLException("Couldn't get default GLProfile for device: "+sharedDevice); } - WindowsDummyWGLDrawable sharedDrawable = WindowsDummyWGLDrawable.create(WindowsWGLDrawableFactory.this, glp, absScreen); + final int f_dim = 64; + long hwnd = GDI.CreateDummyWindow(0, 0, f_dim, f_dim); + WindowsDummyWGLDrawable sharedDrawable = WindowsDummyWGLDrawable.create(WindowsWGLDrawableFactory.this, glp, absScreen, hwnd, f_dim, f_dim, true); if (null == sharedDrawable) { throw new GLException("Couldn't create shared drawable for screen: "+absScreen+", "+glp); } @@ -434,9 +437,9 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { return false; } - protected final NativeSurface createOffscreenSurfaceImpl(AbstractGraphicsDevice device,GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser, int width, int height) { + protected final NativeSurface createOffscreenSurfaceImpl(AbstractGraphicsDevice device, GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser, int width, int height) { AbstractGraphicsScreen screen = DefaultGraphicsScreen.createDefault(NativeWindowFactory.TYPE_WINDOWS); - ProxySurface ns = new ProxySurface(WindowsWGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic( + WrappedSurface ns = new WrappedSurface(WindowsWGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic( capsChosen, capsRequested, chooser, screen) ); ns.setSize(width, height); return ns; diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11DummyGLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11DummyGLXDrawable.java index 202bba9e7..68bdb4ab8 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11DummyGLXDrawable.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11DummyGLXDrawable.java @@ -45,11 +45,11 @@ public class X11DummyGLXDrawable extends X11OnscreenGLXDrawable { */ public X11DummyGLXDrawable(X11GraphicsScreen screen, GLDrawableFactory factory, GLCapabilitiesImmutable caps) { super(factory, - new ProxySurface(X11GLXGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic( + new WrappedSurface(X11GLXGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic( caps, caps, null, screen))); this.realized = true; - ProxySurface ns = (ProxySurface) getNativeSurface(); + WrappedSurface ns = (WrappedSurface) getNativeSurface(); X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)ns.getGraphicsConfiguration().getNativeGraphicsConfiguration(); X11GraphicsDevice device = (X11GraphicsDevice) screen.getDevice(); diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java index 769d5f1da..c488fe5cf 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java @@ -44,10 +44,9 @@ import javax.media.nativewindow.*; import javax.media.nativewindow.x11.*; import javax.media.opengl.*; import jogamp.opengl.*; -import jogamp.nativewindow.ProxySurface; +import jogamp.nativewindow.WrappedSurface; public class X11ExternalGLXContext extends X11GLXContext { - private boolean firstMakeCurrent = true; private GLContext lastContext; private X11ExternalGLXContext(Drawable drawable, long ctx) { @@ -78,7 +77,7 @@ public class X11ExternalGLXContext extends X11GLXContext { GLX.glXQueryContext(display, ctx, GLX.GLX_FBCONFIG_ID, val, 0); X11GLXGraphicsConfiguration cfg = X11GLXGraphicsConfiguration.create(glp, x11Screen, val[0]); - ProxySurface ns = new ProxySurface(cfg); + WrappedSurface ns = new WrappedSurface(cfg); ns.setSurfaceHandle(drawable); return new X11ExternalGLXContext(new Drawable(factory, ns), ctx); } @@ -105,9 +104,6 @@ public class X11ExternalGLXContext extends X11GLXContext { } protected void makeCurrentImpl(boolean newCreated) throws GLException { - if (firstMakeCurrent) { - firstMakeCurrent = false; - } } protected void releaseImpl() throws GLException { diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXDrawable.java index 014992b88..eb286cdf0 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXDrawable.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXDrawable.java @@ -42,7 +42,7 @@ package jogamp.opengl.x11.glx; import javax.media.nativewindow.*; import javax.media.nativewindow.x11.*; import javax.media.opengl.*; -import jogamp.nativewindow.ProxySurface; +import jogamp.nativewindow.WrappedSurface; public class X11ExternalGLXDrawable extends X11GLXDrawable { @@ -83,7 +83,7 @@ public class X11ExternalGLXDrawable extends X11GLXDrawable { System.err.println("X11ExternalGLXDrawable: WARNING: forcing GLX_RGBA_TYPE for newly created contexts (current 0x"+Integer.toHexString(val[0])+")"); } } - ProxySurface ns = new ProxySurface(cfg); + WrappedSurface ns = new WrappedSurface(cfg); ns.setSurfaceHandle(drawable); ns.setSize(w, h); return new X11ExternalGLXDrawable(factory, ns); diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java index 44ade1513..755c078b9 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java @@ -49,7 +49,7 @@ import javax.media.opengl.*; import jogamp.opengl.*; import com.jogamp.common.JogampRuntimeException; import com.jogamp.common.util.*; -import jogamp.nativewindow.ProxySurface; +import jogamp.nativewindow.WrappedSurface; import jogamp.nativewindow.x11.*; public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { @@ -399,7 +399,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { return null; } - ProxySurface ns = new ProxySurface( + WrappedSurface ns = new WrappedSurface( X11GLXGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capsChosen, capsRequested, chooser, screen) ); if(ns != null) { ns.setSize(width, height); diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/awt/X11AWTGLXGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/x11/glx/awt/X11AWTGLXGraphicsConfigurationFactory.java index 55f1f034b..ee7dd280e 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/awt/X11AWTGLXGraphicsConfigurationFactory.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/awt/X11AWTGLXGraphicsConfigurationFactory.java @@ -96,13 +96,12 @@ public class X11AWTGLXGraphicsConfigurationFactory extends GLGraphicsConfigurati System.err.println(Thread.currentThread().getName() + " - X11AWTGLXGraphicsConfigurationFactory: using AWT X11 display 0x"+Long.toHexString(displayHandle)); } /** - * May cause an exception on NVidia X11 Display destruction, - * when destruction happen immediately after construction, around 10ms. - * However, the own Display handle is required for AMD gpus. + * Using the AWT display handle works fine with NVidia and AMD drivers today 2011-02-22, + * hence no need for our own display instance anymore. + String name = X11Util.XDisplayString(displayHandle); + displayHandle = X11Util.createDisplay(name); + owner = true; */ - String name = X11Util.XDisplayString(displayHandle); - displayHandle = X11Util.createDisplay(name); - owner = true; } ((AWTGraphicsDevice)awtScreen.getDevice()).setSubType(NativeWindowFactory.TYPE_X11, displayHandle); X11GraphicsDevice x11Device = new X11GraphicsDevice(displayHandle, AbstractGraphicsDevice.DEFAULT_UNIT); |