29package com.jogamp.opengl.test.junit.jogl.demos.gl2.awt;
31import com.jogamp.opengl.*;
33import com.jogamp.opengl.util.Animator;
35import com.jogamp.opengl.awt.GLCanvas;
37import com.jogamp.newt.event.awt.AWTKeyAdapter;
38import com.jogamp.newt.event.awt.AWTWindowAdapter;
39import com.jogamp.newt.event.TraceKeyAdapter;
40import com.jogamp.newt.event.TraceWindowAdapter;
41import com.jogamp.opengl.test.junit.jogl.demos.gl2.Gears;
42import com.jogamp.opengl.test.junit.util.UITestCase;
43import com.jogamp.opengl.test.junit.util.QuitAdapter;
45import java.awt.Dimension;
47import java.io.BufferedReader;
48import java.io.IOException;
49import java.io.InputStreamReader;
50import java.lang.reflect.InvocationTargetException;
52import org.junit.Assert;
53import org.junit.BeforeClass;
54import org.junit.AfterClass;
56import org.junit.FixMethodOrder;
57import org.junit.runners.MethodSorters;
59@FixMethodOrder(MethodSorters.NAME_ASCENDING)
62 static int width, height;
63 static boolean waitForKey =
false;
64 static int msaaCount = 0;
70 Assert.assertNotNull(glp);
74 setTestSupported(
false);
85 final Frame frame =
new Frame(
"Gears AWT Test");
86 Assert.assertNotNull(frame);
89 Assert.assertNotNull(glCanvas);
90 final Dimension glc_sz =
new Dimension(width, height);
91 glCanvas.setMinimumSize(glc_sz);
92 glCanvas.setPreferredSize(glc_sz);
102 javax.swing.SwingUtilities.invokeAndWait(
new Runnable() {
105 frame.setVisible(
true);
112 while(!quitAdapter.shouldQuit() && animator.isAnimating() && animator.
getTotalFPSDuration()<duration) {
116 Assert.assertNotNull(frame);
117 Assert.assertNotNull(glCanvas);
118 Assert.assertNotNull(animator);
121 Assert.assertEquals(
false, animator.isAnimating());
122 javax.swing.SwingUtilities.invokeAndWait(
new Runnable() {
124 frame.setVisible(
false);
126 Assert.assertEquals(
false, frame.isVisible());
127 javax.swing.SwingUtilities.invokeAndWait(
new Runnable() {
129 frame.remove(glCanvas);
135 public void test01() throws InterruptedException, InvocationTargetException {
137 if( msaaCount > 0 ) {
144 static long duration = 500;
146 public static void main(
final String args[]) {
147 for(
int i=0; i<args.length; i++) {
148 if(args[i].equals(
"-time")) {
151 duration = Integer.parseInt(args[i]);
152 }
catch (
final Exception ex) { ex.printStackTrace(); }
153 }
else if(args[i].equals(
"-msaa")) {
156 msaaCount = Integer.parseInt(args[i]);
157 }
catch (
final Exception ex) { ex.printStackTrace(); }
158 }
else if(args[i].equals(
"-wait")) {
163 waitForKey(
"Start Test");
165 org.junit.runner.JUnitCore.main(
TestGearsAWT.class.getName());
AWT: printable: PRESSED (t0), TYPED (t0), RELEASED (t1) non-printable: PRESSED (t0),...
synchronized AWTAdapter addTo(final java.awt.Component awtComponent)
Due to the fact that some NEWT com.jogamp.newt.event.NEWTEventListener are mapped to more than one ja...
synchronized AWTAdapter addTo(final java.awt.Component awtComponent)
Due to the fact that some NEWT com.jogamp.newt.event.NEWTEventListener are mapped to more than one ja...
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.
Specifies the the OpenGL profile.
static boolean isAvailable(final AbstractGraphicsDevice device, final String profile)
Returns the availability of a profile on a device.
static GLProfile get(final AbstractGraphicsDevice device, String profile)
Returns a GLProfile object.
static final String GL2
The desktop OpenGL profile 1.x up to 3.0.
A heavyweight AWT component which provides OpenGL rendering support.
void addGLEventListener(final GLEventListener listener)
Adds the given listener to the end of this drawable queue.
Gears.java author: Brian Paul (converted to Java by Ron Cemer and Sven Gothel)
static void main(final String args[])
static void releaseClass()
void runTestGL(final GLCapabilities caps)
final long getTotalFPSDuration()
final void setUpdateFPSFrames(final int frames, final PrintStream out)
final synchronized boolean start()
Starts this animator, if not running.
final synchronized boolean stop()
Stops this animator.
void setSize(int width, int height)
Requests a new width and height for this AWTGLAutoDrawable.