29package com.jogamp.opengl.test.junit.jogl.util.texture;
31import com.jogamp.opengl.GLAutoDrawable;
32import com.jogamp.opengl.GLCapabilities;
33import com.jogamp.opengl.GLEventListener;
34import com.jogamp.opengl.GLProfile;
37import org.junit.FixMethodOrder;
38import org.junit.runners.MethodSorters;
40import com.jogamp.newt.opengl.GLWindow;
41import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
42import com.jogamp.opengl.test.junit.util.MiscUtils;
43import com.jogamp.opengl.test.junit.util.UITestCase;
44import com.jogamp.opengl.util.GLPixelBuffer.GLPixelAttributes;
45import com.jogamp.opengl.util.GLPixelBuffer.GLPixelBufferProvider;
46import com.jogamp.opengl.util.GLReadBufferUtil;
47import com.jogamp.opengl.util.texture.TextureIO;
49@FixMethodOrder(MethodSorters.NAME_ASCENDING)
51 static long durationPerTest = 60;
53 public static void main(
final String[] args) {
54 for(
int i=0; i<args.length; i++) {
55 if(args[i].equals(
"-time")) {
59 System.out.println(
"durationPerTest: "+durationPerTest);
61 org.junit.runner.JUnitCore.
main(tstname);
66 testImpl(
false,
false,
false,
false);
70 testImpl(
false,
true,
false,
false);
75 testImpl(
true,
false,
false,
false);
79 testImpl(
true,
true,
false,
false);
83 testImpl(
false,
true,
true,
false);
87 testImpl(
false,
true,
false,
true);
91 testImpl(
true,
true,
true,
false);
95 testImpl(
true,
true,
false,
true);
98 private void testImpl(
final boolean alphaCaps,
final boolean readAlpha,
final boolean pbuffer,
final boolean fbo)
throws InterruptedException {
110 int displayCount = 0;
115 final GLPixelAttributes pixelAttribs = pixelBufferProvider.
getAttributes(drawable.
getGL(), readAlpha ? 4 : 3,
true);
116 System.err.println(
"GLPixelAttributes: "+pixelAttribs);
117 snapshot(displayCount++,
null, drawable.
getGL(), screenshot, TextureIO.PNG,
null);
119 public void reshape(
final GLAutoDrawable drawable,
final int x,
final int y,
final int width,
final int height) { }
125 Thread.sleep(durationPerTest);
void setAlphaBits(final int alphaBits)
Sets the number of bits requested for the color buffer's alpha component.
An implementation of GLAutoDrawable and Window interface, using a delegated Window instance,...
final void setSize(final int width, final int height)
Sets the size of the window's client area in window units, excluding decorations.
final void setVisible(final boolean visible)
Calls setVisible(true, visible), i.e.
final void destroy()
Destroys all resources associated with this GLAutoDrawable, inclusive the GLContext.
final void requestFocus()
Request focus for this native window.
static GLWindow create(final GLCapabilitiesImmutable caps)
Creates a new GLWindow attaching a new Window referencing a new default Screen and default Display wi...
Specifies a set of OpenGL capabilities.
void setPBuffer(final boolean enable)
Requesting offscreen pbuffer mode.
void setFBO(final boolean enable)
Requesting offscreen FBO mode.
Specifies the the OpenGL profile.
static GLProfile getGL2ES2(final AbstractGraphicsDevice device)
Returns the GL2ES2 profile implementation, hence compatible w/ GL2ES2.
void test22_RGBtoRGBA_fbo()
void test21_RGBtoRGBA_pbuffer()
static void main(final String[] args)
void test32_RGBAtoRGBA_fbo()
void test31_RGBAtoRGBA_pbuffer()
static int atoi(final String str, final int def)
Utility to read out the current FB to TextureData, optionally writing the data back to a texture obje...
GLPixelBufferProvider getPixelBufferProvider()
Returns the GLPixelBufferProvider used by this instance.
A higher-level abstraction than GLDrawable which supplies an event based mechanism (GLEventListener) ...
GL getGL()
Returns the GL pipeline object this GLAutoDrawable uses.
void addGLEventListener(GLEventListener listener)
Adds the given listener to the end of this drawable queue.
Declares events which client code can use to manage OpenGL rendering into a GLAutoDrawable.
GLPixelAttributes getAttributes(GL gl, int componentCount, boolean pack)
Returns RGB[A] GLPixelAttributes matching GL, componentCount and pack.