29package com.jogamp.opengl.test.junit.jogl.acore;
32import java.io.IOException;
33import java.lang.reflect.InvocationTargetException;
35import com.jogamp.opengl.GLCapabilities;
36import com.jogamp.opengl.GLProfile;
37import com.jogamp.opengl.awt.GLCanvas;
39import org.junit.AfterClass;
40import org.junit.Assert;
42import org.junit.FixMethodOrder;
43import org.junit.runners.MethodSorters;
45import com.jogamp.common.os.Platform;
46import com.jogamp.junit.util.JunitTracer;
47import com.jogamp.opengl.JoglVersion;
48import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
49import com.jogamp.opengl.test.junit.util.UITestCase;
50import com.jogamp.opengl.util.Animator;
52@FixMethodOrder(MethodSorters.NAME_ASCENDING)
55 static long duration = 300;
57 protected void runTestGL() throws InterruptedException, InvocationTargetException {
58 final Frame frame =
new Frame(
"Gears AWT Test");
59 Assert.assertNotNull(frame);
62 Assert.assertNotNull(glCanvas);
69 javax.swing.SwingUtilities.invokeAndWait(
new Runnable() {
72 frame.setSize(256, 256);
73 frame.setVisible(
true);
78 Assert.assertEquals(
true, animator.isAnimating());
79 Assert.assertEquals(
true, glCanvas.isVisible());
80 Assert.assertEquals(
true, glCanvas.isDisplayable());
85 Assert.assertEquals(
true, glCanvas.
isRealized());
88 Assert.assertEquals(
false, animator.isAnimating());
89 javax.swing.SwingUtilities.invokeAndWait(
new Runnable() {
92 frame.setVisible(
false);
94 Assert.assertEquals(
false, frame.isVisible());
95 javax.swing.SwingUtilities.invokeAndWait(
new Runnable() {
98 frame.remove(glCanvas);
106 JunitTracer.waitForKey(
"Exit");
110 protected void oneLife(
final boolean glInfo)
throws InterruptedException, InvocationTargetException {
111 final long t0 = Platform.currentTimeMillis();
113 final long t1 = Platform.currentTimeMillis();
117 final long t2 = Platform.currentTimeMillis();
121 final long t3 = Platform.currentTimeMillis();
123 final long t4 = Platform.currentTimeMillis();
124 System.err.println(
"Total: "+ (t4-t0) +
"ms");
125 System.err.println(
" GLProfile.initSingleton(): "+ (t1-t0) +
"ms");
126 System.err.println(
" Demo Code: "+ (t2-t1) +
"ms");
127 System.err.println(
" GLInfo: "+ (t3-t2) +
"ms");
128 System.err.println(
" GLProfile.shutdown(): "+ (t4-t3) +
"ms");
132 public void test01OneLife() throws InterruptedException, InvocationTargetException {
147 public void test03TwoLifes() throws InterruptedException, InvocationTargetException {
152 static boolean initOnly =
false;
153 static boolean waitForKey =
false;
155 public static void main(
final String args[])
throws IOException {
156 for(
int i=0; i<args.length; i++) {
157 if(args[i].equals(
"-wait")) {
159 }
else if(args[i].equals(
"-initOnly")) {
165 JunitTracer.waitForKey(
"Start");
168 org.junit.runner.JUnitCore.
main(tstname);
Specifies a set of OpenGL capabilities.
Specifies the the OpenGL profile.
static void shutdown()
Manual shutdown method, may be called after your last JOGL use within the running JVM.
static GLProfile getGL2ES2(final AbstractGraphicsDevice device)
Returns the GL2ES2 profile implementation, hence compatible w/ GL2ES2.
static void initSingleton()
Static initialization of JOGL.
static StringBuilder getDefaultOpenGLInfo(AbstractGraphicsDevice device, StringBuilder sb, final boolean withCapabilitiesInfo)
A heavyweight AWT component which provides OpenGL rendering support.
boolean isRealized()
Returns true if this drawable is realized, otherwise false.
void addGLEventListener(final GLEventListener listener)
Adds the given listener to the end of this drawable queue.
static void main(final String args[])
void oneLife(final boolean glInfo)
void test02AnotherLifeWithGLInfo()
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.