29package com.jogamp.opengl.test.junit.jogl.util.texture;
32import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
33import com.jogamp.opengl.test.junit.util.MiscUtils;
34import com.jogamp.opengl.test.junit.util.UITestCase;
36import com.jogamp.opengl.GLAutoDrawable;
37import com.jogamp.opengl.GLEventListener;
38import com.jogamp.opengl.GLProfile;
39import com.jogamp.opengl.GLCapabilities;
40import com.jogamp.opengl.awt.GLCanvas;
41import javax.swing.ImageIcon;
42import javax.swing.JLabel;
44import com.jogamp.opengl.util.FPSAnimator;
45import com.jogamp.opengl.util.awt.AWTGLReadBufferUtil;
48import java.awt.image.BufferedImage;
50import java.io.IOException;
51import org.junit.Assert;
52import org.junit.Assume;
53import org.junit.BeforeClass;
55import org.junit.FixMethodOrder;
56import org.junit.runners.MethodSorters;
63@FixMethodOrder(MethodSorters.NAME_ASCENDING)
65 static long durationPerTest = 500;
76 Assert.assertNotNull(glp);
78 Assert.assertNotNull(caps);
82 public void test1() throws InterruptedException {
84 final Frame frame0 =
new Frame(
"GL -> AWT");
85 final ImageIcon imageIcon =
new ImageIcon();
86 final JLabel imageLabel =
new JLabel(imageIcon);
87 frame0.add(imageLabel);
90 final Frame frame1 =
new Frame(
"GearsES2");
91 Assert.assertNotNull(frame1);
103 imageIcon.setImage(outputImage);
104 imageLabel.repaint();
108 public void reshape(
final GLAutoDrawable drawable,
final int x,
final int y,
final int width,
final int height) {
109 frame0.setSize(frame1.getWidth(), frame1.getHeight());
110 frame0.setLocation(frame1.getX()+frame1.getWidth()+32, frame0.getY());
116 javax.swing.SwingUtilities.invokeAndWait(
new Runnable() {
118 frame1.setSize(256, 256);
119 frame1.setLocation(0, 0);
120 frame1.setVisible(
true);
121 frame0.setSize(frame1.getWidth(), frame1.getHeight());
122 frame0.setLocation(frame1.getX()+frame1.getWidth()+32, frame0.getY());
123 frame0.setVisible(
true);
125 }
catch(
final Throwable throwable ) {
126 throwable.printStackTrace();
127 Assume.assumeNoException( throwable );
132 Thread.sleep(durationPerTest);
136 javax.swing.SwingUtilities.invokeAndWait(
new Runnable() {
138 frame0.setVisible(
false);
140 frame1.setVisible(
false);
143 }
catch(
final Throwable throwable ) {
144 throwable.printStackTrace();
145 Assume.assumeNoException( throwable );
149 public static void main(
final String args[])
throws IOException {
150 for(
int i=0; i<args.length; i++) {
151 if(args[i].equals(
"-time")) {
152 durationPerTest =
MiscUtils.
atol(args[++i], durationPerTest);
156 org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.
main(
new String[] {
160 "haltOnFailure=false",
162 "outputtoformatters=true",
163 "logfailedtests=true",
164 "logtestlistenerevents=true",
165 "formatter=org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter",
166 "formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,TEST-"+tstname+
".xml" } );
Specifies a set of OpenGL capabilities.
final GLProfile getGLProfile()
Returns the GL profile you desire or used by the drawable.
Specifies the the OpenGL profile.
static boolean isAvailable(final AbstractGraphicsDevice device, final String profile)
Returns the availability of a profile on a device.
static final String GL2ES2
The intersection of the desktop GL3, GL2 and embedded ES2 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.
Demonstrates TextureData w/ AWT usage, i.e.
static void main(final String args[])
static long atol(final String str, final long def)
An Animator subclass which attempts to achieve a target frames-per-second rate to avoid using all CPU...
final synchronized boolean start()
Starts this animator, if not running.
final synchronized boolean stop()
Stops this FPSAnimator.
GLReadBufferUtil specialization allowing to read out a frambuffer to an AWT BufferedImage utilizing A...
BufferedImage readPixelsToBufferedImage(final GL gl, final boolean awtOrientation)
Read the drawable's pixels to TextureData and Texture, if requested at construction,...
A higher-level abstraction than GLDrawable which supplies an event based mechanism (GLEventListener) ...
GL getGL()
Returns the GL pipeline object this GLAutoDrawable uses.
Declares events which client code can use to manage OpenGL rendering into a GLAutoDrawable.