28package com.jogamp.opengl.test.junit.jogl.acore;
30import java.awt.BorderLayout;
31import java.awt.Dimension;
33import com.jogamp.opengl.GL;
34import com.jogamp.opengl.GLAutoDrawable;
35import com.jogamp.opengl.GLCapabilitiesImmutable;
36import com.jogamp.opengl.GLEventListener;
37import com.jogamp.opengl.GLProfile;
38import com.jogamp.opengl.awt.GLJPanel;
39import javax.swing.JFrame;
40import javax.swing.JPanel;
41import javax.swing.SwingUtilities;
43import org.junit.Assume;
44import org.junit.BeforeClass;
45import org.junit.FixMethodOrder;
46import org.junit.runners.MethodSorters;
48import com.jogamp.common.GlueGenVersion;
49import com.jogamp.common.util.VersionUtil;
50import com.jogamp.opengl.JoglVersion;
51import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
52import com.jogamp.opengl.test.junit.jogl.demos.es2.MultisampleDemoES2;
53import com.jogamp.opengl.test.junit.util.MiscUtils;
54import com.jogamp.opengl.util.Animator;
55import com.jogamp.opengl.util.awt.AWTGLReadBufferUtil;
64@FixMethodOrder(MethodSorters.NAME_ASCENDING)
75 final JFrame frame =
new JFrame();
77 final GLJPanel glad = createGLJPanel(skipGLOrientationVerticalFlip, useSwingDoubleBuffer, caps, d);
79 final SnapshotGLELAWT snapshotGLEL = doSnapshot ?
new SnapshotGLELAWT(textRendererGLEL, awtGLReadBufferUtil, skipGLOrientationVerticalFlip) :
null;
81 javax.swing.SwingUtilities.invokeAndWait(
new Runnable() {
84 frame.setLocation(64, 64);
85 final JPanel panel =
new JPanel();
86 panel.setLayout(
new BorderLayout());
87 panel.setDoubleBuffered(useSwingDoubleBuffer);
88 frame.getContentPane().add(panel);
94 System.err.println(VersionUtil.getPlatformInfo());
95 System.err.println(
"GLEventListener init on "+Thread.currentThread());
97 System.err.println(
"INIT GL IS: " + gl.getClass().getName());
105 public void reshape(
final GLAutoDrawable drawable,
final int x,
final int y,
final int width,
final int height) {}
125 frame.setVisible(
true);
127 }
catch(
final Throwable throwable ) {
128 throwable.printStackTrace();
129 Assume.assumeNoException( throwable );
132 waitForKey(
"Post init: Frame# "+textRendererGLEL.
frameNo);
139 for(
int i=0; i<3; i++) {
140 final String str =
"Frame# "+textRendererGLEL.
frameNo+
", user #"+(i+1);
141 System.err.println(str);
145 textRendererGLEL.userCounter = i + 1;
148 try { Thread.sleep(duration); }
catch (
final InterruptedException e) { }
149 javax.swing.SwingUtilities.invokeAndWait(
new Runnable() {
152 frame.setSize(size1);
155 try { Thread.sleep(duration); }
catch (
final InterruptedException e) { }
156 javax.swing.SwingUtilities.invokeAndWait(
new Runnable() {
159 frame.setSize(size2);
162 try { Thread.sleep(duration); }
catch (
final InterruptedException e) { }
163 javax.swing.SwingUtilities.invokeAndWait(
new Runnable() {
166 frame.setSize(size0);
169 try { Thread.sleep(duration); }
catch (
final InterruptedException e) { }
176 try { Thread.sleep(2*duration); }
catch (
final InterruptedException e) { }
178 }
catch (
final Exception e1) {
179 e1.printStackTrace();
182 SwingUtilities.invokeAndWait(
new Runnable() {
187 }
catch (
final Exception e1) {
188 e1.printStackTrace();
195 canvas.setPreferredSize(size);
196 canvas.setMinimumSize(size);
197 canvas.setDoubleBuffered(useSwingDoubleBuffer);
203 static boolean doSnapshot =
true;
204 static boolean keyFrame =
false;
206 public static void main(
final String[] args) {
207 for(
int i=0; i<args.length; i++) {
208 if(args[i].equals(
"-time")) {
211 }
else if(args[i].equals(
"-keyFrame")) {
213 }
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 lightweight Swing component which provides OpenGL rendering support.
final void setSkipGLOrientationVerticalFlip(final boolean v)
Skip isGLOriented() based vertical flip, which usually is required by the offscreen backend,...
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.
void setFlipVerticalInGLOrientation(final boolean v)
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 GLJPanel including non-...
void test(final GLCapabilitiesImmutable caps, final boolean useSwingDoubleBuffer, final boolean skipGLOrientationVerticalFlip)
static void main(final String[] args)
void setFlipVerticalInGLOrientation(final boolean v)
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.