41package com.jogamp.opengl.test.junit.jogl.caps;
43import java.lang.reflect.InvocationTargetException;
44import java.awt.BorderLayout;
47import com.jogamp.opengl.GLAutoDrawable;
48import com.jogamp.opengl.GLCapabilities;
49import com.jogamp.opengl.GLCapabilitiesChooser;
50import com.jogamp.opengl.GLEventListener;
51import com.jogamp.opengl.GLProfile;
52import com.jogamp.opengl.awt.GLCanvas;
54import com.jogamp.opengl.test.junit.jogl.demos.es1.MultisampleDemoES1;
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;
61import org.junit.FixMethodOrder;
62import org.junit.runners.MethodSorters;
65@FixMethodOrder(MethodSorters.NAME_ASCENDING)
67 static long durationPerTest = 60;
70 public static void main(
final String[] args) {
71 for(
int i=0; i<args.length; i++) {
72 if(args[i].equals(
"-time")) {
76 System.out.println(
"durationPerTest: "+durationPerTest);
78 org.junit.runner.JUnitCore.
main(tstname);
83 testMultiSampleAAImpl(0);
88 testMultiSampleAAImpl(4);
93 testMultiSampleAAImpl(8);
96 private void testMultiSampleAAImpl(
final int reqSamples)
throws InterruptedException, InvocationTargetException {
107 canvas =
new GLCanvas(caps, chooser,
null);
110 int displayCount = 0;
114 snapshot(displayCount++,
null, drawable.
getGL(), screenshot, TextureIO.PNG,
null);
116 public void reshape(
final GLAutoDrawable drawable,
final int x,
final int y,
final int width,
final int height) { }
119 final Frame frame =
new Frame(
"Multi Samples "+reqSamples);
120 frame.setLayout(
new BorderLayout());
123 javax.swing.SwingUtilities.invokeAndWait(
new Runnable() {
125 frame.add(canvas, BorderLayout.CENTER);
127 frame.setVisible(
true);
128 canvas.requestFocus();
132 Thread.sleep(durationPerTest);
134 javax.swing.SwingUtilities.invokeAndWait(
new Runnable() {
136 frame.setVisible(
false);
137 frame.remove(canvas);
Specifies a set of OpenGL capabilities.
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 getMaxFixedFunc(final AbstractGraphicsDevice device, final boolean favorHardwareRasterizer)
Returns the highest profile, implementing the fixed function pipeline.
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.
void testOnscreenMultiSampleAA0()
static void main(final String[] args)
void testOnscreenMultiSampleAA8()
void testOnscreenMultiSampleAA4()
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.
void setSize(int width, int height)
Requests a new width and height for this AWTGLAutoDrawable.