29package com.jogamp.opengl.test.junit.jogl.awt;
31import java.lang.reflect.InvocationTargetException;
32import com.jogamp.opengl.GLProfile;
33import com.jogamp.opengl.GLCapabilities;
34import com.jogamp.opengl.awt.GLCanvas;
35import com.jogamp.opengl.util.Animator;
37import com.jogamp.opengl.test.junit.util.UITestCase;
38import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
41import java.awt.GraphicsConfiguration;
42import java.awt.GraphicsDevice;
43import java.awt.GraphicsEnvironment;
44import java.awt.Rectangle;
45import java.awt.Window;
46import javax.swing.JFrame;
49import org.junit.FixMethodOrder;
50import org.junit.runners.MethodSorters;
52import static org.junit.Assume.*;
53import static javax.swing.SwingUtilities.*;
59@FixMethodOrder(MethodSorters.NAME_ASCENDING)
62 static void checkGraphicsEnvironment() {
63 Rectangle virtualBounds =
new Rectangle();
64 final GraphicsEnvironment ge =GraphicsEnvironment.getLocalGraphicsEnvironment();
65 final GraphicsDevice[] gs = ge.getScreenDevices();
68 System.err.println(
"number of graphics devices " + gs.length);
69 for(
int i =0 ; i < gs.length; i++) {
70 System.err.println(gs[i].toString());
74 for (
int j = 0; j < gs.length; j++) {
75 final GraphicsDevice gd = gs[j];
76 final GraphicsConfiguration[] gc = gd.getConfigurations();
77 for (
int i=0; i < gc.length; i++) {
78 System.err.println(
"graphics configuration for device " + j +
" is: " + gc[i].getBounds());
79 virtualBounds = virtualBounds.union(gc[i].getBounds());
85 protected void runTestGL() throws InterruptedException, InvocationTargetException {
86 final Window window =
new JFrame(this.getSimpleTestName(
" - "));
92 final Runnable test =
new Runnable() {
96 window.add(glCanvas[0]);
101 window.setSize(512, 512);
104 window.setVisible(
true);
109 final Runnable cleanup =
new Runnable() {
111 System.out.println(
"cleaning up...");
112 window.setVisible(
false);
115 }
catch (
final Throwable t) {
116 assumeNoException(t);
133 invokeAndWait(cleanup);
137 public void test01Plain() throws InterruptedException, InvocationTargetException {
143 checkGraphicsEnvironment();
147 public static void main(
final String args[]) {
148 org.junit.runner.JUnitCore.main(
TestBug551AWT.class.getName());
Specifies a set of OpenGL capabilities.
Specifies the the OpenGL profile.
static GLProfile getGL2ES2(final AbstractGraphicsDevice device)
Returns the GL2ES2 profile implementation, hence compatible w/ GL2ES2.
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.
Tests context creation + display on various kinds of Window implementations.
void test02WithCheckGraphicsEnvironment()
static void main(final String args[])
final synchronized boolean start()
Starts this animator, if not running.
final synchronized boolean stop()
Stops this animator.