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;
46import java.io.BufferedReader;
47import java.io.IOException;
48import java.io.InputStreamReader;
49import java.lang.reflect.InvocationTargetException;
51import org.junit.Assert;
52import org.junit.BeforeClass;
53import org.junit.AfterClass;
55import org.junit.FixMethodOrder;
56import org.junit.runners.MethodSorters;
58@FixMethodOrder(MethodSorters.NAME_ASCENDING)
60 static long duration = 500;
61 static boolean waitForKey =
false;
62 static boolean altSwap =
true;
65 static int width, height;
71 Assert.assertNotNull(glp);
75 setTestSupported(
false);
101 public void reshape(
final GLAutoDrawable drawable,
final int x,
final int y,
final int width,
106 final Frame frame =
new Frame(
"Gears AWT Test");
107 Assert.assertNotNull(frame);
110 Assert.assertNotNull(glCanvas);
121 javax.swing.SwingUtilities.invokeAndWait(
new Runnable() {
123 frame.setSize(512, 512);
124 frame.setVisible(
true);
131 while(!quitAdapter.shouldQuit() && animator.isAnimating() && animator.
getTotalFPSDuration()<duration) {
135 Assert.assertNotNull(frame);
136 Assert.assertNotNull(glCanvas);
137 Assert.assertNotNull(animator);
140 Assert.assertEquals(
false, animator.isAnimating());
141 javax.swing.SwingUtilities.invokeAndWait(
new Runnable() {
143 frame.setVisible(
false);
145 Assert.assertEquals(
false, frame.isVisible());
146 javax.swing.SwingUtilities.invokeAndWait(
new Runnable() {
148 frame.remove(glCanvas);
154 public void test01() throws InterruptedException, InvocationTargetException {
160 public static void main(
final String args[]) {
161 for(
int i=0; i<args.length; i++) {
162 if(args[i].equals(
"-time")) {
165 duration = Integer.parseInt(args[i]);
166 }
catch (
final Exception ex) { ex.printStackTrace(); }
167 }
else if(args[i].equals(
"-wait")) {
169 }
else if(args[i].equals(
"-autoswap")) {
173 System.err.println(
"altSwap "+altSwap);
175 final BufferedReader stdin =
new BufferedReader(
new InputStreamReader(System.in));
176 System.err.println(
"Press enter to continue");
178 System.err.println(stdin.readLine());
179 }
catch (
final IOException e) { }
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 setDoubleBuffered(final boolean enable)
Enables or disables double buffering.
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 setAutoSwapBufferMode(final boolean onOrOff)
Enables or disables automatic buffer swapping for this drawable.
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)
void runTestGL(final GLCapabilities caps)
static void main(final String args[])
static void releaseClass()
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 glReadBuffer(int mode)
Entry point to C language function: void {@native glReadBuffer}(GLenum mode) Part of GL_ES_VERSION...
static final int GL_COLOR
GL_ES_VERSION_3_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_EXT_discard_framebuffer Alias for: GL_COLOR_EXT...
void glDrawBuffer(int mode)
Entry point to C language function: void {@native glDrawBuffer}(GLenum mode) Part of GL_VERSION_1_...
void glCopyPixels(int x, int y, int width, int height, int type)
Entry point to C language function: void {@native glCopyPixels}(GLint x, GLint y,...
A higher-level abstraction than GLDrawable which supplies an event based mechanism (GLEventListener) ...
GL getGL()
Returns the GL pipeline object this GLAutoDrawable uses.
boolean getAutoSwapBufferMode()
Indicates whether automatic buffer swapping is enabled for this drawable.
GL2 getGL2()
Casts this object to the GL2 interface.
int getSurfaceWidth()
Returns the width of this GLDrawable's surface client area in pixel units.
int getSurfaceHeight()
Returns the height of this GLDrawable's surface client area in pixel units.
Declares events which client code can use to manage OpenGL rendering into a GLAutoDrawable.
static final int GL_BACK
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_BACK" with expression...
static final int GL_FRONT
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_FRONT" with expressio...