From 897c7248f9895d828542d524b211b74efcc715d2 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Tue, 27 Apr 2010 19:45:43 +0200 Subject: JOGL Error Handling - Catch invalid drawable for all impl. at GLContextImpl if !created yet - GLDrawableFactoryImpl (X11/WGL) catch and fwd Throwable properly - GLProfile catch LinkageError and handle it In case of nothing is available, a final ExceptionInInitializer will be thrown, with the produced GLException that no GLProfile is available. --- .../opengl/impl/windows/wgl/WindowsWGLContext.java | 3 --- .../impl/windows/wgl/WindowsWGLDrawableFactory.java | 18 +++++++++++------- 2 files changed, 11 insertions(+), 10 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 360bddd74..ad38f26c9 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 @@ -203,9 +203,6 @@ public class WindowsWGLContext extends GLContextImpl { WindowsWGLDrawableFactory factory = (WindowsWGLDrawableFactory)drawable.getFactoryImpl(); GLCapabilities glCaps = drawable.getChosenGLCapabilities(); - if (drawable.getNativeWindow().getSurfaceHandle() == 0) { - throw new GLException("Internal error: attempted to create OpenGL context without an associated drawable"); - } // Windows can set up sharing of display lists after creation time WindowsWGLContext other = (WindowsWGLContext) GLContextShareSet.getShareContext(this); long share = 0; 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 ee4592adf..70513f82d 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 @@ -73,14 +73,18 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl implements loadOpenGL32Library(); - sharedDrawable = new WindowsDummyWGLDrawable(this, null); - WindowsWGLContext ctx = (WindowsWGLContext) sharedDrawable.createContext(null); - ctx.makeCurrent(); - canCreateGLPbuffer = ctx.getGL().isExtensionAvailable("GL_ARB_pbuffer"); - ctx.release(); - sharedContext = ctx; + try { + sharedDrawable = new WindowsDummyWGLDrawable(this, null); + WindowsWGLContext ctx = (WindowsWGLContext) sharedDrawable.createContext(null); + ctx.makeCurrent(); + canCreateGLPbuffer = ctx.getGL().isExtensionAvailable("GL_ARB_pbuffer"); + ctx.release(); + sharedContext = ctx; + } catch (Throwable t) { + throw new GLException("WindowsWGLDrawableFactory - Could not initialize shared resources", t); + } if(null==sharedContext) { - throw new GLException("Couldn't init shared resources"); + throw new GLException("WindowsWGLDrawableFactory - Shared Context is null"); } if (DEBUG) { System.err.println("!!! SharedContext: "+sharedContext+", pbuffer supported "+canCreateGLPbuffer); -- cgit v1.2.3