Jogamp
Bug 741 HiDPI: Simplify ScalableSurface (2): Add request pixelScale API entry, fixed...
[jogl.git] / src / test / com / jogamp / opengl / test / junit / jogl / demos / es2 / newt / TestGearsES2NewtCanvasAWT.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.awt.BorderLayout;
32 import java.awt.Button;
33 import java.awt.Component;
34 import java.awt.Container;
35 import java.awt.Frame;
36 import java.awt.TextArea;
37 import java.awt.event.ComponentEvent;
38 import java.awt.event.ComponentListener;
39 import java.io.IOException;
40 import java.lang.reflect.InvocationTargetException;
41
42 import com.jogamp.common.os.Platform;
43 import com.jogamp.newt.Display;
44 import com.jogamp.newt.NewtFactory;
45 import com.jogamp.newt.Screen;
46 import com.jogamp.newt.Window;
47 import com.jogamp.newt.awt.NewtCanvasAWT;
48 import com.jogamp.newt.event.KeyEvent;
49 import com.jogamp.newt.event.WindowEvent;
50 import com.jogamp.newt.event.WindowAdapter;
51 import com.jogamp.newt.opengl.GLWindow;
52 import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
53 import com.jogamp.opengl.test.junit.util.MiscUtils;
54 import com.jogamp.opengl.test.junit.util.UITestCase;
55 import com.jogamp.opengl.test.junit.util.QuitAdapter;
56 import com.jogamp.opengl.util.Animator;
57 import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
58 import com.jogamp.opengl.test.junit.newt.parenting.NewtAWTReparentingKeyAdapter;
59
60 import javax.media.nativewindow.ScalableSurface;
61 import javax.media.nativewindow.util.Dimension;
62 import javax.media.nativewindow.util.Point;
63 import javax.media.nativewindow.util.PointImmutable;
64 import javax.media.nativewindow.util.DimensionImmutable;
65 import javax.media.opengl.GLCapabilities;
66 import javax.media.opengl.GLCapabilitiesImmutable;
67 import javax.media.opengl.GLProfile;
68 import javax.swing.SwingUtilities;
69
70 import org.junit.Assert;
71 import org.junit.Assume;
72 import org.junit.BeforeClass;
73 import org.junit.AfterClass;
74 import org.junit.Test;
75 import org.junit.FixMethodOrder;
76 import org.junit.runners.MethodSorters;
77
78 @FixMethodOrder(MethodSorters.NAME_ASCENDING)
79 public class TestGearsES2NewtCanvasAWT extends UITestCase {
80     public enum FrameLayout { None, TextOnBottom, BorderBottom, BorderBottom2, BorderCenter, BorderCenterSurrounded, DoubleBorderCenterSurrounded };
81     public enum ResizeBy { GLWindow, Component, Frame };
82
83     static int screenIdx = 0;
84     static PointImmutable wpos;
85     static DimensionImmutable wsize, rwsize = null;
86     static FrameLayout frameLayout = FrameLayout.None;
87     static ResizeBy resizeBy = ResizeBy.Component;
88     static int[] reqSurfacePixelScale = new int[] { ScalableSurface.AUTOMAX_PIXELSCALE, ScalableSurface.AUTOMAX_PIXELSCALE };
89
90     static long duration = 500; // ms
91     static boolean opaque = true;
92     static int forceAlpha = -1;
93     static boolean fullscreen = false;
94     static boolean pmvUseBackingArray = true;
95     static int swapInterval = 1;
96     static boolean showFPS = false;
97     static int loops = 1;
98     static boolean loop_shutdown = false;
99     static boolean shallUseOffscreenFBOLayer = false;
100     static boolean forceES2 = false;
101     static boolean forceGL3 = false;
102     static boolean manualTest = false;
103     static boolean exclusiveContext = false;
104     static boolean useAnimator = true;
105
106     @BeforeClass
107     public static void initClass() {
108         if(null == wsize) {
109             wsize = new Dimension(640, 480);
110         }
111     }
112
113     @AfterClass
114     public static void releaseClass() {
115     }
116
117     static void setGLWindowSize(final Frame frame, final GLWindow glw, final DimensionImmutable new_sz) {
118         try {
119             glw.setSize(new_sz.getWidth(), new_sz.getHeight());
120             if( null != frame ) {
121                 javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
122                     public void run() {
123                         frame.pack();
124                     } } );
125             }
126         } catch( Throwable throwable ) {
127             throwable.printStackTrace();
128             Assume.assumeNoException( throwable );
129         }
130     }
131     static void setComponentSize(final Frame frame, final Component comp, final DimensionImmutable new_sz) {
132         try {
133             javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
134                 public void run() {
135                     java.awt.Dimension d = new java.awt.Dimension(new_sz.getWidth(), new_sz.getHeight());
136                     comp.setMinimumSize(d);
137                     comp.setPreferredSize(d);
138                     comp.setSize(d);
139                     if( null != frame ) {
140                         frame.pack();
141                     }
142                 } } );
143         } catch( Throwable throwable ) {
144             throwable.printStackTrace();
145             Assume.assumeNoException( throwable );
146         }
147     }
148     static void setFrameSize(final Frame frame, final boolean frameLayout, final DimensionImmutable new_sz) {
149         try {
150             javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
151                 public void run() {
152                     java.awt.Dimension d = new java.awt.Dimension(new_sz.getWidth(), new_sz.getHeight());
153                     frame.setSize(d);
154                     if( frameLayout ) {
155                         frame.validate();
156                     }
157                 } } );
158         } catch( Throwable throwable ) {
159             throwable.printStackTrace();
160             Assume.assumeNoException( throwable );
161         }
162     }
163
164     static void setSize(final ResizeBy resizeBy, final Frame frame, final boolean frameLayout, final Component comp, final GLWindow glw, final DimensionImmutable new_sz) {
165         switch( resizeBy ) {
166             case GLWindow:
167                 setGLWindowSize(frameLayout ? frame : null, glw, new_sz);
168                 break;
169             case Component:
170                 setComponentSize(frameLayout ? frame : null, comp, new_sz);
171                 break;
172             case Frame:
173                 setFrameSize(frame, frameLayout, new_sz);
174                 break;
175         }
176     }
177
178     private void setTitle(final Frame frame, final NewtCanvasAWT glc, final Window win, final GLCapabilitiesImmutable caps) {
179         final String capsA = caps.isBackgroundOpaque() ? "opaque" : "transl";
180         {
181             final java.awt.Rectangle b = glc.getBounds();
182             frame.setTitle("NewtCanvasAWT["+capsA+"], swapI "+swapInterval+", win: ["+b.x+"/"+b.y+" "+b.width+"x"+b.height+"], pix: "+glc.getNativeWindow().getSurfaceWidth()+"x"+glc.getNativeWindow().getSurfaceHeight());
183         }
184         win.setTitle("GLWindow["+capsA+"], swapI "+swapInterval+", win: "+win.getBounds()+", pix: "+win.getSurfaceWidth()+"x"+win.getSurfaceHeight());
185     }
186
187     // public enum ResizeBy { GLWindow, Component, Frame };
188     protected void runTestGL(final GLCapabilitiesImmutable caps, final ResizeBy resizeBy, final FrameLayout frameLayout) throws InterruptedException, InvocationTargetException {
189         System.err.println("requested: vsync "+swapInterval+", "+caps);
190         Display dpy = NewtFactory.createDisplay(null);
191         Screen screen = NewtFactory.createScreen(dpy, screenIdx);
192         final GLWindow glWindow = GLWindow.create(screen, caps);
193         Assert.assertNotNull(glWindow);
194         glWindow.setSurfaceScale(reqSurfacePixelScale);
195         final int[] valReqSurfacePixelScale = glWindow.getRequestedSurfaceScale(new int[2]);
196
197         final NewtCanvasAWT newtCanvasAWT = new NewtCanvasAWT(glWindow);
198         if ( shallUseOffscreenFBOLayer ) {
199             newtCanvasAWT.setShallUseOffscreenLayer(true);
200         }
201
202         final Frame frame = new Frame("AWT Parent Frame");
203
204         setSize(resizeBy, frame, false, newtCanvasAWT, glWindow, wsize);
205
206         switch( frameLayout) {
207             case None:
208                 frame.add(newtCanvasAWT);
209                 break;
210             case TextOnBottom:
211                 final TextArea ta = new TextArea(2, 20);
212                 ta.append("0123456789");
213                 ta.append(Platform.getNewline());
214                 ta.append("Some Text");
215                 ta.append(Platform.getNewline());
216                 frame.setLayout(new BorderLayout());
217                 frame.add(ta, BorderLayout.SOUTH);
218                 frame.add(newtCanvasAWT, BorderLayout.CENTER);
219                 break;
220             case BorderBottom:
221                 frame.setLayout(new BorderLayout());
222                 frame.add(newtCanvasAWT, BorderLayout.SOUTH);
223                 break;
224             case BorderBottom2:
225                 frame.setLayout(new BorderLayout());
226                 frame.add(newtCanvasAWT, BorderLayout.SOUTH);
227                 frame.add(new Button("North"), BorderLayout.NORTH);
228                 break;
229             case BorderCenter:
230                 frame.setLayout(new BorderLayout());
231                 frame.add(newtCanvasAWT, BorderLayout.CENTER);
232                 break;
233             case BorderCenterSurrounded:
234                 frame.setLayout(new BorderLayout());
235                 frame.add(new Button("NORTH"), BorderLayout.NORTH);
236                 frame.add(new Button("SOUTH"), BorderLayout.SOUTH);
237                 frame.add(new Button("EAST"), BorderLayout.EAST);
238                 frame.add(new Button("WEST"), BorderLayout.WEST);
239                 frame.add(newtCanvasAWT, BorderLayout.CENTER);
240                 break;
241             case DoubleBorderCenterSurrounded:
242                 Container c = new Container();
243                 c.setLayout(new BorderLayout());
244                 c.add(new Button("north"), BorderLayout.NORTH);
245                 c.add(new Button("south"), BorderLayout.SOUTH);
246                 c.add(new Button("east"), BorderLayout.EAST);
247                 c.add(new Button("west"), BorderLayout.WEST);
248                 c.add(newtCanvasAWT, BorderLayout.CENTER);
249
250                 frame.setLayout(new BorderLayout());
251                 frame.add(new Button("NORTH"), BorderLayout.NORTH);
252                 frame.add(new Button("SOUTH"), BorderLayout.SOUTH);
253                 frame.add(new Button("EAST"), BorderLayout.EAST);
254                 frame.add(new Button("WEST"), BorderLayout.WEST);
255                 frame.add(c, BorderLayout.CENTER);
256                 break;
257         }
258
259         final GearsES2 demo = new GearsES2(swapInterval);
260         demo.setPMVUseBackingArray(pmvUseBackingArray);
261         glWindow.addGLEventListener(demo);
262
263         frame.addComponentListener(new ComponentListener() {
264             @Override
265             public void componentResized(ComponentEvent e) {
266                 setTitle(frame, newtCanvasAWT, glWindow, caps);
267             }
268
269             @Override
270             public void componentMoved(ComponentEvent e) {
271                 setTitle(frame, newtCanvasAWT, glWindow, caps);
272             }
273
274             @Override
275             public void componentShown(ComponentEvent e) { }
276
277             @Override
278             public void componentHidden(ComponentEvent e) { }
279         });
280
281         final Animator animator = useAnimator ? new Animator() : null;
282         if( useAnimator ) {
283             animator.setModeBits(false, Animator.MODE_EXPECT_AWT_RENDERING_THREAD);
284             animator.setExclusiveContext(exclusiveContext);
285         }
286
287         final QuitAdapter quitAdapter = new QuitAdapter();
288         //glWindow.addKeyListener(new TraceKeyAdapter(quitAdapter));
289         //glWindow.addWindowListener(new TraceWindowAdapter(quitAdapter));
290         glWindow.addKeyListener(quitAdapter);
291         glWindow.addWindowListener(quitAdapter);
292
293         glWindow.addWindowListener(new WindowAdapter() {
294             public void windowResized(WindowEvent e) {
295                 System.err.println("window resized: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight());
296             }
297             public void windowMoved(WindowEvent e) {
298                 System.err.println("window moved:   "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight());
299             }
300         });
301
302         glWindow.addKeyListener(new NewtAWTReparentingKeyAdapter(frame, newtCanvasAWT, glWindow, quitAdapter));
303         glWindow.addKeyListener(new com.jogamp.newt.event.KeyAdapter() {
304             @Override
305             public void keyPressed(final KeyEvent e) {
306                 if( e.isAutoRepeat() ) {
307                     return;
308                 }
309                 if(e.getKeyChar()=='x') {
310                     final int[] hadSurfacePixelScale = glWindow.getCurrentSurfaceScale(new int[2]);
311                     final int[] reqSurfacePixelScale;
312                     if( hadSurfacePixelScale[0] == ScalableSurface.IDENTITY_PIXELSCALE ) {
313                         reqSurfacePixelScale = new int[] { ScalableSurface.AUTOMAX_PIXELSCALE, ScalableSurface.AUTOMAX_PIXELSCALE };
314                     } else {
315                         reqSurfacePixelScale = new int[] { ScalableSurface.IDENTITY_PIXELSCALE, ScalableSurface.IDENTITY_PIXELSCALE };
316                     }
317                     System.err.println("[set PixelScale pre]: had "+hadSurfacePixelScale[0]+"x"+hadSurfacePixelScale[1]+" -> req "+reqSurfacePixelScale[0]+"x"+reqSurfacePixelScale[1]);
318                     glWindow.setSurfaceScale(reqSurfacePixelScale);
319                     final int[] valReqSurfacePixelScale = glWindow.getRequestedSurfaceScale(new int[2]);
320                     final int[] hasSurfacePixelScale0 = glWindow.convertToPixelUnits(new int[] { 1, 1 });
321                     final int[] hasSurfacePixelScale1 = glWindow.getCurrentSurfaceScale(new int[2]);
322                     System.err.println("[set PixelScale post]: "+hadSurfacePixelScale[0]+"x"+hadSurfacePixelScale[1]+" (had) -> "+
323                                        reqSurfacePixelScale[0]+"x"+reqSurfacePixelScale[1]+" (req) -> "+
324                                        valReqSurfacePixelScale[0]+"x"+valReqSurfacePixelScale[1]+" (val) -> "+
325                                        hasSurfacePixelScale1[0]+"x"+hasSurfacePixelScale1[1]+" (has)");
326                     setTitle(frame, newtCanvasAWT, glWindow, caps);
327                     Assert.assertArrayEquals(hasSurfacePixelScale0, hasSurfacePixelScale1);
328                 }
329             } } );
330
331         if( useAnimator ) {
332             animator.add(glWindow);
333             animator.start();
334             Assert.assertTrue(animator.isStarted());
335             Assert.assertTrue(animator.isAnimating());
336             Assert.assertEquals(exclusiveContext ? animator.getThread() : null, glWindow.getExclusiveContextThread());
337         }
338
339         SwingUtilities.invokeAndWait(new Runnable() {
340            public void run() {
341                if( ResizeBy.Frame == resizeBy ) {
342                    frame.validate();
343                } else {
344                    frame.pack();
345                }
346                frame.setVisible(true);
347            }
348         });
349         Assert.assertEquals(true,  AWTRobotUtil.waitForVisible(frame, true));
350         Assert.assertEquals(true,  AWTRobotUtil.waitForRealized(glWindow, true));
351
352         if( useAnimator ) {
353             animator.setUpdateFPSFrames(60, showFPS ? System.err : null);
354         }
355
356         System.err.println("NW chosen: "+glWindow.getDelegatedWindow().getChosenCapabilities());
357         System.err.println("GL chosen: "+glWindow.getChosenCapabilities());
358         System.err.println("window pos/siz: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", "+glWindow.getInsets());
359
360         final int[] hasSurfacePixelScale0 = glWindow.convertToPixelUnits(new int[] { 1, 1 });
361         final int[] hasSurfacePixelScale1 = glWindow.getCurrentSurfaceScale(new int[2]);
362         System.err.println("HiDPI PixelScale: "+reqSurfacePixelScale[0]+"x"+reqSurfacePixelScale[1]+" (req) -> "+
363                            valReqSurfacePixelScale[0]+"x"+valReqSurfacePixelScale[1]+" (val) -> "+
364                            hasSurfacePixelScale1[0]+"x"+hasSurfacePixelScale1[1]+" (has)");
365         setTitle(frame, newtCanvasAWT, glWindow, caps);
366         Assert.assertArrayEquals(hasSurfacePixelScale0, hasSurfacePixelScale1);
367
368         if( null != rwsize ) {
369             Thread.sleep(500); // 500ms delay
370             setSize(resizeBy, frame, true, newtCanvasAWT, glWindow, rwsize);
371             System.err.println("window resize "+rwsize+" -> pos/siz: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", "+glWindow.getInsets());
372         }
373
374         final long t0 = System.currentTimeMillis();
375         long t1 = t0;
376         while(!quitAdapter.shouldQuit() && t1-t0<duration) {
377             Thread.sleep(100);
378             t1 = System.currentTimeMillis();
379         }
380
381         if( useAnimator ) {
382             Assert.assertEquals(exclusiveContext ? animator.getThread() : null, glWindow.getExclusiveContextThread());
383             animator.stop();
384             Assert.assertFalse(animator.isAnimating());
385             Assert.assertFalse(animator.isStarted());
386         }
387         Assert.assertEquals(null, glWindow.getExclusiveContextThread());
388         SwingUtilities.invokeAndWait(new Runnable() {
389            public void run() {
390                frame.dispose();
391            }
392         });
393         glWindow.destroy();
394         Assert.assertEquals(true,  AWTRobotUtil.waitForRealized(glWindow, false));
395     }
396
397     @Test
398     public void test01GL2ES2() throws InterruptedException, InvocationTargetException {
399         for(int i=1; i<=loops; i++) {
400             System.err.println("Loop "+i+"/"+loops);
401             final GLProfile glp;
402             if(forceGL3) {
403                 glp = GLProfile.get(GLProfile.GL3);
404             } else if(forceES2) {
405                 glp = GLProfile.get(GLProfile.GLES2);
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, resizeBy, frameLayout);
415             if(loop_shutdown) {
416                 GLProfile.shutdown();
417             }
418         }
419     }
420
421     @Test
422     public void test02GL3() throws InterruptedException, InvocationTargetException {
423         if(manualTest) return;
424
425         if( !GLProfile.isAvailable(GLProfile.GL3) ) {
426             System.err.println("GL3 n/a");
427             return;
428         }
429         final GLProfile glp = GLProfile.get(GLProfile.GL3);
430         final GLCapabilities caps = new GLCapabilities( glp );
431         runTestGL(caps, resizeBy, frameLayout);
432     }
433
434     @Test
435     public void test99_PixelScale1_DefaultNorm() throws InterruptedException, InvocationTargetException {
436         if( manualTest ) return;
437
438         reqSurfacePixelScale[0] = ScalableSurface.IDENTITY_PIXELSCALE;
439         reqSurfacePixelScale[1] = ScalableSurface.IDENTITY_PIXELSCALE;
440
441         GLCapabilities caps = new GLCapabilities(GLProfile.getGL2ES2());
442         runTestGL(caps, resizeBy, frameLayout);
443     }
444
445     public static void main(String args[]) throws IOException {
446         int x=0, y=0, w=640, h=480;
447         int rw=-1, rh=-1;
448         boolean usePos = false;
449
450         for(int i=0; i<args.length; i++) {
451             if(args[i].equals("-time")) {
452                 i++;
453                 duration = MiscUtils.atol(args[i], duration);
454             } else if(args[i].equals("-rwidth")) {
455                 i++;
456                 rw = MiscUtils.atoi(args[i], rw);
457             } else if(args[i].equals("-rheight")) {
458                 i++;
459                 rh = MiscUtils.atoi(args[i], rh);
460             } else if(args[i].equals("-layout")) {
461                 i++;
462                 frameLayout = FrameLayout.valueOf(args[i]);
463             } else if(args[i].equals("-resizeBy")) {
464                 i++;
465                 resizeBy = ResizeBy.valueOf(args[i]);
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("-fullscreen")) {
472                 fullscreen = true;
473             } else if(args[i].equals("-pmvDirect")) {
474                 pmvUseBackingArray = false;
475             } else if(args[i].equals("-vsync")) {
476                 i++;
477                 swapInterval = MiscUtils.atoi(args[i], swapInterval);
478             } else if(args[i].equals("-layeredFBO")) {
479                 shallUseOffscreenFBOLayer = true;
480             } else if(args[i].equals("-exclctx")) {
481                 exclusiveContext = true;
482             } else if(args[i].equals("-noanim")) {
483                 useAnimator  = false;
484             } else if(args[i].equals("-es2")) {
485                 forceES2 = true;
486             } else if(args[i].equals("-gl3")) {
487                 forceGL3 = true;
488             } else if(args[i].equals("-showFPS")) {
489                 showFPS = true;
490             } else if(args[i].equals("-width")) {
491                 i++;
492                 w = MiscUtils.atoi(args[i], w);
493             } else if(args[i].equals("-height")) {
494                 i++;
495                 h = MiscUtils.atoi(args[i], h);
496             } else if(args[i].equals("-x")) {
497                 i++;
498                 x = MiscUtils.atoi(args[i], x);
499                 usePos = true;
500             } else if(args[i].equals("-y")) {
501                 i++;
502                 y = MiscUtils.atoi(args[i], y);
503                 usePos = true;
504             } else if(args[i].equals("-pixelScale")) {
505                 i++;
506                 final int pS = MiscUtils.atoi(args[i], reqSurfacePixelScale[0]);
507                 reqSurfacePixelScale[0] = pS;
508                 reqSurfacePixelScale[1] = pS;
509             } else if(args[i].equals("-screen")) {
510                 i++;
511                 screenIdx = MiscUtils.atoi(args[i], 0);
512             } else if(args[i].equals("-loops")) {
513                 i++;
514                 loops = MiscUtils.atoi(args[i], 1);
515             } else if(args[i].equals("-loop-shutdown")) {
516                 loop_shutdown = true;
517             } else if(args[i].equals("-manual")) {
518                 manualTest = true;
519             }
520         }
521         wsize = new Dimension(w, h);
522         if( 0 < rw && 0 < rh ) {
523             rwsize = new Dimension(rw, rh);
524         }
525
526         if(usePos) {
527             wpos = new Point(x, y);
528         }
529
530         System.err.println("frameLayout "+frameLayout);
531         System.err.println("resizeBy "+resizeBy);
532         System.err.println("position "+wpos);
533         System.err.println("size "+wsize);
534         System.err.println("resize "+rwsize);
535         System.err.println("screen "+screenIdx);
536         System.err.println("translucent "+(!opaque));
537         System.err.println("forceAlpha "+forceAlpha);
538         System.err.println("fullscreen "+fullscreen);
539         System.err.println("pmvDirect "+(!pmvUseBackingArray));
540         System.err.println("loops "+loops);
541         System.err.println("loop shutdown "+loop_shutdown);
542         System.err.println("shallUseOffscreenFBOLayer     "+shallUseOffscreenFBOLayer);
543         System.err.println("forceES2 "+forceES2);
544         System.err.println("forceGL3 "+forceGL3);
545         System.err.println("swapInterval "+swapInterval);
546         System.err.println("exclusiveContext "+exclusiveContext);
547         System.err.println("useAnimator "+useAnimator);
548
549         org.junit.runner.JUnitCore.main(TestGearsES2NewtCanvasAWT.class.getName());
550     }
551 }
http://JogAmp.org git info: FAQ, tutorial and man pages.