28package com.jogamp.opengl.test.junit.jogl.acore;
30import java.awt.BorderLayout;
31import java.awt.Dimension;
34import com.jogamp.opengl.GL;
35import com.jogamp.opengl.GLAutoDrawable;
36import com.jogamp.opengl.GLCapabilitiesImmutable;
37import com.jogamp.opengl.GLEventListener;
38import com.jogamp.opengl.GLProfile;
39import com.jogamp.opengl.awt.GLCanvas;
40import javax.swing.SwingUtilities;
42import org.junit.Assume;
43import org.junit.BeforeClass;
44import org.junit.FixMethodOrder;
45import org.junit.runners.MethodSorters;
47import com.jogamp.common.util.VersionUtil;
48import com.jogamp.opengl.JoglVersion;
49import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
50import com.jogamp.opengl.test.junit.jogl.demos.es2.MultisampleDemoES2;
51import com.jogamp.opengl.test.junit.util.MiscUtils;
52import com.jogamp.opengl.util.Animator;
53import com.jogamp.opengl.util.awt.AWTGLReadBufferUtil;
62@FixMethodOrder(MethodSorters.NAME_ASCENDING)
72 if( skipGLOrientationVerticalFlip || useSwingDoubleBuffer ) {
76 final Frame frame =
new Frame();
78 final GLCanvas glad = createGLCanvas(caps, d);
82 javax.swing.SwingUtilities.invokeAndWait(
new Runnable() {
85 frame.setLocation(64, 64);
86 frame.setLayout(
new BorderLayout());
96 System.err.println(VersionUtil.getPlatformInfo());
97 System.err.println(
"GLEventListener init on "+Thread.currentThread());
99 System.err.println(
"INIT GL IS: " + gl.getClass().getName());
107 public void reshape(
final GLAutoDrawable drawable,
final int x,
final int y,
final int width,
final int height) {}
125 frame.add(glad, BorderLayout.CENTER);
127 frame.setVisible(
true);
129 }
catch(
final Throwable throwable ) {
130 throwable.printStackTrace();
131 Assume.assumeNoException( throwable );
138 for(
int i=0; i<3; i++) {
139 final String str =
"Frame# "+textRendererGLEL.
frameNo+
", user #"+(i+1);
140 System.err.println(str);
144 textRendererGLEL.userCounter = i + 1;
147 try { Thread.sleep(duration); }
catch (
final InterruptedException e) { }
148 javax.swing.SwingUtilities.invokeAndWait(
new Runnable() {
151 frame.setSize(size1);
154 try { Thread.sleep(duration); }
catch (
final InterruptedException e) { }
155 javax.swing.SwingUtilities.invokeAndWait(
new Runnable() {
158 frame.setSize(size2);
161 try { Thread.sleep(duration); }
catch (
final InterruptedException e) { }
162 javax.swing.SwingUtilities.invokeAndWait(
new Runnable() {
165 frame.setSize(size0);
168 try { Thread.sleep(duration); }
catch (
final InterruptedException e) { }
175 try { Thread.sleep(2*duration); }
catch (
final InterruptedException e) { }
177 }
catch (
final Exception e1) {
178 e1.printStackTrace();
181 SwingUtilities.invokeAndWait(
new Runnable() {
186 }
catch (
final Exception e1) {
187 e1.printStackTrace();
194 canvas.setPreferredSize(size);
195 canvas.setMinimumSize(size);
200 static boolean doSnapshot =
true;
201 static boolean keyFrame =
false;
203 public static void main(
final String[] args) {
204 for(
int i=0; i<args.length; i++) {
205 if(args[i].equals(
"-time")) {
208 }
else if(args[i].equals(
"-keyFrame")) {
210 }
else if(args[i].equals(
"-noSnapshot")) {
Specifies the the OpenGL profile.
static void initSingleton()
Static initialization of JOGL.
static StringBuilder getGLStrings(final GL gl, final StringBuilder sb)
A heavyweight AWT component which provides OpenGL rendering support.
GLEventListener disposeGLEventListener(final GLEventListener listener, final boolean remove)
Disposes the given listener via dispose(..) if it has been initialized and added to this queue.
void addGLEventListener(final GLEventListener listener)
Adds the given listener to the end of this drawable queue.
Test synchronous GLAutoDrawable display, swap-buffer and read-pixels including non-MSAA and MSAA fram...
Test synchronous GLAutoDrawable display, swap-buffer and read-pixels with AWT GLCanvas including non-...
static void main(final String[] args)
void test(final GLCapabilitiesImmutable caps, final boolean useSwingDoubleBuffer, final boolean skipGLOrientationVerticalFlip)
GearsES2 setVerbose(final boolean v)
void setClearBuffers(final boolean v)
static long atol(final String str, final long def)
final synchronized boolean start()
Starts this animator, if not running.
final synchronized boolean stop()
Stops this animator.
GLReadBufferUtil specialization allowing to read out a frambuffer to an AWT BufferedImage utilizing A...
A higher-level abstraction than GLDrawable which supplies an event based mechanism (GLEventListener) ...
GL getGL()
Returns the GL pipeline object this GLAutoDrawable uses.
Specifies an immutable set of OpenGL capabilities.
boolean getSampleBuffers()
Returns whether sample buffers for full-scene antialiasing (FSAA) should be allocated for this drawab...
GLProfile getGLProfile()
Returns the GL profile you desire or used by the drawable.
GLCapabilitiesImmutable getChosenGLCapabilities()
Fetches the GLCapabilitiesImmutable corresponding to the chosen OpenGL capabilities (pixel format / v...
Declares events which client code can use to manage OpenGL rendering into a GLAutoDrawable.
void setSize(int width, int height)
Requests a new width and height for this AWTGLAutoDrawable.