From b5492631bbcfe23f9a6a292bfc5f53c7a7b8caec Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sat, 17 Dec 2011 21:54:36 +0100 Subject: MacOSXCGLContext Offscreen Layer: Throw exception in case drawable is not realized or texture size is invalid. --- src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/jogl/classes/jogamp/opengl/macosx/cgl') diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java index 166876b24..77da2650f 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java @@ -477,9 +477,12 @@ public abstract class MacOSXCGLContext extends GLContextImpl texHeight = drawable.getHeight(); } nsOpenGLLayer = CGL.createNSOpenGLLayer(ctx, nsOpenGLLayerPFmt, drawable.getHandle(), fixedCaps.isBackgroundOpaque(), texWidth, texHeight); + if(0>=texWidth || 0>=texHeight || !drawable.isRealized()) { + throw new GLException("Drawable not realized yet or invalid texture size, texSize "+texWidth+"x"+texHeight+", "+drawable); + } if (DEBUG) { - System.err.println("NS create nsOpenGLLayer "+toHexString(nsOpenGLLayer)); - } + System.err.println("NS create nsOpenGLLayer "+toHexString(nsOpenGLLayer)+", texSize "+texWidth+"x"+texHeight+", "+drawable); + } backingLayerHost.attachSurfaceLayer(nsOpenGLLayer); } } finally { -- cgit v1.2.3