41package com.jogamp.opengl.test.junit.jogl.caps;
43import com.jogamp.opengl.GLAutoDrawable;
44import com.jogamp.opengl.GLCapabilities;
45import com.jogamp.opengl.GLCapabilitiesChooser;
46import com.jogamp.opengl.GLEventListener;
47import com.jogamp.opengl.GLProfile;
50import org.junit.FixMethodOrder;
51import org.junit.runners.MethodSorters;
53import com.jogamp.newt.opengl.GLWindow;
54import com.jogamp.opengl.test.junit.jogl.demos.es2.MultisampleDemoES2;
55import com.jogamp.opengl.test.junit.util.MiscUtils;
56import com.jogamp.opengl.test.junit.util.UITestCase;
57import com.jogamp.opengl.util.GLReadBufferUtil;
58import com.jogamp.opengl.util.texture.TextureIO;
60@FixMethodOrder(MethodSorters.NAME_ASCENDING)
62 static long durationPerTest = 60;
64 public static void main(
final String[] args) {
65 for(
int i=0; i<args.length; i++) {
66 if(args[i].equals(
"-time")) {
70 System.out.println(
"durationPerTest: "+durationPerTest);
72 org.junit.runner.JUnitCore.
main(tstname);
77 testMultiSampleAAImpl(
false,
false, 0);
82 testMultiSampleAAImpl(
false,
false, 8);
87 testMultiSampleAAImpl(
false,
true, 0);
90 @Test(timeout = 10000)
91 public
void testOffsreenPBufferMultiSampleAA8() throws InterruptedException {
92 testMultiSampleAAImpl(
false,
true, 8);
95 @Test(timeout = 10000)
96 public
void testOffscreenFBOMultiSampleAA0() throws InterruptedException {
97 testMultiSampleAAImpl(
true,
false, 0);
100 @Test(timeout = 10000)
101 public
void testOffsreenFBOMultiSampleAA8() throws InterruptedException {
102 testMultiSampleAAImpl(
true,
false, 8);
105 private void testMultiSampleAAImpl(
final boolean useFBO,
final boolean usePBuffer,
final int reqSamples)
throws InterruptedException {
120 final GLWindow window = GLWindow.create(caps);
121 window.setCapabilitiesChooser(chooser);
122 window.addGLEventListener(
new MultisampleDemoES2(reqSamples>0?
true:
false));
124 int displayCount = 0;
128 snapshot(displayCount++,
null, drawable.
getGL(), screenshot, TextureIO.PNG,
null);
130 public void reshape(
final GLAutoDrawable drawable,
final int x,
final int y,
final int width,
final int height) { }
132 window.setSize(512, 512);
133 window.setVisible(
true);
134 window.requestFocus();
136 Thread.sleep(durationPerTest);
void setAlphaBits(final int alphaBits)
Sets the number of bits requested for the color buffer's alpha component.
Specifies a set of OpenGL capabilities.
void setPBuffer(final boolean enable)
Requesting offscreen pbuffer mode.
void setFBO(final boolean enable)
Requesting offscreen FBO mode.
void setNumSamples(final int numSamples)
If sample buffers are enabled, indicates the number of buffers to be allocated.
void setSampleBuffers(final boolean enable)
Defaults to false.
Specifies the the OpenGL profile.
static GLProfile getGL2ES2(final AbstractGraphicsDevice device)
Returns the GL2ES2 profile implementation, hence compatible w/ GL2ES2.
void testOnscreenMultiSampleAA8()
void testOffscreenPBufferMultiSampleAA0()
static void main(final String[] args)
void testOnscreenMultiSampleAA0()
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...
A higher-level abstraction than GLDrawable which supplies an event based mechanism (GLEventListener) ...
GL getGL()
Returns the GL pipeline object this GLAutoDrawable uses.
Provides a mechanism by which applications can customize the window type selection for a given GLCapa...
Declares events which client code can use to manage OpenGL rendering into a GLAutoDrawable.