diff options
Diffstat (limited to 'src')
6 files changed, 18 insertions, 8 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/GLContextImpl.java b/src/jogl/classes/com/jogamp/opengl/impl/GLContextImpl.java index fd8c85398..e5f8211c3 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/GLContextImpl.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/GLContextImpl.java @@ -276,10 +276,7 @@ public abstract class GLContextImpl extends GLContext { } if (!isCreated()) { - // verify if the drawable if valid .. - if (0 == getGLDrawable().getNativeWindow().getSurfaceHandle()) { - throw new GLException("drawable has invalid surface handle: "+getGLDrawable()); - } + // verify if the drawable has chosen Capabilities if (null == getGLDrawable().getChosenGLCapabilities()) { throw new GLException("drawable has no chosen GLCapabilities: "+getGLDrawable()); } diff --git a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLContext.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLContext.java index 12d713036..144c4692e 100755 --- a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLContext.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLContext.java @@ -91,7 +91,10 @@ public abstract class EGLContext extends GLContextImpl { protected int makeCurrentImpl() throws GLException { if(EGL.EGL_NO_DISPLAY==((EGLDrawable)drawable).getDisplay() ) { - throw new GLException("drawable not properly initialized: "+drawable); + throw new GLException("drawable not properly initialized, NO DISPLAY: "+drawable); + } + if (0 == drawable.getNativeWindow().getSurfaceHandle()) { + throw new GLException("drawable has invalid surface handle: "+drawable); } boolean created = false; if (eglContext == 0) { diff --git a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLContext.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLContext.java index 4e97e37ce..e786dfde9 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLContext.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLContext.java @@ -164,6 +164,9 @@ public abstract class MacOSXCGLContext extends GLContextImpl protected int makeCurrentImpl() throws GLException { boolean created = false; + if (0 == drawable.getNativeWindow().getSurfaceHandle()) { + throw new GLException("drawable has invalid surface handle: "+drawable); + } if ( 0 == cglContext && 0 == nsContext) { create(); created = 0 != cglContext || 0 != nsContext ; 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 ad38f26c9..e0a255ad9 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 @@ -296,8 +296,8 @@ public class WindowsWGLContext extends GLContextImpl { } protected int makeCurrentImpl() throws GLException { - if (drawable.getNativeWindow().getSurfaceHandle() == 0) { - throw new GLException("drawable not properly initialized: "+drawable); + if (0 == drawable.getNativeWindow().getSurfaceHandle()) { + throw new GLException("drawable has invalid surface handle: "+drawable); } boolean created = false; if (hglrc == 0) { diff --git a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXContext.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXContext.java index 165f89dcc..712ac029a 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXContext.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXContext.java @@ -333,12 +333,15 @@ public abstract class X11GLXContext extends GLContextImpl { // Note: Usually the surface shall be locked within [makeCurrent .. swap .. release] protected int makeCurrentImpl() throws GLException { - int lockRes = drawable.lockSurface(); boolean exceptionOccurred = false; + int lockRes = drawable.lockSurface(); try { if (lockRes == NativeWindow.LOCK_SURFACE_NOT_READY) { return CONTEXT_NOT_CURRENT; } + if (0 == drawable.getNativeWindow().getSurfaceHandle()) { + throw new GLException("drawable has invalid surface handle: "+drawable); + } return makeCurrentImplAfterLock(); } catch (RuntimeException e) { exceptionOccurred = true; diff --git a/src/newt/native/NewtMacWindow.h b/src/newt/native/NewtMacWindow.h index 560cfe408..4f0561dd5 100644 --- a/src/newt/native/NewtMacWindow.h +++ b/src/newt/native/NewtMacWindow.h @@ -55,7 +55,11 @@ @end +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 @interface NewtMacWindow : NSWindow <NSWindowDelegate> +#else +@interface NewtMacWindow : NSWindow +#endif { } |