29package com.jogamp.opengl.test.junit.jogl.util.texture;
31import java.awt.Dimension;
34import com.jogamp.opengl.GLAutoDrawable;
35import com.jogamp.opengl.GLCapabilities;
36import com.jogamp.opengl.GLEventListener;
37import com.jogamp.opengl.GLProfile;
38import com.jogamp.opengl.awt.GLCanvas;
40import jogamp.nativewindow.jawt.JAWTUtil;
42import com.jogamp.opengl.util.Animator;
43import com.jogamp.opengl.util.GLReadBufferUtil;
44import com.jogamp.opengl.util.texture.TextureIO;
46import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
47import com.jogamp.opengl.test.junit.util.UITestCase;
48import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
50import org.junit.Assert;
51import org.junit.Assume;
52import org.junit.BeforeClass;
54import org.junit.FixMethodOrder;
55import org.junit.runners.MethodSorters;
57@FixMethodOrder(MethodSorters.NAME_ASCENDING)
61 static int width, height;
66 Assert.assertNotNull(glp);
68 Assert.assertNotNull(caps);
74 protected void testWritePNG_Impl(
final boolean offscreenLayer)
throws InterruptedException {
78 if(!offscreenLayer && JAWTUtil.isOffscreenLayerRequired()) {
79 System.err.println(
"onscreen layer n/a");
82 if(offscreenLayer && !JAWTUtil.isOffscreenLayerSupported()) {
83 System.err.println(
"offscreen layer n/a");
89 glc.setMinimumSize(glc_sz);
90 glc.setPreferredSize(glc_sz);
91 final Frame frame =
new Frame(getSimpleTestName(
"."));
92 Assert.assertNotNull(frame);
106 public void reshape(
final GLAutoDrawable drawable,
final int x,
final int y,
final int width,
final int height) { }
113 javax.swing.SwingUtilities.invokeAndWait(
new Runnable() {
116 frame.setVisible(
true);
118 }
catch(
final Throwable throwable ) {
119 throwable.printStackTrace();
120 Assume.assumeNoException( throwable );
124 Assert.assertEquals(JAWTUtil.isOffscreenLayerSupported() && offscreenLayer,
134 javax.swing.SwingUtilities.invokeAndWait(
new Runnable() {
136 frame.setVisible(
false);
140 }
catch(
final Throwable throwable ) {
141 throwable.printStackTrace();
142 Assume.assumeNoException( throwable );
148 testWritePNG_Impl(
false);
153 testWritePNG_Impl(
true);
156 public static void main(
final String args[]) {
void setAlphaBits(final int alphaBits)
Sets the number of bits requested for the color buffer's alpha component.
Specifies a set of OpenGL capabilities.
Specifies the the OpenGL profile.
static GLProfile getDefault(final AbstractGraphicsDevice device)
Returns a default GLProfile object, reflecting the best for the running platform.
A heavyweight AWT component which provides OpenGL rendering support.
void setShallUseOffscreenLayer(final boolean v)
Request an offscreen layer, if supported.
final boolean isOffscreenLayerSurfaceEnabled()
Returns true if this instance uses an offscreen layer, otherwise false.
void addGLEventListener(final GLEventListener listener)
Adds the given listener to the end of this drawable queue.
void testOffscreenWritePNG()
void testWritePNG_Impl(final boolean offscreenLayer)
void testOnscreenWritePNG()
static void main(final String args[])
static boolean waitForRealized(final java.awt.Component comp, final boolean realized, final Runnable waitAction)
static boolean waitForVisible(final java.awt.Component comp, final boolean visible, final Runnable waitAction)
final int getTotalFPSFrames()
final void setUpdateFPSFrames(final int frames, final PrintStream out)
final synchronized boolean start()
Starts this animator, if not running.
final synchronized boolean stop()
Stops this animator.
Utility to read out the current FB to TextureData, optionally writing the data back to a texture obje...
static final String PNG
Constant which can be used as a file suffix to indicate a PNG file, value {@value}.
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.
void setSize(int width, int height)
Requests a new width and height for this AWTGLAutoDrawable.