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. --- src/jogl/classes/com/jogamp/opengl/impl/GLContextImpl.java | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/jogl/classes/com/jogamp/opengl/impl/GLContextImpl.java') diff --git a/src/jogl/classes/com/jogamp/opengl/impl/GLContextImpl.java b/src/jogl/classes/com/jogamp/opengl/impl/GLContextImpl.java index 826523a5c..fd8c85398 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/GLContextImpl.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/GLContextImpl.java @@ -275,6 +275,16 @@ public abstract class GLContextImpl extends GLContext { GLWorkerThread.invokeLater(new Runnable() { public void run() {} }); } + if (!isCreated()) { + // verify if the drawable if valid .. + if (0 == getGLDrawable().getNativeWindow().getSurfaceHandle()) { + throw new GLException("drawable has invalid surface handle: "+getGLDrawable()); + } + if (null == getGLDrawable().getChosenGLCapabilities()) { + throw new GLException("drawable has no chosen GLCapabilities: "+getGLDrawable()); + } + } + lock.lock(); int res = 0; try { -- cgit v1.2.3