diff options
Diffstat (limited to 'src/jogl/classes/com/jogamp/opengl/impl/windows')
7 files changed, 27 insertions, 26 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsDummyWGLDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsDummyWGLDrawable.java index 299adec50..9a86f7d08 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsDummyWGLDrawable.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsDummyWGLDrawable.java @@ -89,7 +89,7 @@ public class WindowsDummyWGLDrawable extends WindowsWGLDrawable { return new WindowsWGLContext(this, shareWith); } - public void destroy() { + protected void destroyImpl() { if (hdc != 0) { GDI.ReleaseDC(hwnd, hdc); hdc = 0; diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsOffscreenWGLDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsOffscreenWGLDrawable.java index ea02a4919..f58d2f4bc 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsOffscreenWGLDrawable.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsOffscreenWGLDrawable.java @@ -48,7 +48,7 @@ public class WindowsOffscreenWGLDrawable extends WindowsWGLDrawable { private long origbitmap; private long hbitmap; - public WindowsOffscreenWGLDrawable(GLDrawableFactory factory, NativeSurface target) { + protected WindowsOffscreenWGLDrawable(GLDrawableFactory factory, NativeSurface target) { super(factory, target, true); create(); } @@ -57,7 +57,7 @@ public class WindowsOffscreenWGLDrawable extends WindowsWGLDrawable { if(realized) { create(); } else { - destroy(); + destroyImpl(); } } @@ -113,11 +113,10 @@ public class WindowsOffscreenWGLDrawable extends WindowsWGLDrawable { hdc = 0; throw new GLException("Error selecting bitmap into new device context"); } - config.updateGraphicsConfiguration(getFactory(), ns); } - public void destroy() { + protected void destroyImpl() { NativeSurface ns = getNativeSurface(); if (ns.getSurfaceHandle() != 0) { // Must destroy bitmap and device context diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsPbufferWGLDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsPbufferWGLDrawable.java index 5708aa6bb..0198f334c 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsPbufferWGLDrawable.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsPbufferWGLDrawable.java @@ -72,7 +72,7 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable { if(realized) { throw new GLException("Recreation via setRealized not supported."); } else { - destroy(); + destroyImpl(); } } @@ -80,7 +80,7 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable { return new WindowsPbufferWGLContext(this, shareWith); } - public void destroy() { + protected void destroyImpl() { NativeSurface ns = getNativeSurface(); if(0!=buffer) { WGLExt wglExt = cachedWGLExt; diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLContext.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLContext.java index c80e46cc2..65a8e8ac3 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLContext.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLContext.java @@ -298,7 +298,7 @@ public class WindowsWGLContext extends GLContextImpl { if (!wglMakeContextCurrent(drawable.getHandle(), drawableRead.getHandle(), contextHandle)) { throw new GLException("Error making context current: 0x" + toHexString(contextHandle) + ", werr: 0x" + Integer.toHexString(GDI.GetLastError()) + ", " + this); } else { - if (DEBUG && VERBOSE) { + if (DEBUG && (VERBOSE || newCreated)) { System.err.println(getThreadName() + ": wglMakeCurrent(hdc " + toHexString(drawable.getHandle()) + ", contextHandle " + toHexString(contextHandle) + ") succeeded"); } diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java index aafea36fd..409e914b0 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java @@ -82,9 +82,10 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { new WindowsWGLGraphicsConfigurationFactory(); try { ReflectionUtil.createInstance("com.jogamp.opengl.impl.windows.wgl.awt.WindowsAWTWGLGraphicsConfigurationFactory", - new Object[] {}, getClass().getClassLoader()); + null, getClass().getClassLoader()); } catch (JogampRuntimeException jre) { /* n/a .. */ } + NativeWindowFactory.getDefaultToolkitLock().lock(); // OK try { sharedDrawable = new WindowsDummyWGLDrawable(this, null); WindowsWGLContext ctx = (WindowsWGLContext) sharedDrawable.createContext(null); @@ -94,6 +95,8 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { sharedContext = ctx; } catch (Throwable t) { throw new GLException("WindowsWGLDrawableFactory - Could not initialize shared resources", t); + } finally { + NativeWindowFactory.getDefaultToolkitLock().unlock(); // OK } if(null==sharedContext) { throw new GLException("WindowsWGLDrawableFactory - Shared Context is null"); @@ -135,14 +138,14 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { } } - public GLDrawableImpl createOnscreenDrawable(NativeSurface target) { + protected GLDrawableImpl createOnscreenDrawableImpl(NativeSurface target) { if (target == null) { throw new IllegalArgumentException("Null target"); } return new WindowsOnscreenWGLDrawable(this, target); } - protected GLDrawableImpl createOffscreenDrawable(NativeSurface target) { + protected GLDrawableImpl createOffscreenDrawableImpl(NativeSurface target) { if (target == null) { throw new IllegalArgumentException("Null target"); } @@ -185,7 +188,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { return (GLDrawableImpl) returnList.get(0); } - protected NativeSurface createOffscreenSurface(GLCapabilities capabilities, GLCapabilitiesChooser chooser, int width, int height) { + protected NativeSurface createOffscreenSurfaceImpl(GLCapabilities capabilities, GLCapabilitiesChooser chooser, int width, int height) { AbstractGraphicsScreen screen = DefaultGraphicsScreen.createDefault(); ProxySurface ns = new ProxySurface(WindowsWGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic( capabilities, chooser, screen) ); @@ -193,7 +196,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { return ns; } - public GLContext createExternalGLContext() { + protected GLContext createExternalGLContextImpl() { return WindowsExternalWGLContext.create(this, null); } @@ -201,7 +204,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { return true; } - public GLDrawable createExternalGLDrawable() { + protected GLDrawable createExternalGLDrawableImpl() { return WindowsExternalWGLDrawable.create(this, null); } diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java index ae12d254a..c8ecb2b72 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java @@ -52,9 +52,8 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio GraphicsConfigurationFactory.registerFactory(javax.media.nativewindow.windows.WindowsGraphicsDevice.class, this); } - public AbstractGraphicsConfiguration chooseGraphicsConfiguration(Capabilities capabilities, - CapabilitiesChooser chooser, - AbstractGraphicsScreen absScreen) { + protected AbstractGraphicsConfiguration chooseGraphicsConfigurationImpl( + Capabilities capabilities, CapabilitiesChooser chooser, AbstractGraphicsScreen absScreen) { GLCapabilities caps = (GLCapabilities)capabilities; return chooseGraphicsConfigurationStatic(caps, chooser, absScreen); } @@ -107,10 +106,12 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio GLProfile glProfile = capabilities.getGLProfile(); long hdc = ns.getSurfaceHandle(); - if (DEBUG) { - Exception ex = new Exception("WindowsWGLGraphicsConfigurationFactory got HDC "+toHexString(hdc)); + if(0==hdc) { + throw new GLException("Error: HDC is null "+toHexString(hdc)); + } + if(DEBUG) { + Exception ex = new Exception("Info: WindowsWGLGraphicsConfigurationFactory got HDC "+toHexString(hdc)); ex.printStackTrace(); - System.err.println("WindowsWGLGraphicsConfigurationFactory got NW "+ns); } PIXELFORMATDESCRIPTOR pfd = null; @@ -120,7 +121,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio if (onscreen) { if ((pixelFormat = GDI.GetPixelFormat(hdc)) != 0) { - // Pixelformat already set by either + // Pixelformat already set by either // - a previous updateGraphicsConfiguration() call on the same HDC, // - the graphics driver, copying the HDC's pixelformat to the new one, // - or the Java2D/OpenGL pipeline's configuration diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java index 02cfd14c3..26704acf3 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java @@ -53,9 +53,8 @@ public class WindowsAWTWGLGraphicsConfigurationFactory extends GraphicsConfigura GraphicsConfigurationFactory.registerFactory(javax.media.nativewindow.awt.AWTGraphicsDevice.class, this); } - public AbstractGraphicsConfiguration chooseGraphicsConfiguration(Capabilities capabilities, - CapabilitiesChooser chooser, - AbstractGraphicsScreen absScreen) { + protected AbstractGraphicsConfiguration chooseGraphicsConfigurationImpl( + Capabilities capabilities, CapabilitiesChooser chooser, AbstractGraphicsScreen absScreen) { GraphicsDevice device = null; if (absScreen != null && !(absScreen instanceof AWTGraphicsScreen)) { @@ -107,8 +106,7 @@ public class WindowsAWTWGLGraphicsConfigurationFactory extends GraphicsConfigura if(DEBUG) { System.err.println("WindowsAWTWGLGraphicsConfigurationFactory: chosen "+winConfig); } - - // FIXME: we have nothing to match .. so choose the default + return new AWTGraphicsConfiguration(awtScreen, winConfig.getChosenCapabilities(), winConfig.getRequestedCapabilities(), gc, winConfig); } } |