From 60da84a5ca8fa5e74e995ad0343c8967ba9463a5 Mon Sep 17 00:00:00 2001 From: Sven Gothel <sgothel@jausoft.com> Date: Fri, 16 Apr 2010 05:40:09 +0200 Subject: Fix broken Offscreen/Pbuffer query introduced in bd4904fb04ab2168aeaf76e74385b3991429289a - Have to set the requested values in GLCapabilities if not relaxed and valid, otherwise the result is always onscreen, since the onscreen/pbuffer bits can be set for the same config. - Let GLContext implementations throw an Exception in case of no surface handle. JUnit Tests: - MiscUtils.setField -> MiscUtils.setFieldIfExists To allow _not_ throwing an exception :) --- .../com/jogamp/opengl/impl/windows/wgl/WindowsWGLContext.java | 5 +---- .../opengl/impl/windows/wgl/WindowsWGLGraphicsConfiguration.java | 5 ++++- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/jogl/classes/com/jogamp/opengl/impl/windows') 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 5b6d65f62..7f9459a48 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 @@ -282,10 +282,7 @@ public class WindowsWGLContext extends GLContextImpl { protected int makeCurrentImpl() throws GLException { if (drawable.getNativeWindow().getSurfaceHandle() == 0) { - if (DEBUG) { - System.err.println("drawable not properly initialized"); - } - return CONTEXT_NOT_CURRENT; + throw new GLException("drawable not properly initialized: "+drawable); } boolean created = false; if (hglrc == 0) { diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfiguration.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfiguration.java index 15823b6dc..aed4012a4 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfiguration.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfiguration.java @@ -428,7 +428,10 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio boolean relaxed, boolean onscreen, boolean usePBuffer) { GLCapabilities res = new GLCapabilities(glp); int drawableTypeBits = WGLConfig2DrawableTypeBits(iattribs, niattribs, iresults); - if(WGLConfigDrawableTypeVerify(drawableTypeBits, onscreen, usePBuffer) || relaxed) { + if(WGLConfigDrawableTypeVerify(drawableTypeBits, onscreen, usePBuffer)) { + res.setOnscreen(onscreen); + res.setPBuffer(usePBuffer); + } else if(relaxed) { res.setOnscreen( 0 != (drawableTypeBits & WINDOW_BIT) ); res.setPBuffer ( 0 != (drawableTypeBits & PBUFFER_BIT) ); } else { -- cgit v1.2.3