JOGL v2.6.0-rc-20250706
JOGL, High-Performance Graphics Binding for Java™ (public API).
TestGearsES2NewtCanvasAWT.java
Go to the documentation of this file.
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
29package com.jogamp.opengl.test.junit.jogl.demos.es2.newt;
30
31import java.awt.BorderLayout;
32import java.awt.Button;
33import java.awt.Component;
34import java.awt.Container;
35import java.awt.Frame;
36import java.awt.TextArea;
37import java.awt.event.ComponentEvent;
38import java.awt.event.ComponentListener;
39import java.io.IOException;
40import java.lang.reflect.InvocationTargetException;
41
42import com.jogamp.common.os.Platform;
43import com.jogamp.newt.Display;
44import com.jogamp.newt.NewtFactory;
45import com.jogamp.newt.Screen;
46import com.jogamp.newt.awt.NewtCanvasAWT;
47import com.jogamp.newt.event.WindowEvent;
48import com.jogamp.newt.event.WindowAdapter;
49import com.jogamp.newt.opengl.GLWindow;
50import com.jogamp.newt.opengl.util.NEWTDemoListener;
51import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
52import com.jogamp.opengl.test.junit.util.MiscUtils;
53import com.jogamp.opengl.test.junit.util.NewtTestUtil;
54import com.jogamp.opengl.test.junit.util.UITestCase;
55import com.jogamp.opengl.util.Animator;
56import com.jogamp.opengl.util.AnimatorBase;
57import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
58import com.jogamp.opengl.test.junit.newt.parenting.NewtAWTReparentingKeyAdapter;
59import com.jogamp.opengl.test.junit.newt.parenting.NewtReparentingKeyAdapter;
60
61import com.jogamp.nativewindow.ScalableSurface;
62import com.jogamp.nativewindow.util.Dimension;
63import com.jogamp.nativewindow.util.Point;
64import com.jogamp.nativewindow.util.PointImmutable;
65import com.jogamp.nativewindow.util.DimensionImmutable;
66import com.jogamp.opengl.GLCapabilities;
67import com.jogamp.opengl.GLCapabilitiesImmutable;
68import com.jogamp.opengl.GLProfile;
69import javax.swing.SwingUtilities;
70
71import org.junit.Assert;
72import org.junit.Assume;
73import org.junit.BeforeClass;
74import org.junit.AfterClass;
75import org.junit.Test;
76import org.junit.FixMethodOrder;
77import org.junit.runners.MethodSorters;
78
79/**
80 * <p>
81 * The demo code uses {@link NewtReparentingKeyAdapter} including {@link NEWTDemoListener} functionality.
82 * </p>
83 * <p>
84 * Manual invocation via main allows setting each tests's duration in milliseconds, e.g.{@code -duration 10000}, and many more, see {@link #main(String[])}
85 * </p>
86 */
87@FixMethodOrder(MethodSorters.NAME_ASCENDING)
89 public enum FrameLayout { None, TextOnBottom, BorderBottom, BorderBottom2, BorderCenter, BorderCenterSurrounded, DoubleBorderCenterSurrounded };
90 public enum ResizeBy { GLWindow, Component, Frame };
91
92 static int screenIdx = 0;
93 static PointImmutable wpos;
94 static DimensionImmutable wsize, rwsize = null;
96 static ResizeBy resizeBy = ResizeBy.Component;
97 static float[] reqSurfacePixelScale = new float[] { ScalableSurface.AUTOMAX_PIXELSCALE, ScalableSurface.AUTOMAX_PIXELSCALE };
98
99 static long duration = 500; // ms
100 static boolean opaque = true;
101 static int forceAlpha = -1;
102 static boolean fullscreen = false;
103 static int swapInterval = 1;
104 static boolean showFPS = false;
105 static int loops = 1;
106 static boolean loop_shutdown = false;
107 static boolean shallUseOffscreenFBOLayer = false;
108 static boolean forceES2 = false;
109 static boolean forceGL3 = false;
110 static boolean manualTest = false;
111 static boolean exclusiveContext = false;
112 static boolean useAnimator = true;
113
114 @BeforeClass
115 public static void initClass() {
116 if(null == wsize) {
117 wsize = new Dimension(640, 480);
118 }
119 if(null == rwsize) {
120 rwsize = new Dimension(800, 600);
121 }
122 }
123
124 @AfterClass
125 public static void releaseClass() {
126 }
127
128 static void setGLWindowSize(final Frame frame, final GLWindow glw, final DimensionImmutable new_sz) {
129 try {
130 glw.setSize(new_sz.getWidth(), new_sz.getHeight());
131 if( null != frame ) {
132 javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
133 @Override
134 public void run() {
135 frame.pack();
136 } } );
137 }
138 } catch( final Throwable throwable ) {
139 throwable.printStackTrace();
140 Assume.assumeNoException( throwable );
141 }
142 }
143 static void setComponentSize(final Frame frame, final Component comp, final DimensionImmutable new_sz) {
144 try {
145 javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
146 @Override
147 public void run() {
148 final java.awt.Dimension d = new java.awt.Dimension(new_sz.getWidth(), new_sz.getHeight());
149 comp.setMinimumSize(d);
150 comp.setPreferredSize(d);
151 comp.setSize(d);
152 if( null != frame ) {
153 frame.pack();
154 }
155 } } );
156 } catch( final Throwable throwable ) {
157 throwable.printStackTrace();
158 Assume.assumeNoException( throwable );
159 }
160 }
161 static void setFrameSize(final Frame frame, final boolean frameLayout, final DimensionImmutable new_sz) {
162 try {
163 javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
164 @Override
165 public void run() {
166 final java.awt.Dimension d = new java.awt.Dimension(new_sz.getWidth(), new_sz.getHeight());
167 frame.setSize(d);
168 if( frameLayout ) {
169 frame.validate();
170 }
171 } } );
172 } catch( final Throwable throwable ) {
173 throwable.printStackTrace();
174 Assume.assumeNoException( throwable );
175 }
176 }
177
178 static void setSize(final ResizeBy resizeBy, final Frame frame, final boolean frameLayout, final Component comp, final GLWindow glw, final DimensionImmutable new_sz) {
179 switch( resizeBy ) {
180 case GLWindow:
181 setGLWindowSize(frameLayout ? frame : null, glw, new_sz);
182 break;
183 case Component:
184 setComponentSize(frameLayout ? frame : null, comp, new_sz);
185 break;
186 case Frame:
187 setFrameSize(frame, frameLayout, new_sz);
188 break;
189 }
190 }
191
192 // public enum ResizeBy { GLWindow, Component, Frame };
193 protected void runTestGL(final GLCapabilitiesImmutable caps, final ResizeBy resizeBy, final FrameLayout frameLayout) throws InterruptedException, InvocationTargetException {
194 System.err.println("requested: vsync "+swapInterval+", "+caps);
195 final Display dpy = NewtFactory.createDisplay(null);
196 final Screen screen = NewtFactory.createScreen(dpy, screenIdx);
197 final GLWindow glWindow = GLWindow.create(screen, caps);
198 Assert.assertNotNull(glWindow);
199 glWindow.setSurfaceScale(reqSurfacePixelScale);
200 final float[] valReqSurfacePixelScale = glWindow.getRequestedSurfaceScale(new float[2]);
201
202 final NewtCanvasAWT newtCanvasAWT = new NewtCanvasAWT(glWindow);
203 if ( shallUseOffscreenFBOLayer ) {
204 newtCanvasAWT.setShallUseOffscreenLayer(true);
205 }
206
207 final Frame frame = new Frame("AWT Parent Frame");
208
209 setSize(resizeBy, frame, false, newtCanvasAWT, glWindow, wsize);
210
211 switch( frameLayout) {
212 case None:
213 frame.add(newtCanvasAWT);
214 break;
215 case TextOnBottom:
216 final TextArea ta = new TextArea(2, 20);
217 ta.append("0123456789");
218 ta.append(Platform.getNewline());
219 ta.append("Some Text");
220 ta.append(Platform.getNewline());
221 frame.setLayout(new BorderLayout());
222 frame.add(ta, BorderLayout.SOUTH);
223 frame.add(newtCanvasAWT, BorderLayout.CENTER);
224 break;
225 case BorderBottom:
226 frame.setLayout(new BorderLayout());
227 frame.add(newtCanvasAWT, BorderLayout.SOUTH);
228 break;
229 case BorderBottom2:
230 frame.setLayout(new BorderLayout());
231 frame.add(newtCanvasAWT, BorderLayout.SOUTH);
232 frame.add(new Button("North"), BorderLayout.NORTH);
233 break;
234 case BorderCenter:
235 frame.setLayout(new BorderLayout());
236 frame.add(newtCanvasAWT, BorderLayout.CENTER);
237 break;
238 case BorderCenterSurrounded:
239 frame.setLayout(new BorderLayout());
240 frame.add(new Button("NORTH"), BorderLayout.NORTH);
241 frame.add(new Button("SOUTH"), BorderLayout.SOUTH);
242 frame.add(new Button("EAST"), BorderLayout.EAST);
243 frame.add(new Button("WEST"), BorderLayout.WEST);
244 frame.add(newtCanvasAWT, BorderLayout.CENTER);
245 break;
246 case DoubleBorderCenterSurrounded:
247 final Container c = new Container();
248 c.setLayout(new BorderLayout());
249 c.add(new Button("north"), BorderLayout.NORTH);
250 c.add(new Button("south"), BorderLayout.SOUTH);
251 c.add(new Button("east"), BorderLayout.EAST);
252 c.add(new Button("west"), BorderLayout.WEST);
253 c.add(newtCanvasAWT, BorderLayout.CENTER);
254
255 frame.setLayout(new BorderLayout());
256 frame.add(new Button("NORTH"), BorderLayout.NORTH);
257 frame.add(new Button("SOUTH"), BorderLayout.SOUTH);
258 frame.add(new Button("EAST"), BorderLayout.EAST);
259 frame.add(new Button("WEST"), BorderLayout.WEST);
260 frame.add(c, BorderLayout.CENTER);
261 break;
262 }
263
264 final GearsES2 demo = new GearsES2(swapInterval);
265 glWindow.addGLEventListener(demo);
266
267 final NewtAWTReparentingKeyAdapter newtDemoListener = new NewtAWTReparentingKeyAdapter(frame, newtCanvasAWT, glWindow);
268 newtDemoListener.quitAdapterEnable(true);
269 glWindow.addKeyListener(newtDemoListener);
270 glWindow.addMouseListener(newtDemoListener);
271 glWindow.addWindowListener(newtDemoListener);
272
273 frame.addComponentListener(new ComponentListener() {
274 @Override
275 public void componentResized(final ComponentEvent e) {
276 newtDemoListener.setTitle();
277 }
278 @Override
279 public void componentMoved(final ComponentEvent e) {
280 newtDemoListener.setTitle();
281 }
282 @Override
283 public void componentShown(final ComponentEvent e) { }
284
285 @Override
286 public void componentHidden(final ComponentEvent e) { }
287 });
288
289 final Animator animator = useAnimator ? new Animator(0 /* w/o AWT */) : null;
290 if( useAnimator ) {
291 animator.setExclusiveContext(exclusiveContext);
292 }
293
294 glWindow.addWindowListener(new WindowAdapter() {
295 @Override
296 public void windowResized(final WindowEvent e) {
297 System.err.println("window resized: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight());
298 }
299 @Override
300 public void windowMoved(final WindowEvent e) {
301 System.err.println("window moved: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight());
302 }
303 });
304
305 if( useAnimator ) {
306 animator.add(glWindow);
307 animator.start();
308 Assert.assertTrue(animator.isStarted());
309 Assert.assertTrue(animator.isAnimating());
310 Assert.assertEquals(exclusiveContext ? animator.getThread() : null, glWindow.getExclusiveContextThread());
311 }
312
313 SwingUtilities.invokeAndWait(new Runnable() {
314 @Override
315 public void run() {
316 if( ResizeBy.Frame == resizeBy ) {
317 frame.validate();
318 } else {
319 frame.pack();
320 }
321 frame.setVisible(true);
322 }
323 });
324 Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true, null));
325 Assert.assertEquals(true, NewtTestUtil.waitForRealized(glWindow, true, null));
326
327 if( useAnimator ) {
328 animator.setUpdateFPSFrames(60, showFPS ? System.err : null);
329 }
330
331 System.err.println("NW chosen: "+glWindow.getDelegatedWindow().getChosenCapabilities());
332 System.err.println("GL chosen: "+glWindow.getChosenCapabilities());
333 System.err.println("window pos/siz: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", "+glWindow.getInsets());
334
335 final float[] hasSurfacePixelScale1 = glWindow.getCurrentSurfaceScale(new float[2]);
336 System.err.println("HiDPI PixelScale: "+reqSurfacePixelScale[0]+"x"+reqSurfacePixelScale[1]+" (req) -> "+
337 valReqSurfacePixelScale[0]+"x"+valReqSurfacePixelScale[1]+" (val) -> "+
338 hasSurfacePixelScale1[0]+"x"+hasSurfacePixelScale1[1]+" (has)");
339 newtDemoListener.setTitle();
340
341 if( null != rwsize ) {
342 Thread.sleep(500); // 500ms delay
343 setSize(resizeBy, frame, true, newtCanvasAWT, glWindow, rwsize);
344 System.err.println("window resize "+rwsize+" -> pos/siz: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", "+glWindow.getInsets());
345 }
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 }
353
354 if( useAnimator ) {
355 Assert.assertEquals(exclusiveContext ? animator.getThread() : null, glWindow.getExclusiveContextThread());
356 animator.stop();
357 Assert.assertFalse(animator.isAnimating());
358 Assert.assertFalse(animator.isStarted());
359 }
360 Assert.assertEquals(null, glWindow.getExclusiveContextThread());
361 SwingUtilities.invokeAndWait(new Runnable() {
362 @Override
363 public void run() {
364 frame.dispose();
365 }
366 });
367 glWindow.destroy();
368 Assert.assertEquals(true, NewtTestUtil.waitForRealized(glWindow, false, null));
369 }
370
371 @Test
372 public void test01GL2ES2() throws InterruptedException, InvocationTargetException {
373 for(int i=1; i<=loops; i++) {
374 System.err.println("Loop "+i+"/"+loops);
375 final GLProfile glp;
376 if(forceGL3) {
377 glp = GLProfile.get(GLProfile.GL3);
378 } else if(forceES2) {
380 } else {
381 glp = GLProfile.getGL2ES2();
382 }
383 final GLCapabilities caps = new GLCapabilities( glp );
384 caps.setBackgroundOpaque(opaque);
385 if(-1 < forceAlpha) {
386 caps.setAlphaBits(forceAlpha);
387 }
388 runTestGL(caps, resizeBy, frameLayout);
389 if(loop_shutdown) {
391 }
392 }
393 }
394
395 @Test
396 public void test02GL3() throws InterruptedException, InvocationTargetException {
397 if(manualTest) return;
398
400 System.err.println("GL3 n/a");
401 return;
402 }
403 final GLProfile glp = GLProfile.get(GLProfile.GL3);
404 final GLCapabilities caps = new GLCapabilities( glp );
405 runTestGL(caps, resizeBy, frameLayout);
406 }
407
408 @Test
409 public void test99_PixelScale1_DefaultNorm() throws InterruptedException, InvocationTargetException {
410 if( manualTest ) return;
411
412 reqSurfacePixelScale[0] = ScalableSurface.IDENTITY_PIXELSCALE;
413 reqSurfacePixelScale[1] = ScalableSurface.IDENTITY_PIXELSCALE;
414
416 runTestGL(caps, resizeBy, frameLayout);
417 }
418
419 public static void main(final String args[]) throws IOException {
420 int x=0, y=0, w=640, h=480;
421 int rw=-1, rh=-1;
422 boolean usePos = false;
423
424 for(int i=0; i<args.length; i++) {
425 if(args[i].equals("-time")) {
426 i++;
427 duration = MiscUtils.atol(args[i], duration);
428 } else if(args[i].equals("-rwidth")) {
429 i++;
430 rw = MiscUtils.atoi(args[i], rw);
431 } else if(args[i].equals("-rheight")) {
432 i++;
433 rh = MiscUtils.atoi(args[i], rh);
434 } else if(args[i].equals("-layout")) {
435 i++;
436 frameLayout = FrameLayout.valueOf(args[i]);
437 } else if(args[i].equals("-resizeBy")) {
438 i++;
439 resizeBy = ResizeBy.valueOf(args[i]);
440 } else if(args[i].equals("-translucent")) {
441 opaque = false;
442 } else if(args[i].equals("-forceAlpha")) {
443 i++;
444 forceAlpha = MiscUtils.atoi(args[i], 0);
445 } else if(args[i].equals("-fullscreen")) {
446 fullscreen = true;
447 } else if(args[i].equals("-vsync")) {
448 i++;
449 swapInterval = MiscUtils.atoi(args[i], swapInterval);
450 } else if(args[i].equals("-layeredFBO")) {
451 shallUseOffscreenFBOLayer = true;
452 } else if(args[i].equals("-exclctx")) {
453 exclusiveContext = true;
454 } else if(args[i].equals("-noanim")) {
455 useAnimator = false;
456 } else if(args[i].equals("-es2")) {
457 forceES2 = true;
458 } else if(args[i].equals("-gl3")) {
459 forceGL3 = true;
460 } else if(args[i].equals("-showFPS")) {
461 showFPS = true;
462 } else if(args[i].equals("-width")) {
463 i++;
464 w = MiscUtils.atoi(args[i], w);
465 } else if(args[i].equals("-height")) {
466 i++;
467 h = MiscUtils.atoi(args[i], h);
468 } else if(args[i].equals("-x")) {
469 i++;
470 x = MiscUtils.atoi(args[i], x);
471 usePos = true;
472 } else if(args[i].equals("-y")) {
473 i++;
474 y = MiscUtils.atoi(args[i], y);
475 usePos = true;
476 } else if(args[i].equals("-pixelScale")) {
477 i++;
478 final float pS = MiscUtils.atof(args[i], reqSurfacePixelScale[0]);
479 reqSurfacePixelScale[0] = pS;
480 reqSurfacePixelScale[1] = pS;
481 } else if(args[i].equals("-screen")) {
482 i++;
483 screenIdx = MiscUtils.atoi(args[i], 0);
484 } else if(args[i].equals("-loops")) {
485 i++;
486 loops = MiscUtils.atoi(args[i], 1);
487 } else if(args[i].equals("-loop-shutdown")) {
488 loop_shutdown = true;
489 } else if(args[i].equals("-manual")) {
490 manualTest = true;
491 }
492 }
493 wsize = new Dimension(w, h);
494 if( 0 < rw && 0 < rh ) {
495 rwsize = new Dimension(rw, rh);
496 }
497
498 if(usePos) {
499 wpos = new Point(x, y);
500 }
501
502 System.err.println("frameLayout "+frameLayout);
503 System.err.println("resizeBy "+resizeBy);
504 System.err.println("position "+wpos);
505 System.err.println("size "+wsize);
506 System.err.println("resize "+rwsize);
507 System.err.println("screen "+screenIdx);
508 System.err.println("translucent "+(!opaque));
509 System.err.println("forceAlpha "+forceAlpha);
510 System.err.println("fullscreen "+fullscreen);
511 System.err.println("loops "+loops);
512 System.err.println("loop shutdown "+loop_shutdown);
513 System.err.println("shallUseOffscreenFBOLayer "+shallUseOffscreenFBOLayer);
514 System.err.println("forceES2 "+forceES2);
515 System.err.println("forceGL3 "+forceGL3);
516 System.err.println("swapInterval "+swapInterval);
517 System.err.println("exclusiveContext "+exclusiveContext);
518 System.err.println("useAnimator "+useAnimator);
519
520 org.junit.runner.JUnitCore.main(TestGearsES2NewtCanvasAWT.class.getName());
521 }
522}
void setBackgroundOpaque(final boolean opaque)
Sets whether the surface shall be opaque or translucent.
void setAlphaBits(final int alphaBits)
Sets the number of bits requested for the color buffer's alpha component.
static Display createDisplay(final String name)
Create a Display entity.
static Screen createScreen(final Display display, final int index)
Create a Screen entity.
A screen may span multiple MonitorDevices representing their combined virtual size.
Definition: Screen.java:58
AWT Canvas containing a NEWT Window using native parenting.
void setShallUseOffscreenLayer(final boolean v)
Request an offscreen layer, if supported.
NEWT Window events are provided for notification purposes ONLY.
An implementation of GLAutoDrawable and Window interface, using a delegated Window instance,...
Definition: GLWindow.java:121
final int getSurfaceHeight()
Returns the height of this GLDrawable's surface client area in pixel units.
Definition: GLWindow.java:466
final void addMouseListener(final MouseListener l)
Appends the given MouseListener to the end of the list.
Definition: GLWindow.java:927
final float[] getRequestedSurfaceScale(final float[] result)
Returns the requested pixel scale of the associated NativeSurface.
Definition: GLWindow.java:500
final int getX()
Returns the current x position of this window, relative to it's parent.
Definition: GLWindow.java:436
final void addKeyListener(final KeyListener l)
Appends the given com.jogamp.newt.event.KeyListener to the end of the list.
Definition: GLWindow.java:902
final int getY()
Returns the current y position of the top-left corner of the client area relative to it's parent in w...
Definition: GLWindow.java:441
final float[] getCurrentSurfaceScale(final float[] result)
Returns the current pixel scale of the associated NativeSurface.
Definition: GLWindow.java:505
final int getSurfaceWidth()
Returns the width of this GLDrawable's surface client area in pixel units.
Definition: GLWindow.java:461
final void setSize(final int width, final int height)
Sets the size of the window's client area in window units, excluding decorations.
Definition: GLWindow.java:625
final void addWindowListener(final WindowListener l)
Appends the given com.jogamp.newt.event.WindowListener to the end of the list.
Definition: GLWindow.java:882
final CapabilitiesImmutable getChosenCapabilities()
Gets an immutable set of chosen capabilities.
Definition: GLWindow.java:266
final InsetsImmutable getInsets()
Returns the insets defined as the width and height of the window decoration on the left,...
Definition: GLWindow.java:431
final boolean setSurfaceScale(final float[] pixelScale)
Request a pixel scale in x- and y-direction for the associated NativeSurface, where size_in_pixel_uni...
Definition: GLWindow.java:495
final void destroy()
Destroys all resources associated with this GLAutoDrawable, inclusive the GLContext.
Definition: GLWindow.java:605
final Window getDelegatedWindow()
If the implementation uses delegation, return the delegated Window instance, otherwise return this in...
Definition: GLWindow.java:277
static GLWindow create(final GLCapabilitiesImmutable caps)
Creates a new GLWindow attaching a new Window referencing a new default Screen and default Display wi...
Definition: GLWindow.java:169
Specifies a set of OpenGL capabilities.
Specifies the the OpenGL profile.
Definition: GLProfile.java:77
static boolean isAvailable(final AbstractGraphicsDevice device, final String profile)
Returns the availability of a profile on a device.
Definition: GLProfile.java:305
static final String GL3
The desktop OpenGL core profile 3.x, with x >= 1.
Definition: GLProfile.java:576
static void shutdown()
Manual shutdown method, may be called after your last JOGL use within the running JVM.
Definition: GLProfile.java:277
static final String GLES2
The embedded OpenGL profile ES 2.x, with x >= 0.
Definition: GLProfile.java:585
static GLProfile get(final AbstractGraphicsDevice device, String profile)
Returns a GLProfile object.
static GLProfile getGL2ES2(final AbstractGraphicsDevice device)
Returns the GL2ES2 profile implementation, hence compatible w/ GL2ES2.
Definition: GLProfile.java:913
void runTestGL(final GLCapabilitiesImmutable caps, final ResizeBy resizeBy, final FrameLayout frameLayout)
AWT specializing demo functionality of NewtReparentingKeyAdapter, includes NEWTDemoListener.
static boolean waitForVisible(final java.awt.Component comp, final boolean visible, final Runnable waitAction)
static float atof(final String str, final float def)
Definition: MiscUtils.java:75
static int atoi(final String str, final int def)
Definition: MiscUtils.java:57
static long atol(final String str, final long def)
Definition: MiscUtils.java:66
static boolean waitForRealized(final Screen screen, final boolean realized, final Runnable waitAction)
final synchronized Thread getThread()
final synchronized void add(final GLAutoDrawable drawable)
Adds a drawable to this animator's list of rendering drawables.
final synchronized Thread setExclusiveContext(final Thread t)
Dedicate all GLAutoDrawable's context to the given exclusive context thread.
final void setUpdateFPSFrames(final int frames, final PrintStream out)
synchronized boolean isStarted()
Indicates whether this animator has been started.
final synchronized boolean start()
Starts this animator, if not running.
Definition: Animator.java:344
final synchronized boolean stop()
Stops this animator.
Definition: Animator.java:368
Adding mutable surface pixel scale property to implementing class, usually to a NativeSurface impleme...
static final float IDENTITY_PIXELSCALE
Setting surface-pixel-scale of {@value}, results in same pixel- and window-units.
static final float AUTOMAX_PIXELSCALE
Setting surface-pixel-scale of {@value}, results in maximum platform dependent pixel-scale,...
Immutable Dimension Interface, consisting of it's read only components:
CapabilitiesImmutable getChosenCapabilities()
Gets an immutable set of chosen capabilities.
void addGLEventListener(GLEventListener listener)
Adds the given listener to the end of this drawable queue.
Specifies an immutable set of OpenGL capabilities.