28package com.jogamp.opengl.test.junit.graph;
31import java.io.IOException;
33import com.jogamp.opengl.GLCapabilities;
34import com.jogamp.opengl.GLCapabilitiesImmutable;
35import com.jogamp.opengl.GLException;
36import com.jogamp.opengl.GLProfile;
38import jogamp.common.os.PlatformPropsImpl;
40import org.junit.Assert;
41import org.junit.BeforeClass;
43import org.junit.FixMethodOrder;
44import org.junit.runners.MethodSorters;
46import com.jogamp.common.os.Platform;
47import com.jogamp.common.util.VersionUtil;
48import com.jogamp.graph.curve.Region;
49import com.jogamp.graph.font.Font;
50import com.jogamp.graph.font.FontFactory;
51import com.jogamp.newt.opengl.GLWindow;
52import com.jogamp.opengl.test.junit.util.UITestCase;
53import com.jogamp.opengl.util.caps.NonFSAAGLCapsChooser;
62@FixMethodOrder(MethodSorters.NAME_ASCENDING)
64 static final boolean DEBUG =
false;
65 static final boolean TRACE =
false;
66 static long duration = 100;
67 static int win_width = 1280;
68 static int win_height = 720;
69 static int[] aaQualitySet =
new int[] { 0, 1 };
70 static int[] sampleSet =
new int[] { 4 };
71 static Font[] fontSet =
new Font[] { };
72 static boolean onlyOne =
false;
78 }
catch (
final IOException e) {
83 static int atoi(
final String a) {
85 return Integer.parseInt(a);
86 }
catch (
final Exception ex) {
throw new RuntimeException(ex); }
89 public static void main(
final String args[])
throws IOException {
90 for(
int i=0; i<args.length; i++) {
91 if(args[i].equals(
"-time")) {
93 duration = atoi(args[i]);
94 }
else if(args[i].equals(
"-one")) {
96 }
else if(args[i].equals(
"-width")) {
98 win_width = atoi(args[i]);
99 }
else if(args[i].equals(
"-height")) {
101 win_height = atoi(args[i]);
102 }
else if(args[i].equals(
"-font")) {
105 }
else if(args[i].equals(
"-samples")) {
107 sampleSet =
new int[] { atoi(args[i]) };
108 }
else if(args[i].equals(
"-aaq")) {
110 aaQualitySet =
new int[] { atoi(args[i]) };
114 org.junit.runner.JUnitCore.
main(tstname);
117 static void sleep() {
119 System.err.println(
"** new frame ** (sleep: "+duration+
"ms)");
120 Thread.sleep(duration);
121 }
catch (
final InterruptedException ie) {}
124 static void destroyWindow(
final GLWindow window) {
130 static GLWindow createWindow(
final String title,
final GLCapabilitiesImmutable caps,
final int width,
final int height) {
131 Assert.assertNotNull(caps);
133 final GLWindow window = GLWindow.create(caps);
134 if( !caps.getSampleBuffers() ) {
137 window.setCapabilitiesChooser(
new NonFSAAGLCapsChooser(
true));
139 window.setSize(width, height);
140 window.setPosition(10, 10);
141 window.setTitle(title);
142 Assert.assertNotNull(window);
143 window.setVisible(
true);
148 class TestAction
implements Runnable {
149 private final GLWindow window;
150 private final int renderModes;
151 private final int graphAAQuality;
152 private final int graphSampleCount;
153 private final Font font;
154 private boolean keepAlive =
false;
156 public TestAction(
final GLWindow window,
final int renderModes,
final int graphAAQuality,
final int graphSampleCount,
final Font font) {
157 this.window = window;
158 this.renderModes = renderModes;
159 this.graphAAQuality = graphAAQuality;
160 this.graphSampleCount = graphSampleCount;
163 public void setKeepAlive(
final boolean v) { keepAlive = v; }
167 final int fsaaSampleCount = window.getChosenGLCapabilities().getNumSamples();
169 System.err.printf(
"Test Run: %s, %s%n",
170 Region.getRenderModeString(renderModes, 0, graphSampleCount, fsaaSampleCount),
171 font.getFullFamilyName());
172 final FontViewListener01 glel =
new FontViewListener01(renderModes, graphAAQuality, graphSampleCount, font,
'!' );
173 glel.attachInputListenerTo(window);
174 window.addGLEventListener(glel);
176 glel.printScreenOnGLThread(window,
"./", window.getTitle(),
"",
false);
179 window.disposeGLEventListener(glel,
true);
182 System.err.printf(
"Test Skipped: %s, font not available%n",
183 Region.getRenderModeString(renderModes, 0, graphSampleCount, fsaaSampleCount));
191 System.err.println(
"disabled !onlyOne");
198 System.err.println(
"Requested: "+caps);
200 final GLWindow window = createWindow(
"TTRN21", caps, win_width, win_height);
202 System.err.println(VersionUtil.getPlatformInfo());
207 ta.setKeepAlive(
true);
213 if( onlyOne || Platform.CPUFamily.X86 != PlatformPropsImpl.CPU_ARCH.family ) {
215 System.err.println(
"disabled on non desktop (x86) arch for now ..");
222 System.err.println(
"Requested: "+caps);
224 final GLWindow window = createWindow(
"TTRN21", caps, win_width, win_height);
226 System.err.println(VersionUtil.getPlatformInfo());
230 for(
final Font f : fontSet) {
231 for(
final int aaQuality : aaQualitySet ) {
232 for(
final int sampleCount : sampleSet ) {
237 destroyWindow(window);
242 if( onlyOne || Platform.CPUFamily.X86 != PlatformPropsImpl.CPU_ARCH.family ) {
244 System.err.println(
"disabled on non desktop (x86) arch for now ..");
251 System.err.println(
"Requested: "+caps);
253 final GLWindow window = createWindow(
"TTRN21", caps, win_width, win_height);
257 for(
final Font f : fontSet) {
258 for(
final int sampleCount : sampleSet ) {
262 destroyWindow(window);
275 System.err.println(
"Requested: "+caps);
277 final GLWindow window = createWindow(
"TTRN21", caps, win_width, win_height);
281 for(
final Font f : fontSet) {
284 destroyWindow(window);
295 System.err.println(
"Requested: "+caps);
297 final GLWindow window = createWindow(
"TTRN21", caps, win_width, win_height);
301 for(
final Font f : fontSet) {
304 destroyWindow(window);
Abstract Outline shape representation define the method an OutlineShape(s) is bound and rendered.
static final int MSAA_RENDERING_BIT
Rendering-Mode bit for Region.
static final int NORM_RENDERING_BIT
Rendering-Mode bit for Region.
static final int VBAA_RENDERING_BIT
Rendering-Mode bit for Region.
The optional property jogamp.graph.font.ctor allows user to specify the FontConstructor implementatio...
static final FontSet get(final int font)
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,...
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.
A generic exception for OpenGL errors used throughout the binding as a substitute for RuntimeExceptio...
Specifies the the OpenGL profile.
static final String GL2ES2
The intersection of the desktop GL3, GL2 and embedded ES2 profile.
static GLProfile get(final AbstractGraphicsDevice device, String profile)
Returns a GLProfile object.
static GLProfile getGL2ES2(final AbstractGraphicsDevice device)
Returns the GL2ES2 profile implementation, hence compatible w/ GL2ES2.
TestTextRendererNEWT21 Variant.
void test00TextRendererVBAA01()
void test10TextRendererMSAA01()
void test20TextRendererFSAA01()
void test30TextRendererNoSampling()
static void main(final String args[])
Interface wrapper for font implementation.
GLCapabilitiesImmutable getChosenGLCapabilities()
Fetches the GLCapabilitiesImmutable corresponding to the chosen OpenGL capabilities (pixel format / v...