JOGL v2.6.0-rc-20250712
JOGL, High-Performance Graphics Binding for Java™ (public API).
TestGLCanvasAWTActionDeadlock02AWT.java
Go to the documentation of this file.
1/**
2 * Copyright 2012 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 */
28package com.jogamp.opengl.test.junit.jogl.awt;
29
30import java.applet.Applet;
31import java.awt.BorderLayout;
32import java.awt.Color;
33import java.awt.DisplayMode;
34import java.awt.EventQueue;
35import java.awt.Frame;
36import java.awt.GraphicsDevice;
37import java.awt.GraphicsEnvironment;
38import java.awt.Insets;
39import java.awt.Rectangle;
40import java.awt.event.KeyEvent;
41import java.awt.event.KeyListener;
42import java.awt.event.MouseEvent;
43import java.awt.event.MouseMotionListener;
44import java.awt.event.WindowAdapter;
45import java.awt.event.WindowEvent;
46import java.lang.reflect.InvocationTargetException;
47import java.util.Timer;
48import java.util.TimerTask;
49
50import com.jogamp.opengl.*;
51import com.jogamp.opengl.awt.GLCanvas;
52
53import org.junit.Assume;
54import org.junit.Test;
55import org.junit.FixMethodOrder;
56import org.junit.runners.MethodSorters;
57
58import com.jogamp.common.os.Clock;
59import com.jogamp.common.os.Platform;
60import com.jogamp.common.util.VersionNumber;
61import com.jogamp.common.util.awt.AWTEDTExecutor;
62import com.jogamp.opengl.util.AnimatorBase;
63import com.jogamp.opengl.test.junit.util.MiscUtils;
64import com.jogamp.opengl.test.junit.util.UITestCase;
65
66/**
67 * Sample program that relies on JOGL's mechanism to handle the OpenGL context
68 * and rendering loop when using an AWT canvas attached to an Applet.
69 * <p>
70 * BUG on OSX/CALayer w/ Java6:
71 * If frame.setTitle() is issued right after initialization the call hangs in
72 * <pre>
73 * at apple.awt.CWindow._setTitle(Native Method)
74 * at apple.awt.CWindow.setTitle(CWindow.java:765) [1.6.0_37, build 1.6.0_37-b06-434-11M3909]
75 * </pre>
76 * </p>
77 * <p>
78 * OSX/CALayer is forced by using an Applet component in this unit test.
79 * </p>
80 * <p>
81 * Similar deadlock has been experienced w/ other mutable operation on an AWT Container owning a GLCanvas child,
82 * e.g. setResizable*().
83 * </p>
84 * <p>
85 * Users shall make sure all mutable AWT calls are performed on the EDT, even before 1st setVisible(true) !
86 * </p>
87 */
88@FixMethodOrder(MethodSorters.NAME_ASCENDING)
90 static int framesPerTest = 240; // frames
91
92 static class MiniPApplet extends Applet implements MouseMotionListener, KeyListener {
93 private static final long serialVersionUID = 1L;
94
95 /////////////////////////////////////////////////////////////
96 //
97 // Test parameters
98
99 public int frameRate = 120;
100 public int numSamples = 4;
101
102 public boolean fullScreen = false;
103 public boolean useAnimator = true;
104 public boolean resizeableFrame = true;
105
106 public boolean restartCanvas = true;
107 public int restartTimeout = 100; // in number of frames.
108
109 public boolean printThreadInfo = false;
110 public boolean printEventInfo = false;
111
112 /////////////////////////////////////////////////////////////
113 //
114 // Internal variables
115
116 int width;
117 int height;
118
119 String OPENGL_VENDOR;
120 String OPENGL_RENDERER;
121 String OPENGL_VERSION;
122 String OPENGL_EXTENSIONS;
123
124 int currentSamples = -1;
125
126 private Frame frame;
127 private GLProfile profile;
128 private GLCapabilities capabilities;
129 private GLCanvas canvas;
130
131 private SimpleListener listener;
132 private CustomAnimator animator;
133
134 private long beforeTime;
135 private long overSleepTime;
136 private final long frameRatePeriod = 1000000000L / frameRate;
137
138 private boolean initialized = false;
139 private boolean osxCALayerAWTModBug = false;
140 boolean justInitialized = true;
141
142 private double theta = 0;
143 private double s = 0;
144 private double c = 0;
145
146 private long millisOffset;
147 private int fcount, lastm;
148 private float frate;
149 private final int fint = 3;
150
151 private boolean setFramerate = false;
152 private boolean restarted = false;
153
154 private int frameCount = 0;
155
156 void run() throws InterruptedException, InvocationTargetException {
157 // Thread loop = new Thread("Animation Thread") {
158 // public void run() {
159 frameCount = 0;
160 while ( frameCount < framesPerTest ) {
161 if (!initialized) {
162 setup();
163 }
164
165 if (restartCanvas && restartTimeout == frameCount) {
166 restart();
167 }
168
169 if (useAnimator) {
170 animator.requestRender();
171 } else {
172 canvas.display();
173 }
174
175 clock();
176
177 frameCount++;
178 if( null == frame ) {
179 break;
180 }
181 }
182 dispose();
183 // }
184 // };
185 // loop.start();
186 }
187
188 void setup() throws InterruptedException, InvocationTargetException {
189 if (printThreadInfo) System.out.println("Current thread at setup(): " + Thread.currentThread());
190
191 millisOffset = System.currentTimeMillis();
192
193 final VersionNumber version170 = new VersionNumber(1, 7, 0);
194 osxCALayerAWTModBug = Platform.OSType.MACOS == Platform.getOSType() &&
195 0 > Platform.getJavaVersionNumber().compareTo(version170);
196 System.err.println("OSX CALayer AWT-Mod Bug "+osxCALayerAWTModBug);
197 System.err.println("OSType "+Platform.getOSType());
198 System.err.println("Java Version "+Platform.getJavaVersionNumber());
199
200 // Frame setup ----------------------------------------------------------
201
202 width = 300;
203 height = 300;
204 final MiniPApplet applet = this;
205
206 final GraphicsEnvironment environment =
207 GraphicsEnvironment.getLocalGraphicsEnvironment();
208 final GraphicsDevice displayDevice = environment.getDefaultScreenDevice();
209 frame = new Frame(displayDevice.getDefaultConfiguration());
210
211 final Rectangle fullScreenRect;
212 if (fullScreen) {
213 final DisplayMode mode = displayDevice.getDisplayMode();
214 fullScreenRect = new Rectangle(0, 0, mode.getWidth(), mode.getHeight());
215 } else {
216 fullScreenRect = null;
217 }
218 // All AWT Mods on AWT-EDT, especially due to the follow-up complicated code!
219 AWTEDTExecutor.singleton.invoke(true, new Runnable() {
220 @Override
221 public void run() {
222 frame.setTitle("MiniPApplet");
223 } } );
224 if (fullScreen) {
225 try {
226 javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
227 @Override
228 public void run() {
229 frame.setUndecorated(true);
230 frame.setBackground(Color.GRAY);
231 frame.setBounds(fullScreenRect);
232 frame.setVisible(true);
233 }});
234 } catch (final Throwable t) {
235 t.printStackTrace();
236 Assume.assumeNoException(t);
237 }
238 }
239 try {
240 javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
241 @Override
242 public void run() {
243 frame.setLayout(null);
244 frame.add(applet);
245 if (fullScreen) {
246 frame.invalidate();
247 } else {
248 frame.pack();
249 }
250 frame.setResizable(resizeableFrame);
251 if (fullScreen) {
252 // After the pack(), the screen bounds are gonna be 0s
253 frame.setBounds(fullScreenRect);
254 applet.setBounds((fullScreenRect.width - applet.width) / 2,
255 (fullScreenRect.height - applet.height) / 2,
256 applet.width, applet.height);
257 } else {
258 final Insets insets = frame.getInsets();
259
260 final int windowW = applet.width + insets.left + insets.right;
261 final int windowH = applet.height + insets.top + insets.bottom;
262 final int locationX = 100;
263 final int locationY = 100;
264
265 frame.setSize(windowW, windowH);
266 frame.setLocation(locationX, locationY);
267
268 final int usableWindowH = windowH - insets.top - insets.bottom;
269 applet.setBounds((windowW - width)/2, insets.top + (usableWindowH - height)/2, width, height);
270 }
271 }});
272 } catch (final Throwable t) {
273 t.printStackTrace();
274 Assume.assumeNoException(t);
275 }
276
277
278 frame.add(this);
279 frame.addWindowListener(new WindowAdapter() {
280 @Override
281 public void windowClosing(final WindowEvent e) {
282 try {
283 dispose();
284 } catch (final Exception ex) {
285 Assume.assumeNoException(ex);
286 }
287 }
288 });
289
290 javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
291 @Override
292 public void run() {
293 frame.setVisible(true);
294 } } );
295
296 // Canvas setup ----------------------------------------------------------
297
298 profile = GLProfile.getDefault();
299 capabilities = new GLCapabilities(profile);
300 capabilities.setSampleBuffers(true);
301 capabilities.setNumSamples(numSamples);
302 capabilities.setDepthBits(24);
303 // capabilities.setStencilBits(8); // No Stencil on OSX w/ hw-accel !
304 capabilities.setAlphaBits(8);
305
306 canvas = new GLCanvas(capabilities);
307 canvas.setBounds(0, 0, width, height);
308
309 javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
310 @Override
311 public void run() {
312 MiniPApplet.this.setLayout(new BorderLayout());
313 MiniPApplet.this.add(canvas, BorderLayout.CENTER);
314 MiniPApplet.this.validate();
315 } } );
316 canvas.addMouseMotionListener(this);
317 canvas.addKeyListener(this);
318
319 // Setting up animation
320 listener = new SimpleListener();
321 canvas.addGLEventListener(listener);
322 if (useAnimator) {
323 animator = new CustomAnimator(canvas);
324 animator.start();
325 }
326 initialized = true;
327 }
328
329 void restart() throws InterruptedException, InvocationTargetException {
330 System.out.println("Restarting surface...");
331
332 // Stopping animation, removing current canvas.
333 if (useAnimator) {
334 animator.stop();
335 animator.remove(canvas);
336 }
337 canvas.disposeGLEventListener(listener, true);
338 this.remove(canvas);
339
340 capabilities = new GLCapabilities(profile);
341 capabilities.setSampleBuffers(true);
342 capabilities.setNumSamples(numSamples);
343
344 canvas = new GLCanvas(capabilities);
345 canvas.setBounds(0, 0, width, height);
346
347 // Setting up animation again
348 javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
349 @Override
350 public void run() {
351 MiniPApplet.this.setLayout(new BorderLayout());
352 MiniPApplet.this.add(canvas, BorderLayout.CENTER);
353 MiniPApplet.this.validate();
354 } } );
355 canvas.addMouseMotionListener(this);
356 canvas.addKeyListener(this);
357
358 canvas.addGLEventListener(listener);
359 if (useAnimator) {
360 animator.add(canvas);
361 animator.start();
362 }
363
364 setFramerate = false;
365 restarted = true;
366
367 System.out.println("Done");
368 }
369
370 void dispose() throws InterruptedException, InvocationTargetException {
371 if( null == frame ) {
372 return;
373 }
374
375 // Stopping animation, removing current canvas.
376 if (useAnimator) {
377 animator.stop();
378 animator.remove(canvas);
379 }
380 canvas.removeGLEventListener(listener);
381 if( EventQueue.isDispatchThread() ) {
382 MiniPApplet.this.remove(canvas);
383 frame.remove(MiniPApplet.this);
384 frame.validate();
385 frame.dispose();
386 frame = null;
387 } else {
388 javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
389 @Override
390 public void run() {
391 MiniPApplet.this.remove(canvas);
392 frame.remove(MiniPApplet.this);
393 frame.validate();
394 frame.dispose();
395 frame = null;
396 }});
397 }
398 }
399
400 void draw(final GL2 gl) {
401 if( !osxCALayerAWTModBug || !justInitialized ) {
402 AWTEDTExecutor.singleton.invoke(true, new Runnable() {
403 @Override
404 public void run() {
405 frame.setTitle("frame " + frameCount);
406 } } );
407 }
408
409 if (printThreadInfo) System.out.println("Current thread at draw(): " + Thread.currentThread());
410
411 if (OPENGL_VENDOR == null) {
412 OPENGL_VENDOR = gl.glGetString(GL.GL_VENDOR);
413 OPENGL_RENDERER = gl.glGetString(GL.GL_RENDERER);
414 OPENGL_VERSION = gl.glGetString(GL.GL_VERSION);
415 OPENGL_EXTENSIONS = gl.glGetString(GL.GL_EXTENSIONS);
416 System.out.println(OPENGL_VENDOR);
417 System.out.println(OPENGL_RENDERER);
418 System.out.println(OPENGL_VERSION);
419 System.out.println(OPENGL_EXTENSIONS);
420
421 final int[] temp = { 0 };
422 gl.glGetIntegerv(GL.GL_MAX_SAMPLES, temp, 0);
423 System.out.println("Maximum number of samples supported by the hardware: " + temp[0]);
424 System.out.println("Frame: "+frame);
425 System.out.println("Applet: "+MiniPApplet.this);
426 System.out.println("GLCanvas: "+canvas);
427 System.out.println("GLDrawable: "+canvas.getDelegatedDrawable());
428 }
429
430 if (currentSamples == -1) {
431 final int[] temp = { 0 };
432 gl.glGetIntegerv(GL.GL_SAMPLES, temp, 0);
433 currentSamples = temp[0];
434 if (numSamples != currentSamples) {
435 System.err.println("Requested sampling level " + numSamples + " not supported. Using " + currentSamples + " samples instead.");
436 }
437 }
438
439 if (!setFramerate) {
440 if (60 < frameRate) {
441 // Disables vsync
442 gl.setSwapInterval(0);
443 } else if (30 < frameRate) {
444 gl.setSwapInterval(1);
445 } else {
446 gl.setSwapInterval(2);
447 }
448 setFramerate = true;
449 }
450
451 if (restarted) {
452 final int[] temp = { 0 };
453 gl.glGetIntegerv(GL.GL_SAMPLES, temp, 0);
454 if (numSamples != temp[0]) {
455 System.err.println("Multisampling level requested " + numSamples + " not supported. Using " + temp[0] + "samples instead.");
456 }
457 }
458
459 gl.glClearColor(0, 0, 0, 1);
461
462 theta += 0.01;
463 s = Math.sin(theta);
464 c = Math.cos(theta);
465
467 gl.glColor3f(1, 0, 0);
468 gl.glVertex2d(-c, -c);
469 gl.glColor3f(0, 1, 0);
470 gl.glVertex2d(0, c);
471 gl.glColor3f(0, 0, 1);
472 gl.glVertex2d(s, -s);
473 gl.glEnd();
474
475 gl.glFlush();
476
477 fcount += 1;
478 final int m = (int) (System.currentTimeMillis() - millisOffset);
479 if (m - lastm > 1000 * fint) {
480 frate = (float)(fcount) / fint;
481 fcount = 0;
482 lastm = m;
483 System.err.println("fps: " + frate);
484 }
485 }
486
487 void clock() {
488 final long afterTime = Clock.currentNanos();
489 final long timeDiff = afterTime - beforeTime;
490 final long sleepTime = (frameRatePeriod - timeDiff) - overSleepTime;
491
492 if (sleepTime > 0) { // some time left in this cycle
493 try {
494 Thread.sleep(sleepTime / 1000000L, (int) (sleepTime % 1000000L));
495 } catch (final InterruptedException ex) { }
496
497 overSleepTime = (Clock.currentNanos() - afterTime) - sleepTime;
498
499 } else { // sleepTime <= 0; the frame took longer than the period
500 overSleepTime = 0L;
501 }
502
503 beforeTime = Clock.currentNanos();
504 }
505
506 class SimpleListener implements GLEventListener {
507 @Override
508 public void display(final GLAutoDrawable drawable) {
509 draw(drawable.getGL().getGL2());
510 justInitialized = false;
511 }
512
513 @Override
514 public void dispose(final GLAutoDrawable drawable) { }
515
516 @Override
517 public void init(final GLAutoDrawable drawable) {
518 justInitialized = true;
519 }
520
521 @Override
522 public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int w, final int h) { }
523 }
524
525 @Override
526 public void mouseDragged(final MouseEvent ev) {
527 if (printEventInfo) {
528 System.err.println("Mouse dragged event: " + ev);
529 }
530 }
531
532 @Override
533 public void mouseMoved(final MouseEvent ev) {
534 if (printEventInfo) {
535 System.err.println("Mouse moved event: " + ev);
536 }
537 }
538
539 @Override
540 public void keyPressed(final KeyEvent ev) {
541 if (printEventInfo) {
542 System.err.println("Key pressed event: " + ev);
543 }
544 }
545
546 @Override
547 public void keyReleased(final KeyEvent ev) {
548 if (printEventInfo) {
549 System.err.println("Key released event: " + ev);
550 }
551 }
552
553 @Override
554 public void keyTyped(final KeyEvent ev) {
555 if (printEventInfo) {
556 System.err.println("Key typed event: " + ev);
557 }
558 }
559
560 /** An Animator subclass which renders one frame at the time
561 * upon calls to the requestRender() method.
562 **/
563 public static class CustomAnimator extends AnimatorBase {
564 private Timer timer = null;
565 private TimerTask task = null;
566 private volatile boolean shouldRun;
567
568 @Override
569 protected String getBaseName(final String prefix) {
570 return "Custom" + prefix + "Animator" ;
571 }
572
573 /** Creates an CustomAnimator with an initial drawable to
574 * animate. */
575 public CustomAnimator(final GLAutoDrawable drawable) {
576 if (drawable != null) {
577 add(drawable);
578 }
579 }
580
581 public synchronized void requestRender() {
582 shouldRun = true;
583 }
584
585 @Override
586 public final synchronized boolean isStarted() {
587 return (timer != null);
588 }
589
590 @Override
591 public final synchronized boolean isAnimating() {
592 return (timer != null) && (task != null);
593 }
594
595 private void startTask() {
596 if(null != task) {
597 return;
598 }
599
600 task = new TimerTask() {
601 private boolean firstRun = true;
602 @Override
603 public void run() {
604 if (firstRun) {
605 Thread.currentThread().setName("OPENGL");
606 firstRun = false;
607 }
608 if(CustomAnimator.this.shouldRun) {
609 CustomAnimator.this.animThread = Thread.currentThread();
610 // display impl. uses synchronized block on the animator instance
611 display();
612 synchronized (this) {
613 // done with current frame.
614 shouldRun = false;
615 }
616 }
617 }
618 };
619
620 fpsCounter.resetFPSCounter();
621 shouldRun = false;
622
623 timer.schedule(task, 0, 1);
624 }
625
626 @Override
627 public synchronized boolean start() {
628 if (timer != null) {
629 return false;
630 }
631 timer = new Timer();
632 startTask();
633 return true;
634 }
635
636 /** Stops this CustomAnimator. */
637 @Override
638 public synchronized boolean stop() {
639 if (timer == null) {
640 return false;
641 }
642 shouldRun = false;
643 if(null != task) {
644 task.cancel();
645 task = null;
646 }
647 if(null != timer) {
648 timer.cancel();
649 timer = null;
650 }
651 animThread = null;
652 try {
653 Thread.sleep(20); // ~ 1/60 hz wait, since we can't ctrl stopped threads / holding the lock is OK here!
654 } catch (final InterruptedException e) { }
655 return true;
656 }
657
658 @Override
659 public final synchronized boolean isPaused() { return false; }
660 @Override
661 public synchronized boolean resume() { return false; }
662 @Override
663 public synchronized boolean pause() { return false; }
664 }
665 }
666
667 @Test
668 public void test00() {
669 TestGLCanvasAWTActionDeadlock02AWT.MiniPApplet mini;
670 try {
671 final Class<?> c = Thread.currentThread().getContextClassLoader().loadClass(TestGLCanvasAWTActionDeadlock02AWT.MiniPApplet.class.getName());
672 mini = (TestGLCanvasAWTActionDeadlock02AWT.MiniPApplet) c.newInstance();
673 } catch (final Exception e) {
674 throw new RuntimeException(e);
675 }
676 if (mini != null) {
677 try {
678 mini.run();
679 } catch (final Exception ex) {
680 Assume.assumeNoException(ex);
681 }
682 }
683 }
684
685 public static void main(final String args[]) {
686 for(int i=0; i<args.length; i++) {
687 if(args[i].equals("-frames")) {
688 framesPerTest = MiscUtils.atoi(args[++i], framesPerTest);
689 }
690 }
691 org.junit.runner.JUnitCore.main(TestGLCanvasAWTActionDeadlock02AWT.class.getName());
692 }
693
694}
void setAlphaBits(final int alphaBits)
Sets the number of bits requested for the color buffer's alpha component.
Specifies a set of OpenGL capabilities.
void setNumSamples(final int numSamples)
If sample buffers are enabled, indicates the number of buffers to be allocated.
void setSampleBuffers(final boolean enable)
Defaults to false.
void setDepthBits(final int depthBits)
Sets the number of bits requested for the depth buffer.
Specifies the the OpenGL profile.
Definition: GLProfile.java:77
static GLProfile getDefault(final AbstractGraphicsDevice device)
Returns a default GLProfile object, reflecting the best for the running platform.
Definition: GLProfile.java:739
A heavyweight AWT component which provides OpenGL rendering support.
Definition: GLCanvas.java:170
GLEventListener disposeGLEventListener(final GLEventListener listener, final boolean remove)
Disposes the given listener via dispose(..) if it has been initialized and added to this queue.
Definition: GLCanvas.java:1100
final GLDrawable getDelegatedDrawable()
If the implementation uses delegation, return the delegated GLDrawable instance, otherwise return thi...
Definition: GLCanvas.java:1161
GLEventListener removeGLEventListener(final GLEventListener listener)
Removes the given listener from this drawable queue.
Definition: GLCanvas.java:1107
void addGLEventListener(final GLEventListener listener)
Adds the given listener to the end of this drawable queue.
Definition: GLCanvas.java:1065
Sample program that relies on JOGL's mechanism to handle the OpenGL context and rendering loop when u...
An Animator subclass which renders one frame at the time upon calls to the requestRender() method.
final synchronized boolean isPaused()
Indicates whether this animator is started and either manually paused or paused automatically due to ...
final synchronized boolean isAnimating()
Indicates whether this animator is started and is not paused.
CustomAnimator(final GLAutoDrawable drawable)
Creates an CustomAnimator with an initial drawable to animate.
static int atoi(final String str, final int def)
Definition: MiscUtils.java:57
Base implementation of GLAnimatorControl
void glVertex2d(double x, double y)
Entry point to C language function: void {@native glVertex2d}(GLdouble x, GLdouble y) Part of GL_V...
void glBegin(int mode)
Entry point to C language function: void {@native glBegin}(GLenum mode) Part of GL_VERSION_1_0
void glEnd()
Entry point to C language function: void {@native glEnd}() Part of GL_VERSION_1_0
void glColor3f(float red, float green, float blue)
Entry point to C language function: void {@native glColor3f}(GLfloat red, GLfloat green,...
A higher-level abstraction than GLDrawable which supplies an event based mechanism (GLEventListener) ...
GL getGL()
Returns the GL pipeline object this GLAutoDrawable uses.
void setSwapInterval(int interval)
Set the swap interval of the current context and attached onscreen GLDrawable.
GL2 getGL2()
Casts this object to the GL2 interface.
Declares events which client code can use to manage OpenGL rendering into a GLAutoDrawable.
void dispose(GLAutoDrawable drawable)
Notifies the listener to perform the release of all OpenGL resources per GLContext,...
void glGetIntegerv(int pname, IntBuffer data)
Entry point to C language function: void {@native glGetIntegerv}(GLenum pname, GLint * data) Part ...
static final int GL_EXTENSIONS
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_EXTENSIONS" with expr...
Definition: GL.java:154
static final int GL_TRIANGLES
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_TRIANGLES" with expre...
Definition: GL.java:145
static final int GL_VERSION
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_VERSION" with express...
Definition: GL.java:190
static final int GL_COLOR_BUFFER_BIT
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_COLOR_BUFFER_BIT" wit...
Definition: GL.java:390
void glClearColor(float red, float green, float blue, float alpha)
Entry point to C language function: void {@native glClearColor}(GLfloat red, GLfloat green,...
static final int GL_SAMPLES
GL_ES_VERSION_2_0, GL_VERSION_1_3, GL_VERSION_ES_1_0, GL_3DFX_multisample, GL_ARB_multisample,...
Definition: GL.java:689
String glGetString(int name)
Entry point to C language function: const GLubyte * {@native glGetString}(GLenum name) Part of GL_...
static final int GL_RENDERER
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_RENDERER" with expres...
Definition: GL.java:662
void glClear(int mask)
Entry point to C language function: void {@native glClear}(GLbitfield mask) Part of GL_ES_VERSION_...
static final int GL_VENDOR
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_VENDOR" with expressi...
Definition: GL.java:607
static final int GL_MAX_SAMPLES
GL_ES_VERSION_3_0, GL_ARB_framebuffer_object, GL_VERSION_3_0, GL_NV_framebuffer_multisample,...
Definition: GL.java:63
void glFlush()
Entry point to C language function: void {@native glFlush}() Part of GL_ES_VERSION_2_0,...
void addMouseMotionListener(MouseMotionListener l)