summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-09-16 13:27:06 +0200
committerSven Gothel <[email protected]>2012-09-16 13:27:06 +0200
commite30c2c7d06847889d961d12b50e77e4dfd6e525f (patch)
treee0d280af948f52088e2b072bacf3b6b6469cf456 /src
parent33896a42dcec55d52030fae33e64fa966c67f91d (diff)
OSX: Capture 'invalid drawable' message cause by NSOpenGLContext::setView(NULL || incomplete-view) ; Add missing [ctx release] in MyNSOpenGLLayer ; Misc
NSOpenGLContext::setView(NULL || incomplete-view) was called on 2 occasions: [1] - MacOSXCGLContext native createContext [2] - NSOpenGLLayer internals For [1], we simply don't call setView(..) ourselfs in case view is NULL or incomplete (invisible) For [2], we need to wrap the class 'MyNSOpenGLContext:NSOpenGLContext' and capture setView(NULL) ++ Add missing [ctx release] in MyNSOpenGLLayer, otherwise resource won't get dealloc'ed +++ Misc: - MacOSXCGLContext. contextRealized(true): set pbuffer -> ctx, otherwise 1st makeCurrent call will not catch it - MacOSXOnscreenCGLContext: don't add ContextUpdater to invisible ProxySurface's (dummy window)
Diffstat (limited to 'src')
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java15
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLContext.java19
-rw-r--r--src/jogl/native/macosx/MacOSXWindowSystemInterface-calayer.m65
-rw-r--r--src/jogl/native/macosx/MacOSXWindowSystemInterface.m43
-rw-r--r--src/nativewindow/native/macosx/OSXmisc.m2
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestOffscreenLayer01GLCanvasAWT.java12
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestOffscreenLayer02NewtCanvasAWT.java12
7 files changed, 142 insertions, 26 deletions
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
index ec29558d1..e04955d87 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
@@ -490,9 +490,9 @@ public abstract class MacOSXCGLContext extends GLContextImpl
}
backingLayerHost = NativeWindowFactory.getOffscreenLayerSurface(surface, true);
- boolean allowIncompleteView = null != backingLayerHost;
- if( !allowIncompleteView && surface instanceof ProxySurface ) {
- allowIncompleteView = ((ProxySurface)surface).containsUpstreamOptionBits( ProxySurface.OPT_UPSTREAM_WINDOW_INVISIBLE );
+ boolean incompleteView = null != backingLayerHost;
+ if( !incompleteView && surface instanceof ProxySurface ) {
+ incompleteView = ((ProxySurface)surface).containsUpstreamOptionBits( ProxySurface.OPT_UPSTREAM_WINDOW_INVISIBLE );
}
long pixelFormat = MacOSXCGLGraphicsConfiguration.GLCapabilities2NSPixelFormat(chosenCaps, ctp, major, minor);
if (pixelFormat == 0) {
@@ -514,7 +514,7 @@ public abstract class MacOSXCGLContext extends GLContextImpl
screenVSyncTimeout = 1000000f / sRefreshRate;
if(DEBUG) {
System.err.println("NS create OSX>=lion "+isLionOrLater);
- System.err.println("NS create allowIncompleteView: "+allowIncompleteView);
+ System.err.println("NS create incompleteView: "+incompleteView);
System.err.println("NS create backingLayerHost: "+backingLayerHost);
System.err.println("NS create share: "+share);
System.err.println("NS create drawable type: "+drawable.getClass().getName());
@@ -546,7 +546,7 @@ public abstract class MacOSXCGLContext extends GLContextImpl
int[] viewNotReady = new int[1];
// Try to allocate a context with this
ctx = CGL.createContext(share,
- nsViewHandle, allowIncompleteView,
+ nsViewHandle, incompleteView,
pixelFormat,
chosenCaps.isBackgroundOpaque(),
viewNotReady, 0);
@@ -603,6 +603,9 @@ public abstract class MacOSXCGLContext extends GLContextImpl
} else if( chosenCaps.isPBuffer() && CGL.isNSOpenGLPixelBuffer(drawableHandle) ) {
texID = 0;
lastPBufferHandle = drawableHandle;
+ if(0 != drawableHandle) { // complete 'validatePBufferConfig(..)' procedure
+ CGL.setContextPBuffer(ctx, drawableHandle);
+ }
} else {
throw new GLException("BackingLayerHost w/ unknown handle (!FBO, !PBuffer): "+drawable);
}
@@ -648,7 +651,7 @@ public abstract class MacOSXCGLContext extends GLContextImpl
private final void validatePBufferConfig(long ctx) {
final GLCapabilitiesImmutable chosenCaps = drawable.getChosenGLCapabilities();
final long drawableHandle = drawable.getHandle();
- if(chosenCaps.isPBuffer() && CGL.isNSOpenGLPixelBuffer(drawableHandle) && lastPBufferHandle != drawableHandle) {
+ if( chosenCaps.isPBuffer() && lastPBufferHandle != drawableHandle && CGL.isNSOpenGLPixelBuffer(drawableHandle) ) {
// Must associate the pbuffer with our newly-created context
lastPBufferHandle = drawableHandle;
if(0 != drawableHandle) {
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLContext.java
index e344fd461..447d18f68 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLContext.java
@@ -39,6 +39,8 @@
package jogamp.opengl.macosx.cgl;
+import javax.media.nativewindow.NativeSurface;
+import javax.media.nativewindow.ProxySurface;
import javax.media.opengl.GLContext;
import javax.media.opengl.GLException;
@@ -60,7 +62,7 @@ public class MacOSXOnscreenCGLContext extends MacOSXCGLContext {
@Override
protected void drawableUpdatedNotify() throws GLException {
final int w = drawable.getWidth();
- final int h = drawable.getHeight();
+ final int h = drawable.getHeight();
final boolean updateContext = ( 0!=updateHandle && CGL.updateContextNeedsUpdate(updateHandle) ) ||
w != lastWidth || h != lastHeight;
if(updateContext) {
@@ -82,9 +84,18 @@ public class MacOSXOnscreenCGLContext extends MacOSXCGLContext {
if(0 != updateHandle) {
throw new InternalError("XXX1");
}
- updateHandle = CGL.updateContextRegister(contextHandle, drawable.getHandle());
- if(0 == updateHandle) {
- throw new InternalError("XXX2");
+ final boolean incompleteView;
+ final NativeSurface surface = drawable.getNativeSurface();
+ if( surface instanceof ProxySurface ) {
+ incompleteView = ((ProxySurface)surface).containsUpstreamOptionBits( ProxySurface.OPT_UPSTREAM_WINDOW_INVISIBLE );
+ } else {
+ incompleteView = false;
+ }
+ if(!incompleteView) {
+ updateHandle = CGL.updateContextRegister(contextHandle, drawable.getHandle());
+ if(0 == updateHandle) {
+ throw new InternalError("XXX2");
+ }
}
}
return res;
diff --git a/src/jogl/native/macosx/MacOSXWindowSystemInterface-calayer.m b/src/jogl/native/macosx/MacOSXWindowSystemInterface-calayer.m
index 63323b76d..f3495efff 100644
--- a/src/jogl/native/macosx/MacOSXWindowSystemInterface-calayer.m
+++ b/src/jogl/native/macosx/MacOSXWindowSystemInterface-calayer.m
@@ -25,6 +25,56 @@
//
// #define DBG_PERF 1
+/**
+ * Capture setView(NULL), which produces a 'invalid drawable' message
+ *
+ * Also track lifecycle via DBG_PRINT messages, if VERBOSE is enabled!
+ */
+@interface MyNSOpenGLContext: NSOpenGLContext
+{
+}
+- (id)initWithFormat:(NSOpenGLPixelFormat *)format shareContext:(NSOpenGLContext *)share;
+- (void)setView:(NSView *)view;
+- (void)update;
+- (void)dealloc;
+
+@end
+
+@implementation MyNSOpenGLContext
+
+- (id)initWithFormat:(NSOpenGLPixelFormat *)format shareContext:(NSOpenGLContext *)share
+{
+ DBG_PRINT("MyNSOpenGLContext.initWithFormat.0: format %p, share %p\n", format, share);
+ MyNSOpenGLContext * o = [super initWithFormat:format shareContext:share];
+ DBG_PRINT("MyNSOpenGLContext.initWithFormat.X: new %p\n", o);
+ return o;
+}
+
+- (void)setView:(NSView *)view
+{
+ DBG_PRINT("MyNSOpenGLContext.setView: this.0 %p, view %p\n", self, view);
+ if(NULL != view) {
+ [super setView:view];
+ }
+ DBG_PRINT("MyNSOpenGLContext.setView.X\n");
+}
+
+- (void)update
+{
+ DBG_PRINT("MyNSOpenGLContext.update: this.0 %p, view %p\n", self, [self view]);
+ [super update];
+ DBG_PRINT("MyNSOpenGLContext.update.X\n");
+}
+
+- (void)dealloc
+{
+ DBG_PRINT("MyNSOpenGLContext.dealloc: this.0 %p\n", self);
+ [super dealloc];
+ DBG_PRINT("MyNSOpenGLContext.dealloc.X: %p\n", self);
+}
+
+@end
+
@interface MyNSOpenGLLayer: NSOpenGLLayer
{
@private
@@ -204,6 +254,8 @@ static const GLfloat gl_verts[] = {
[self setOpaque: opaque ? YES : NO];
+#ifdef VERBOSE_ON
+ CGRect lRect = [self bounds];
if(NULL != pbuffer) {
DBG_PRINT("MyNSOpenGLLayer::init (pbuffer) %p, ctx %p, pfmt %p, pbuffer %p, opaque %d, pbuffer %dx%d -> tex %dx%d, bounds: %lf/%lf %lfx%lf (refcnt %d)\n",
self, parentCtx, parentPixelFmt, pbuffer, opaque, [pbuffer pixelsWide], [pbuffer pixelsHigh], texWidth, texHeight,
@@ -213,6 +265,7 @@ static const GLfloat gl_verts[] = {
self, parentCtx, parentPixelFmt, opaque, (int)textureID, texWidth, texHeight,
lRect.origin.x, lRect.origin.y, lRect.size.width, lRect.size.height, (int)[self retainCount]);
}
+#endif
return self;
}
@@ -293,9 +346,10 @@ static const GLfloat gl_verts[] = {
- (NSOpenGLContext *)openGLContextForPixelFormat:(NSOpenGLPixelFormat *)pixelFormat
{
- NSOpenGLContext * nctx = [[NSOpenGLContext alloc] initWithFormat:pixelFormat shareContext:parentCtx];
- DBG_PRINT("MyNSOpenGLLayer::openGLContextForPixelFormat: %p (refcnt %d) - pfmt %p, parent %p -> new-ctx %p\n",
- self, (int)[self retainCount], pixelFormat, parentCtx, nctx);
+ DBG_PRINT("MyNSOpenGLLayer::openGLContextForPixelFormat.0: %p (refcnt %d) - pfmt %p, parent %p\n",
+ self, (int)[self retainCount], pixelFormat, parentCtx);
+ NSOpenGLContext * nctx = [[MyNSOpenGLContext alloc] initWithFormat:pixelFormat shareContext:parentCtx];
+ DBG_PRINT("MyNSOpenGLLayer::openGLContextForPixelFormat.X: new-ctx %p\n", nctx);
return nctx;
}
@@ -324,7 +378,7 @@ static const GLfloat gl_verts[] = {
if(NULL!=context) {
[context makeCurrentContext];
- DBG_PRINT("MyNSOpenGLLayer::deallocPBuffer (with ctx) %p (refcnt %d) - context %p, pbuffer %p, texID %d\n", self, (int)[self retainCount], context, pbuffer, (int)texureID);
+ DBG_PRINT("MyNSOpenGLLayer::deallocPBuffer (with ctx) %p (refcnt %d) - context %p, pbuffer %p, texID %d\n", self, (int)[self retainCount], context, pbuffer, (int)textureID);
if( 0 != textureID ) {
glDeleteTextures(1, &textureID);
@@ -333,7 +387,7 @@ static const GLfloat gl_verts[] = {
[context clearDrawable];
} else {
- DBG_PRINT("MyNSOpenGLLayer::deallocPBuffer (w/o ctx) %p (refcnt %d) - context %p, pbuffer %p, texID %d\n", self, (int)[self retainCount], context, pbuffer, (int)texureID);
+ DBG_PRINT("MyNSOpenGLLayer::deallocPBuffer (w/o ctx) %p (refcnt %d) - context %p, pbuffer %p, texID %d\n", self, (int)[self retainCount], context, pbuffer, (int)textureID);
}
pbuffer = NULL;
[self setTextureID: 0];
@@ -346,6 +400,7 @@ static const GLfloat gl_verts[] = {
pthread_mutex_lock(&renderLock);
[self disableAnimation];
[self deallocPBuffer];
+ [[self openGLContext] release];
[self release];
DBG_PRINT("MyNSOpenGLLayer::releaseLayer.X: %p (refcnt %d)\n", self, (int)[self retainCount]);
pthread_mutex_unlock(&renderLock);
diff --git a/src/jogl/native/macosx/MacOSXWindowSystemInterface.m b/src/jogl/native/macosx/MacOSXWindowSystemInterface.m
index becd41bb2..48807ee29 100644
--- a/src/jogl/native/macosx/MacOSXWindowSystemInterface.m
+++ b/src/jogl/native/macosx/MacOSXWindowSystemInterface.m
@@ -446,7 +446,7 @@ NSOpenGLPixelFormat* createPixelFormat(int* iattrs, int niattrs, int* ivalues) {
NSOpenGLPixelFormat* fmt = [[NSOpenGLPixelFormat alloc] initWithAttributes:attribs];
// if(fmt == nil) { fallback to a [NSOpenGLView defaultPixelFormat] crashed (SIGSEGV) on 10.6.7/NV }
- DBG_PRINT("createPixelFormat.X: pfmt %p\n", fmt);
+ DBG_PRINT("\ncreatePixelFormat.X: pfmt %p\n", fmt);
[pool release];
return fmt;
@@ -503,7 +503,7 @@ NSView* getNSView(NSOpenGLContext* ctx) {
NSOpenGLContext* createContext(NSOpenGLContext* share,
NSView* view,
- Bool allowIncompleteView,
+ Bool incompleteView,
NSOpenGLPixelFormat* fmt,
Bool opaque,
int* viewNotReady)
@@ -512,13 +512,13 @@ NSOpenGLContext* createContext(NSOpenGLContext* share,
getRendererInfo();
- DBG_PRINT("createContext.0: share %p, view %p, allowIncompleteView %d, pixfmt %p, opaque %d\n",
- share, view, (int)allowIncompleteView, fmt, opaque);
+ DBG_PRINT("createContext.0: share %p, view %p, incompleteView %d, pixfmt %p, opaque %d\n",
+ share, view, (int)incompleteView, fmt, opaque);
if (view != nil) {
Bool viewReady = true;
- if(!allowIncompleteView) {
+ if(!incompleteView) {
if ([view lockFocusIfCanDraw] == NO) {
DBG_PRINT("createContext.1 [view lockFocusIfCanDraw] failed\n");
viewReady = false;
@@ -527,7 +527,7 @@ NSOpenGLContext* createContext(NSOpenGLContext* share,
if(viewReady) {
NSRect frame = [view frame];
if ((frame.size.width == 0) || (frame.size.height == 0)) {
- if(!allowIncompleteView) {
+ if(!incompleteView) {
[view unlockFocus];
}
DBG_PRINT("createContext.2 view.frame size %dx%d\n", (int)frame.size.width, (int)frame.size.height);
@@ -557,8 +557,10 @@ NSOpenGLContext* createContext(NSOpenGLContext* share,
GLint zeroOpacity = 0;
[ctx setValues:&zeroOpacity forParameter:NSOpenGLCPSurfaceOpacity];
}
- [ctx setView:view];
- if(!allowIncompleteView) {
+ if(!incompleteView) {
+ DBG_PRINT("createContext.3.0: setView\n");
+ [ctx setView:view];
+ DBG_PRINT("createContext.3.X: setView\n");
[view unlockFocus];
}
}
@@ -628,7 +630,12 @@ void setContextOpacity(NSOpenGLContext* ctx, int opacity) {
void updateContext(NSOpenGLContext* ctx) {
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
- [ctx update];
+ NSView *nsView = [ctx view];
+ if(NULL != nsView) {
+ DBG_PRINT("updateContext.0: ctx %p, ctx.view %p\n", ctx, nsView);
+ [ctx update];
+ DBG_PRINT("updateContext.X\n");
+ }
[pool release];
}
@@ -638,7 +645,10 @@ void copyContext(NSOpenGLContext* dest, NSOpenGLContext* src, int mask) {
void* updateContextRegister(NSOpenGLContext* ctx, NSView* view) {
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
+
+ DBG_PRINT("updateContextRegister.0: ctx %p, view %p\n", ctx, view);
ContextUpdater *contextUpdater = [[ContextUpdater alloc] initWithContext: ctx view: view];
+ DBG_PRINT("updateContextRegister.X: ctxupd %p\n", contextUpdater);
[pool release];
return contextUpdater;
}
@@ -658,47 +668,60 @@ void updateContextUnregister(void* updater) {
ContextUpdater *contextUpdater = (ContextUpdater *)updater;
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
+ DBG_PRINT("updateContextUnregister.0: ctxupd %p\n", contextUpdater);
[contextUpdater release];
+ DBG_PRINT("updateContextUnregister.X\n");
[pool release];
}
NSOpenGLPixelBuffer* createPBuffer(int renderTarget, int internalFormat, int width, int height) {
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
+ DBG_PRINT("createPBuffer.0: renderTarget 0x%x, ifmt 0x%x, %dx%d: \n", renderTarget, internalFormat, width, height);
NSOpenGLPixelBuffer* pBuffer = [[NSOpenGLPixelBuffer alloc]
initWithTextureTarget:renderTarget
textureInternalFormat:internalFormat
textureMaxMipMapLevel:0
pixelsWide:width
pixelsHigh:height];
+ DBG_PRINT("createPBuffer.X: res %p\n", pBuffer);
[pool release];
return pBuffer;
}
Bool destroyPBuffer(NSOpenGLPixelBuffer* pBuffer) {
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
+ DBG_PRINT("destroyPBuffer.0: pbuffer %p\n", pBuffer);
[pBuffer release];
+ DBG_PRINT("destroyPBuffer.X\n");
[pool release];
return true;
}
void setContextPBuffer(NSOpenGLContext* ctx, NSOpenGLPixelBuffer* pBuffer) {
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
+ DBG_PRINT("setContextPBuffer.0: ctx %p, pbuffer %p\n", ctx, pBuffer);
[ctx setPixelBuffer: pBuffer
cubeMapFace: 0
mipMapLevel: 0
currentVirtualScreen: [ctx currentVirtualScreen]];
+ DBG_PRINT("setContextPBuffer.X\n");
[pool release];
}
void setContextTextureImageToPBuffer(NSOpenGLContext* ctx, NSOpenGLPixelBuffer* pBuffer, GLenum colorBuffer) {
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
+ DBG_PRINT("setContextTextureImageToPBuffer.0: ctx %p, pbuffer %p, colorBuffer 0x%x\n", ctx, pBuffer, (int)colorBuffer);
[ctx setTextureImageToPixelBuffer: pBuffer colorBuffer: colorBuffer];
+ DBG_PRINT("setContextTextureImageToPBuffer.X\n");
[pool release];
}
Bool isNSOpenGLPixelBuffer(uint64_t object) {
NSObject *nsObj = (NSObject*) (intptr_t) object;
- return [nsObj isMemberOfClass:[NSOpenGLPixelBuffer class]];
+ DBG_PRINT("isNSOpenGLPixelBuffer.0: obj %p\n", object);
+ Bool res = [nsObj isMemberOfClass:[NSOpenGLPixelBuffer class]];
+ DBG_PRINT("isNSOpenGLPixelBuffer.X: res %d\n", (int)res);
+ return res;
}
#include <mach-o/dyld.h>
diff --git a/src/nativewindow/native/macosx/OSXmisc.m b/src/nativewindow/native/macosx/OSXmisc.m
index d6ae7ed31..1cf41fc9d 100644
--- a/src/nativewindow/native/macosx/OSXmisc.m
+++ b/src/nativewindow/native/macosx/OSXmisc.m
@@ -633,7 +633,7 @@ JNIEXPORT jint JNICALL Java_jogamp_nativewindow_macosx_OSXUtil_GetScreenRefreshR
if(0 == res) {
res = 60; // default .. (experienced on OSX 10.6.8)
}
- fprintf(stderr, "GetScreenRefreshRate.X: %d\n", res);
+ DBG_PRINT(stderr, "GetScreenRefreshRate.X: %d\n", res);
// [pool release];
JNF_COCOA_EXIT(env);
return res;
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestOffscreenLayer01GLCanvasAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestOffscreenLayer01GLCanvasAWT.java
index d181800c5..3c9afbd2f 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestOffscreenLayer01GLCanvasAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestOffscreenLayer01GLCanvasAWT.java
@@ -33,7 +33,9 @@ import java.awt.Button;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Frame;
+import java.io.BufferedReader;
import java.io.IOException;
+import java.io.InputStreamReader;
import java.lang.reflect.InvocationTargetException;
import javax.media.opengl.GLAnimatorControl;
@@ -203,6 +205,7 @@ public class TestOffscreenLayer01GLCanvasAWT extends UITestCase {
}
public static void main(String args[]) throws IOException {
+ boolean waitForKey = false;
for(int i=0; i<args.length; i++) {
if(args[i].equals("-time")) {
durationPerTest = atoi(args[++i]);
@@ -215,8 +218,17 @@ public class TestOffscreenLayer01GLCanvasAWT extends UITestCase {
useMSAA = true;
} else if(args[i].equals("-still")) {
noAnimation = true;
+ } else if(args[i].equals("-wait")) {
+ waitForKey = true;
}
}
+ if(waitForKey) {
+ BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
+ System.err.println("Press enter to continue");
+ try {
+ System.err.println(stdin.readLine());
+ } catch (IOException e) { }
+ }
String tstname = TestOffscreenLayer01GLCanvasAWT.class.getName();
/*
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(new String[] {
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestOffscreenLayer02NewtCanvasAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestOffscreenLayer02NewtCanvasAWT.java
index c2185d6c3..ef7541d3f 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestOffscreenLayer02NewtCanvasAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestOffscreenLayer02NewtCanvasAWT.java
@@ -33,7 +33,9 @@ import java.awt.Button;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Frame;
+import java.io.BufferedReader;
import java.io.IOException;
+import java.io.InputStreamReader;
import java.lang.reflect.InvocationTargetException;
import javax.media.opengl.GLAnimatorControl;
@@ -200,6 +202,7 @@ public class TestOffscreenLayer02NewtCanvasAWT extends UITestCase {
}
public static void main(String args[]) throws IOException {
+ boolean waitForKey = false;
for(int i=0; i<args.length; i++) {
if(args[i].equals("-time")) {
durationPerTest = atoi(args[++i]);
@@ -212,8 +215,17 @@ public class TestOffscreenLayer02NewtCanvasAWT extends UITestCase {
useMSAA = true;
} else if(args[i].equals("-still")) {
noAnimation = true;
+ } else if(args[i].equals("-wait")) {
+ waitForKey = true;
}
}
+ if(waitForKey) {
+ BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
+ System.err.println("Press enter to continue");
+ try {
+ System.err.println(stdin.readLine());
+ } catch (IOException e) { }
+ }
String tstname = TestOffscreenLayer02NewtCanvasAWT.class.getName();
/*
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(new String[] {