Jogamp
Bump scripts to jre1.8.0_66
[jogl.git] / src / test / com / jogamp / opengl / test / junit / jogl / demos / es2 / newt / TestGearsES2NEWT.java
1 /**
2  * Copyright 2011 JogAmp Community. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without modification, are
5  * permitted provided that the following conditions are met:
6  *
7  *    1. Redistributions of source code must retain the above copyright notice, this list of
8  *       conditions and the following disclaimer.
9  *
10  *    2. Redistributions in binary form must reproduce the above copyright notice, this list
11  *       of conditions and the following disclaimer in the documentation and/or other materials
12  *       provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
15  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
16  * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
17  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
19  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20  * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
21  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
22  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23  *
24  * The views and conclusions contained in the software and documentation are those of the
25  * authors and should not be interpreted as representing official policies, either expressed
26  * or implied, of JogAmp Community.
27  */
28
29 package com.jogamp.opengl.test.junit.jogl.demos.es2.newt;
30
31 import java.io.IOException;
32 import java.lang.reflect.InvocationTargetException;
33
34 import com.jogamp.junit.util.JunitTracer;
35 import com.jogamp.newt.Display;
36 import com.jogamp.newt.NewtFactory;
37 import com.jogamp.newt.Screen;
38 import com.jogamp.newt.Window;
39 import com.jogamp.newt.event.WindowEvent;
40 import com.jogamp.newt.event.KeyAdapter;
41 import com.jogamp.newt.event.KeyEvent;
42 import com.jogamp.newt.event.TraceMouseAdapter;
43 import com.jogamp.newt.event.WindowAdapter;
44 import com.jogamp.newt.opengl.GLWindow;
45 import com.jogamp.newt.opengl.util.NEWTDemoListener;
46 import com.jogamp.newt.util.EDTUtil;
47 import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
48 import com.jogamp.opengl.test.junit.util.MiscUtils;
49 import com.jogamp.opengl.test.junit.util.UITestCase;
50 import com.jogamp.opengl.util.Animator;
51 import com.jogamp.opengl.util.AnimatorBase;
52 import com.jogamp.opengl.test.junit.jogl.demos.GLClearOnInitReshape;
53 import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
54 import com.jogamp.opengl.test.junit.jogl.demos.es2.LineSquareXDemoES2;
55 import com.jogamp.nativewindow.NativeWindowFactory;
56 import com.jogamp.nativewindow.ScalableSurface;
57 import com.jogamp.nativewindow.util.Dimension;
58 import com.jogamp.nativewindow.util.Point;
59 import com.jogamp.nativewindow.util.PointImmutable;
60 import com.jogamp.nativewindow.util.DimensionImmutable;
61 import com.jogamp.opengl.GL;
62 import com.jogamp.opengl.GLAnimatorControl;
63 import com.jogamp.opengl.GLAutoDrawable;
64 import com.jogamp.opengl.GLCapabilities;
65 import com.jogamp.opengl.GLCapabilitiesImmutable;
66 import com.jogamp.opengl.GLEventListener;
67 import com.jogamp.opengl.GLPipelineFactory;
68 import com.jogamp.opengl.GLProfile;
69
70 import jogamp.newt.DefaultEDTUtil;
71
72 import org.junit.Assert;
73 import org.junit.BeforeClass;
74 import org.junit.AfterClass;
75 import org.junit.Test;
76 import org.junit.FixMethodOrder;
77 import org.junit.runners.MethodSorters;
78
79 @FixMethodOrder(MethodSorters.NAME_ASCENDING)
80 public class TestGearsES2NEWT extends UITestCase {
81     static int screenIdx = 0;
82     static PointImmutable wpos;
83     static DimensionImmutable wsize, rwsize=null;
84     static float[] reqSurfacePixelScale = new float[] { ScalableSurface.AUTOMAX_PIXELSCALE, ScalableSurface.AUTOMAX_PIXELSCALE };
85
86     static long duration = 500; // ms
87     static boolean opaque = true;
88     static int forceAlpha = -1;
89     static boolean undecorated = false;
90     static boolean alwaysOnTop = false;
91     static boolean alwaysOnBottom = false;
92     static boolean resizable = true;
93     static boolean sticky = false;
94     static boolean max_vert= false;
95     static boolean max_horz= false;
96     static boolean fullscreen = false;
97     static int swapInterval = 1;
98     static boolean waitForKey = false;
99     static boolean mouseVisible = true;
100     static boolean mouseConfined = false;
101     static boolean setPointerIcon = false;
102     static boolean showFPS = false;
103     static int loops = 1;
104     static boolean loop_shutdown = false;
105     static boolean forceES2 = false;
106     static boolean forceES3 = false;
107     static boolean forceGL3 = false;
108     static boolean forceGL2 = false;
109     static boolean forceDebug = false;
110     static boolean forceTrace = false;
111     static int demoType = 1;
112     static boolean traceMouse = false;
113     static boolean manualTest = false;
114     static boolean exclusiveContext = false;
115     static boolean useAnimator = true;
116     static boolean useMappedBuffers = false;
117     static enum SysExit { none, testExit, testError, testEDTError, displayExit, displayError, displayEDTError };
118     static SysExit sysExit = SysExit.none;
119
120     @BeforeClass
121     public static void initClass() {
122         if(null == wsize) {
123             wsize = new Dimension(640, 480);
124         }
125     }
126
127     @AfterClass
128     public static void releaseClass() {
129     }
130
131     protected void runTestGL(final GLCapabilitiesImmutable caps, final boolean undecorated) throws InterruptedException {
132         System.err.println("requested: vsync "+swapInterval+", "+caps);
133         final Display dpy = NewtFactory.createDisplay(null);
134         final Screen screen = NewtFactory.createScreen(dpy, screenIdx);
135         final GLWindow glWindow = GLWindow.create(screen, caps);
136         Assert.assertNotNull(glWindow);
137         glWindow.setSurfaceScale(reqSurfacePixelScale);
138         final float[] valReqSurfacePixelScale = glWindow.getRequestedSurfaceScale(new float[2]);
139         glWindow.setSize(wsize.getWidth(), wsize.getHeight());
140         if(null != wpos) {
141             glWindow.setPosition(wpos.getX(), wpos.getY());
142         }
143         glWindow.setUndecorated(undecorated);
144         glWindow.setAlwaysOnTop(alwaysOnTop);
145         glWindow.setAlwaysOnBottom(alwaysOnBottom);
146         glWindow.setResizable(resizable);
147         glWindow.setSticky(sticky);
148         glWindow.setMaximized(max_horz, max_vert);
149         glWindow.setFullscreen(fullscreen);
150         glWindow.setPointerVisible(mouseVisible);
151         glWindow.confinePointer(mouseConfined);
152
153         final GLEventListener demo;
154         if( 2 == demoType ) {
155             final LineSquareXDemoES2 demo2 = new LineSquareXDemoES2(false);
156             demo = demo2;
157         } else if( 1 == demoType ) {
158             final GearsES2 gearsES2 = new GearsES2(swapInterval);
159             gearsES2.setUseMappedBuffers(useMappedBuffers);
160             gearsES2.setValidateBuffers(true);
161             demo = gearsES2;
162         } else if( 0 == demoType ) {
163             demo = new GLClearOnInitReshape();
164         } else {
165             demo = null;
166         }
167         if( forceDebug || forceTrace ) {
168             glWindow.addGLEventListener(new GLEventListener() {
169                 @Override
170                 public void init(final GLAutoDrawable drawable) {
171                     GL _gl = drawable.getGL();
172                     if(forceDebug) {
173                         try {
174                             _gl = _gl.getContext().setGL( GLPipelineFactory.create("com.jogamp.opengl.Debug", null, _gl, null) );
175                         } catch (final Exception e) {e.printStackTrace();}
176                     }
177
178                     if(forceTrace) {
179                         try {
180                             // Trace ..
181                             _gl = _gl.getContext().setGL( GLPipelineFactory.create("com.jogamp.opengl.Trace", null, _gl, new Object[] { System.err } ) );
182                         } catch (final Exception e) {e.printStackTrace();}
183                     }
184                 }
185                 @Override
186                 public void dispose(final GLAutoDrawable drawable) {}
187                 @Override
188                 public void display(final GLAutoDrawable drawable) {}
189                 @Override
190                 public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) {}
191             });
192         }
193
194         if( null != demo ) {
195             glWindow.addGLEventListener(demo);
196         }
197
198         final SnapshotGLEventListener snap = new SnapshotGLEventListener();
199         glWindow.addGLEventListener(snap);
200         if(waitForKey) {
201             glWindow.addGLEventListener(new GLEventListener() {
202                 public void init(final GLAutoDrawable drawable) { }
203                 public void dispose(final GLAutoDrawable drawable) { }
204                 public void display(final GLAutoDrawable drawable) {
205                     final GLAnimatorControl  actrl = drawable.getAnimator();
206                     if(waitForKey && actrl.getTotalFPSFrames() == 60*3) {
207                         JunitTracer.waitForKey("3s mark");
208                         actrl.resetFPSCounter();
209                         waitForKey = false;
210                     }
211                 }
212                 public void reshape(final GLAutoDrawable drawable, final int x, final int y,
213                         final int width, final int height) { }
214             });
215         }
216
217         final Animator animator = useAnimator ? new Animator() : null;
218         if( useAnimator ) {
219             animator.setModeBits(false, AnimatorBase.MODE_EXPECT_AWT_RENDERING_THREAD);
220             animator.setExclusiveContext(exclusiveContext);
221         }
222
223         glWindow.addWindowListener(new WindowAdapter() {
224             public void windowResized(final WindowEvent e) {
225                 System.err.println("window resized: "+glWindow.getBounds()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight());
226                 NEWTDemoListener.setTitle(glWindow);
227             }
228             public void windowMoved(final WindowEvent e) {
229                 System.err.println("window moved:   "+glWindow.getBounds()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight());
230                 NEWTDemoListener.setTitle(glWindow);
231             }
232         });
233
234         final GLWindow[] glWindow2 = { null };
235
236         final NEWTDemoListener newtDemoListener = new NEWTDemoListener(glWindow);
237         newtDemoListener.quitAdapterEnable(true);
238         glWindow.addKeyListener(newtDemoListener);
239         if( traceMouse ) {
240             glWindow.addMouseListener(new TraceMouseAdapter());
241         }
242         glWindow.addMouseListener(newtDemoListener);
243         glWindow.addWindowListener(newtDemoListener);
244         glWindow.addKeyListener(new KeyAdapter() {
245             @Override
246             public void keyPressed(final KeyEvent e) {
247                 if( e.isAutoRepeat() ) {
248                     return;
249                 }
250                 if(e.getKeyChar()=='n') {
251                     if( null != glWindow2[0] && glWindow2[0].isNativeValid() ) {
252                         glWindow2[0].destroy();
253                         glWindow2[0] = null;
254                     } else {
255                         glWindow2[0] = GLWindow.create(screen, caps);
256                         glWindow2[0].setTitle("GLWindow2");
257                         glWindow2[0].setPosition(glWindow.getX()+glWindow.getWidth()+64, glWindow.getY());
258                         glWindow2[0].setSize(glWindow.getWidth(), glWindow.getHeight());
259                         glWindow2[0].addGLEventListener(new LineSquareXDemoES2(false));
260                         final Animator animator2 = useAnimator ? new Animator(glWindow2[0]) : null;
261                         if( null != animator2 ) {
262                             animator2.start();
263                         }
264                         glWindow2[0].setVisible(true);
265                     }
266                 }
267             } } );
268
269         if( useAnimator ) {
270             animator.add(glWindow);
271             animator.start();
272             Assert.assertTrue(animator.isStarted());
273             Assert.assertTrue(animator.isAnimating());
274             Assert.assertEquals(exclusiveContext ? animator.getThread() : null, glWindow.getExclusiveContextThread());
275         }
276
277         if( SysExit.displayError == sysExit || SysExit.displayExit == sysExit || SysExit.displayEDTError == sysExit ) {
278             glWindow.addGLEventListener(new GLEventListener() {
279                 @Override
280                 public void init(final GLAutoDrawable drawable) {}
281                 @Override
282                 public void dispose(final GLAutoDrawable drawable) { }
283                 @Override
284                 public void display(final GLAutoDrawable drawable) {
285                     final GLAnimatorControl anim = drawable.getAnimator();
286                     if( null != anim && anim.isAnimating() ) {
287                         final long ms = anim.getTotalFPSDuration();
288                         if( ms >= duration/2 || ms >= 3000 ) { // max 3s wait until provoking error
289                             if( SysExit.displayError == sysExit ) {
290                                 throw new Error("test error send from GLEventListener.display - "+Thread.currentThread());
291                             } else if ( SysExit.displayExit == sysExit ) {
292                                 System.err.println("exit(0) send from GLEventListener");
293                                 System.exit(0);
294                             } else if ( SysExit.displayEDTError == sysExit ) {
295                                 final Object upstream = drawable.getUpstreamWidget();
296                                 System.err.println("EDT invokeAndWaitError: upstream type "+upstream.getClass().getName());
297                                 if( upstream instanceof Window ) {
298                                     final EDTUtil edt = ((Window)upstream).getScreen().getDisplay().getEDTUtil();
299                                     System.err.println("EDT invokeAndWaitError: edt type "+edt.getClass().getName());
300                                     if( edt instanceof DefaultEDTUtil ) {
301                                         newtDemoListener.doQuit();
302                                         ((DefaultEDTUtil)edt).invokeAndWaitError(new Runnable() {
303                                             public void run() {
304                                                 throw new RuntimeException("XXX Should never ever be seen! - "+Thread.currentThread());
305                                             }
306                                         });
307                                     }
308                                 }
309                             }
310                         }
311                     } else {
312                         System.exit(0);
313                     }
314                 }
315                 @Override
316                 public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { }
317             });
318         }
319
320         glWindow.setVisible(true);
321         if( useAnimator ) {
322             animator.setUpdateFPSFrames(60, showFPS ? System.err : null);
323         }
324
325         System.err.println("Window Current State   : "+glWindow.getStateMaskString());
326         System.err.println("Window Supported States: "+glWindow.getSupportedStateMaskString());
327         System.err.println("NW chosen: "+glWindow.getDelegatedWindow().getChosenCapabilities());
328         System.err.println("GL chosen: "+glWindow.getChosenCapabilities());
329         System.err.println("window pos/siz: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", "+glWindow.getInsets());
330
331         final float[] hasSurfacePixelScale1 = glWindow.getCurrentSurfaceScale(new float[2]);
332         System.err.println("HiDPI PixelScale: "+reqSurfacePixelScale[0]+"x"+reqSurfacePixelScale[1]+" (req) -> "+
333                            valReqSurfacePixelScale[0]+"x"+valReqSurfacePixelScale[1]+" (val) -> "+
334                            hasSurfacePixelScale1[0]+"x"+hasSurfacePixelScale1[1]+" (has)");
335         NEWTDemoListener.setTitle(glWindow);
336
337         snap.setMakeSnapshot();
338
339         if( null != rwsize ) {
340             Thread.sleep(500); // 500ms delay
341             glWindow.setSize(rwsize.getWidth(), rwsize.getHeight());
342             System.err.println("window resize pos/siz: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", "+glWindow.getInsets());
343         }
344
345         snap.setMakeSnapshot();
346
347         final long t0 = System.currentTimeMillis();
348         long t1 = t0;
349         while(!newtDemoListener.shouldQuit() && t1-t0<duration) {
350             Thread.sleep(100);
351             t1 = System.currentTimeMillis();
352             if( SysExit.testError == sysExit || SysExit.testExit == sysExit || SysExit.testEDTError == sysExit) {
353                 final long ms = t1-t0;
354                 if( ms >= duration/2 || ms >= 3000 ) { // max 3s wait until provoking error
355                     if( SysExit.testError == sysExit ) {
356                         throw new Error("test error send from test thread");
357                     } else if ( SysExit.testExit == sysExit ) {
358                         System.err.println("exit(0) send from test thread");
359                         System.exit(0);
360                     } else if ( SysExit.testEDTError == sysExit ) {
361                         final EDTUtil edt = glWindow.getScreen().getDisplay().getEDTUtil();
362                         System.err.println("EDT invokeAndWaitError: edt type "+edt.getClass().getName());
363                         if( edt instanceof DefaultEDTUtil ) {
364                             newtDemoListener.doQuit();
365                             ((DefaultEDTUtil)edt).invokeAndWaitError(new Runnable() {
366                                 public void run() {
367                                     throw new RuntimeException("XXX Should never ever be seen!");
368                                 }
369                             });
370                         }
371                     }
372                 }
373             }
374         }
375
376         if( useAnimator ) {
377             Assert.assertEquals(exclusiveContext ? animator.getThread() : null, glWindow.getExclusiveContextThread());
378             animator.stop();
379             Assert.assertFalse(animator.isAnimating());
380             Assert.assertFalse(animator.isStarted());
381         }
382         Assert.assertEquals(null, glWindow.getExclusiveContextThread());
383         glWindow.destroy();
384         if( null != glWindow2[0] && glWindow2[0].isNativeValid() ) {
385             glWindow2[0].destroy();
386             glWindow2[0] = null;
387         }
388         if( NativeWindowFactory.isAWTAvailable() ) {
389             Assert.assertEquals(true,  AWTRobotUtil.waitForRealized(glWindow, false));
390         }
391     }
392
393     @Test
394     public void test01_GL2ES2() throws InterruptedException {
395         for(int i=1; i<=loops; i++) {
396             System.err.println("Loop "+i+"/"+loops);
397             final GLProfile glp;
398             if(forceGL3) {
399                 glp = GLProfile.get(GLProfile.GL3);
400             } else if(forceES3) {
401                 glp = GLProfile.get(GLProfile.GLES3);
402             } else if(forceES2) {
403                 glp = GLProfile.get(GLProfile.GLES2);
404             } else if(forceGL2) {
405                 glp = GLProfile.get(GLProfile.GL2);
406             } else {
407                 glp = GLProfile.getGL2ES2();
408             }
409             final GLCapabilities caps = new GLCapabilities( glp );
410             caps.setBackgroundOpaque(opaque);
411             if(-1 < forceAlpha) {
412                 caps.setAlphaBits(forceAlpha);
413             }
414             runTestGL(caps, undecorated);
415             if(loop_shutdown) {
416                 GLProfile.shutdown();
417             }
418         }
419     }
420
421     @Test
422     public void test02_GLES2() throws InterruptedException {
423         if(manualTest) return;
424
425         if( !GLProfile.isAvailable(GLProfile.GLES2) ) {
426             System.err.println("GLES2 n/a");
427             return;
428         }
429         final GLProfile glp = GLProfile.get(GLProfile.GLES2);
430         final GLCapabilities caps = new GLCapabilities( glp );
431         runTestGL(caps, undecorated);
432     }
433
434     @Test
435     public void test03_GL3() throws InterruptedException {
436         if(manualTest) return;
437
438         if( !GLProfile.isAvailable(GLProfile.GL3) ) {
439             System.err.println("GL3 n/a");
440             return;
441         }
442         final GLProfile glp = GLProfile.get(GLProfile.GL3);
443         final GLCapabilities caps = new GLCapabilities( glp );
444         runTestGL(caps, undecorated);
445     }
446
447     @Test
448     public void test99_PixelScale1_DefaultNorm() throws InterruptedException, InvocationTargetException {
449         if( manualTest ) return;
450
451         reqSurfacePixelScale[0] = ScalableSurface.IDENTITY_PIXELSCALE;
452         reqSurfacePixelScale[1] = ScalableSurface.IDENTITY_PIXELSCALE;
453
454         final GLCapabilities caps = new GLCapabilities(GLProfile.getGL2ES2());
455         runTestGL(caps, undecorated);
456     }
457
458     public static void main(final String args[]) throws IOException {
459         int x=0, y=0, w=640, h=480, rw=-1, rh=-1;
460         boolean usePos = false;
461
462         for(int i=0; i<args.length; i++) {
463             if(args[i].equals("-time")) {
464                 i++;
465                 duration = MiscUtils.atol(args[i], duration);
466             } else if(args[i].equals("-translucent")) {
467                 opaque = false;
468             } else if(args[i].equals("-forceAlpha")) {
469                 i++;
470                 forceAlpha = MiscUtils.atoi(args[i], 0);
471             } else if(args[i].equals("-undecorated")) {
472                 undecorated = true;
473             } else if(args[i].equals("-atop")) {
474                 alwaysOnTop = true;
475             } else if(args[i].equals("-abottom")) {
476                 alwaysOnBottom = true;
477             } else if(args[i].equals("-noresize")) {
478                 resizable = false;
479             } else if(args[i].equals("-sticky")) {
480                 sticky = true;
481             } else if(args[i].equals("-maxv")) {
482                 max_vert = true;
483             } else if(args[i].equals("-maxh")) {
484                 max_horz = true;
485             } else if(args[i].equals("-fullscreen")) {
486                 fullscreen = true;
487             } else if(args[i].equals("-vsync")) {
488                 i++;
489                 swapInterval = MiscUtils.atoi(args[i], swapInterval);
490             } else if(args[i].equals("-exclctx")) {
491                 exclusiveContext = true;
492             } else if(args[i].equals("-noanim")) {
493                 useAnimator  = false;
494             } else if(args[i].equals("-es2")) {
495                 forceES2 = true;
496             } else if(args[i].equals("-es3")) {
497                 forceES3 = true;
498             } else if(args[i].equals("-gl3")) {
499                 forceGL3 = true;
500             } else if(args[i].equals("-gl2")) {
501                 forceGL2 = true;
502             } else if(args[i].equals("-debug")) {
503                 forceDebug = true;
504             } else if(args[i].equals("-trace")) {
505                 forceTrace = true;
506             } else if(args[i].equals("-mappedBuffers")) {
507                 useMappedBuffers = true;
508             } else if(args[i].equals("-wait")) {
509                 waitForKey = true;
510             } else if(args[i].equals("-mouseInvisible")) {
511                 mouseVisible = false;
512             } else if(args[i].equals("-mouseConfine")) {
513                 mouseConfined = true;
514             } else if(args[i].equals("-pointerIcon")) {
515                 setPointerIcon = true;
516             } else if(args[i].equals("-showFPS")) {
517                 showFPS = true;
518             } else if(args[i].equals("-width")) {
519                 i++;
520                 w = MiscUtils.atoi(args[i], w);
521             } else if(args[i].equals("-height")) {
522                 i++;
523                 h = MiscUtils.atoi(args[i], h);
524             } else if(args[i].equals("-x")) {
525                 i++;
526                 x = MiscUtils.atoi(args[i], x);
527                 usePos = true;
528             } else if(args[i].equals("-y")) {
529                 i++;
530                 y = MiscUtils.atoi(args[i], y);
531                 usePos = true;
532             } else if(args[i].equals("-pixelScale")) {
533                 i++;
534                 final float pS = MiscUtils.atof(args[i], reqSurfacePixelScale[0]);
535                 reqSurfacePixelScale[0] = pS;
536                 reqSurfacePixelScale[1] = pS;
537             } else if(args[i].equals("-rwidth")) {
538                 i++;
539                 rw = MiscUtils.atoi(args[i], rw);
540             } else if(args[i].equals("-rheight")) {
541                 i++;
542                 rh = MiscUtils.atoi(args[i], rh);
543             } else if(args[i].equals("-screen")) {
544                 i++;
545                 screenIdx = MiscUtils.atoi(args[i], 0);
546             } else if(args[i].equals("-loops")) {
547                 i++;
548                 loops = MiscUtils.atoi(args[i], 1);
549             } else if(args[i].equals("-loop-shutdown")) {
550                 loop_shutdown = true;
551             } else if(args[i].equals("-sysExit")) {
552                 i++;
553                 sysExit = SysExit.valueOf(args[i]);
554             } else if(args[i].equals("-manual")) {
555                 manualTest = true;
556             } else if(args[i].equals("-demo")) {
557                 i++;
558                 demoType = MiscUtils.atoi(args[i], 0);
559             } else if(args[i].equals("-traceMouse")) {
560                 traceMouse = true;
561             }
562         }
563         wsize = new Dimension(w, h);
564         if( 0 < rw && 0 < rh ) {
565             rwsize = new Dimension(rw, rh);
566         }
567
568         if(usePos) {
569             wpos = new Point(x, y);
570         }
571         System.err.println("position "+wpos);
572         System.err.println("size "+wsize);
573         System.err.println("resize "+rwsize);
574         System.err.println("screen "+screenIdx);
575         System.err.println("translucent "+(!opaque));
576         System.err.println("forceAlpha "+forceAlpha);
577         System.err.println("undecorated "+undecorated);
578         System.err.println("atop "+alwaysOnTop);
579         System.err.println("abottom "+alwaysOnBottom);
580         System.err.println("resizable "+resizable);
581         System.err.println("sticky "+sticky);
582         System.err.println("max_vert "+max_vert);
583         System.err.println("max_horz "+max_horz);
584         System.err.println("fullscreen "+fullscreen);
585         System.err.println("mouseVisible "+mouseVisible);
586         System.err.println("mouseConfined "+mouseConfined);
587         System.err.println("pointerIcon "+setPointerIcon);
588         System.err.println("loops "+loops);
589         System.err.println("loop shutdown "+loop_shutdown);
590         System.err.println("forceES2 "+forceES2);
591         System.err.println("forceES3 "+forceES3);
592         System.err.println("forceGL3 "+forceGL3);
593         System.err.println("forceGL2 "+forceGL2);
594         System.err.println("forceDebug "+forceDebug);
595         System.err.println("forceTrace "+forceTrace);
596         System.err.println("swapInterval "+swapInterval);
597         System.err.println("exclusiveContext "+exclusiveContext);
598         System.err.println("useAnimator "+useAnimator);
599         System.err.println("sysExitWithin "+sysExit);
600         System.err.println("mappedBuffers "+useMappedBuffers);
601         System.err.println("demoType "+demoType);
602         System.err.println("traceMouse "+traceMouse);
603
604         if(waitForKey) {
605             JunitTracer.waitForKey("Start");
606         }
607         org.junit.runner.JUnitCore.main(TestGearsES2NEWT.class.getName());
608     }
609 }
http://JogAmp.org git info: FAQ, tutorial and man pages.