28package com.jogamp.opengl.test.junit.jogl.awt;
30import java.awt.Dimension;
31import java.lang.reflect.InvocationTargetException;
33import com.jogamp.opengl.GLCapabilities;
34import com.jogamp.opengl.GLCapabilitiesImmutable;
35import com.jogamp.opengl.GLProfile;
36import com.jogamp.opengl.awt.GLJPanel;
37import javax.swing.JFrame;
38import javax.swing.JPanel;
39import javax.swing.SwingUtilities;
41import org.junit.Assume;
42import org.junit.BeforeClass;
43import org.junit.FixMethodOrder;
45import org.junit.runners.MethodSorters;
47import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
48import com.jogamp.opengl.test.junit.util.MiscUtils;
49import com.jogamp.opengl.test.junit.util.UITestCase;
54@FixMethodOrder(MethodSorters.NAME_ASCENDING)
62 static Dimension[] esize00 = {
63 new Dimension(281, 151),
64 new Dimension(282, 151),
65 new Dimension(283, 151),
66 new Dimension(284, 151),
68 new Dimension(284, 152),
69 new Dimension(283, 152),
70 new Dimension(282, 152),
71 new Dimension(281, 152),
73 new Dimension(291, 153),
74 new Dimension(292, 153),
75 new Dimension(293, 153),
76 new Dimension(294, 153),
78 new Dimension(281, 154),
79 new Dimension(282, 154),
80 new Dimension(283, 154),
81 new Dimension(284, 154)
83 static Dimension[] esize01 = {
84 new Dimension(283, 154),
85 new Dimension(291, 154),
86 new Dimension(282, 154),
88 static Dimension[] esize02 = {
89 new Dimension(291, 154),
90 new Dimension(282, 154),
95 final int rows = dims.length / cols + ( dims.length % cols > 0 ? 1 : 0 );
96 final JFrame[] frame =
new JFrame[] {
null };
98 System.err.println(
"Frame size: cols x rows "+cols+
"x"+rows);
100 javax.swing.SwingUtilities.invokeAndWait(
new Runnable() {
103 frame[0] =
new JFrame();
104 frame[0].setLocation(64, 64);
105 final JPanel panel =
new JPanel();
106 panel.setLayout(
null);
107 panel.setDoubleBuffered(useSwingDoubleBuffer);
108 frame[0].getContentPane().add(panel);
113 for(
int i=0; i<rows; i++) {
114 int maxColHeight = 0;
115 for(
int j=0; j<cols; j++) {
116 final int idx = i*cols+j;
117 if( idx >= dims.length ) {
break; }
118 final Dimension d = dims[idx];
119 if( d.height > maxColHeight ) {
120 maxColHeight = d.height;
122 final GLJPanel glad = createGLJPanel(useSwingDoubleBuffer, caps, d,
"[r "+i+
", c "+j+
"]");
124 glad.setLocation(x, y);
127 if( x > maxRowWidth ) {
133 frame[0].
setSize(maxRowWidth+4+64, y+4+64);
135 frame[0].setVisible(
true);
137 }
catch(
final Throwable throwable ) {
138 throwable.printStackTrace();
139 Assume.assumeNoException( throwable );
142 Thread.sleep(duration);
143 }
catch (
final InterruptedException e1) {
144 e1.printStackTrace();
147 SwingUtilities.invokeAndWait(
new Runnable() {
152 }
catch (
final Exception e1) {
153 e1.printStackTrace();
159 canvas.setName(name);
161 canvas.setPreferredSize(size);
162 canvas.setMinimumSize(size);
163 canvas.setDoubleBuffered(useSwingDoubleBuffer);
173 public void test00() throws InterruptedException, InvocationTargetException {
178 public void test01() throws InterruptedException, InvocationTargetException {
183 public void test02() throws InterruptedException, InvocationTargetException {
187 static long duration = 600;
189 public static void main(
final String[] args) {
190 boolean useSwingDoubleBuffer=
false, manual=
false;
192 for(
int i=0; i<args.length; i++) {
193 if(args[i].equals(
"-time")) {
196 }
else if(args[i].equals(
"-swingDoubleBuffer")) {
197 useSwingDoubleBuffer =
true;
198 }
else if(args[i].equals(
"-manual")) {
Specifies a set of OpenGL capabilities.
Specifies the the OpenGL profile.
static void initSingleton()
Static initialization of JOGL.
A lightweight Swing component which provides OpenGL rendering support.
void addGLEventListener(final GLEventListener listener)
Adds the given listener to the end of this drawable queue.
Multiple GLJPanels in a JFrame.
static void main(final String[] args)
void test(final GLCapabilitiesImmutable caps, final Dimension[] dims, final boolean useSwingDoubleBuffer)
static long atol(final String str, final long def)
Specifies an immutable set of OpenGL capabilities.
void setSize(int width, int height)
Requests a new width and height for this AWTGLAutoDrawable.