JOGL v2.6.0-rc-20250706
JOGL, High-Performance Graphics Binding for Java™ (public API).
PerfTextRendererNEWT00.java
Go to the documentation of this file.
1/**
2 * Copyright 2011-2024 JogAmp Community. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without modification, are
5 * permitted provided that the following conditions are met:
6 *
7 * 1. Redistributions of source code must retain the above copyright notice, this list of
8 * conditions and the following disclaimer.
9 *
10 * 2. Redistributions in binary form must reproduce the above copyright notice, this list
11 * of conditions and the following disclaimer in the documentation and/or other materials
12 * provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
15 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
16 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
19 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
21 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
22 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 *
24 * The views and conclusions contained in the software and documentation are those of the
25 * authors and should not be interpreted as representing official policies, either expressed
26 * or implied, of JogAmp Community.
27 */
28package com.jogamp.opengl.test.junit.graph;
29
30import java.io.File;
31import java.io.IOException;
32import java.io.PrintStream;
33import java.time.Duration;
34import java.time.Instant;
35import java.util.Locale;
36import java.util.concurrent.TimeUnit;
37
38import com.jogamp.opengl.GL;
39import com.jogamp.opengl.GL2ES2;
40import com.jogamp.opengl.GLCapabilities;
41import com.jogamp.opengl.GLDrawable;
42import com.jogamp.opengl.GLException;
43import com.jogamp.opengl.GLProfile;
44import com.jogamp.opengl.JoglVersion;
45
46import com.jogamp.common.os.Clock;
47import com.jogamp.common.util.IOUtil;
48import com.jogamp.common.util.VersionUtil;
49import com.jogamp.graph.curve.Region;
50import com.jogamp.graph.curve.opengl.RenderState;
51import com.jogamp.graph.curve.opengl.GLRegion;
52import com.jogamp.graph.curve.opengl.RegionRenderer;
53import com.jogamp.graph.curve.opengl.TextRegionUtil;
54import com.jogamp.graph.font.Font;
55import com.jogamp.graph.font.FontFactory;
56import com.jogamp.math.Vec4f;
57import com.jogamp.math.geom.AABBox;
58import com.jogamp.math.geom.plane.AffineTransform;
59import com.jogamp.math.util.PMVMatrix4f;
60import com.jogamp.opengl.test.junit.util.MiscUtils;
61import com.jogamp.opengl.test.junit.util.NEWTGLContext;
62import com.jogamp.opengl.util.GLReadBufferUtil;
63
64
65/**
66 * TestTextRendererNEWT00 Variant
67 * - Testing GLRegion properties, i.e. overflow bug
68 * - No listener, all straight forward
69 * - Type Rendering vanilla via TextRegionUtil.addStringToRegion(..)
70 * - GLRegion.addOutlineShape( Font.processString(..) )
71 * - Using a single GLRegion instantiation
72 * - Single GLRegion is filled once with shapes from text
73 */
75 static final Instant t0i = Clock.getMonotonicTime();
76 static final long t0 = Clock.currentNanos();
77 static final boolean DEBUG = false;
78 static final boolean TRACE = false;
79 static long duration = 100; // ms
80 static boolean forceES2 = false;
81 static boolean forceGL3 = false;
82 static int win_width = 1280;
83 static int win_height = 720;
84 static int loop_count = 1;
85 static boolean do_perf = false;
86 static boolean do_snap = false;
87 static boolean do_vsync = false;
88
89 static Font font;
90 private final Vec4f fg_color = new Vec4f( 0, 0, 0, 1 );
91
92 static {
93 try {
94 font = FontFactory.get(IOUtil.getResource("fonts/freefont/FreeSans.ttf",
95 FontSet01.class.getClassLoader(), FontSet01.class).getInputStream(), true);
96 // font = FontFactory.get(FontFactory.UBUNTU).get(FontSet.FAMILY_LIGHT, FontSet.STYLE_NONE);
97 } catch (final IOException e) {
98 e.printStackTrace();
99 }
100 }
101
102 public static void main(final String args[]) throws IOException, GLException, InterruptedException {
103 String text = PerfTextRendererNEWT00.text_1;
104 boolean wait = false;
105 for(int i=0; i<args.length; i++) {
106 if(args[i].equals("-time")) {
107 i++;
108 duration = MiscUtils.atol(args[i], duration);
109 } else if(args[i].equals("-width")) {
110 i++;
111 win_width = MiscUtils.atoi(args[i], win_width);
112 } else if(args[i].equals("-height")) {
113 i++;
114 win_height = MiscUtils.atoi(args[i], win_height);
115 } else if(args[i].equals("-es2")) {
116 forceES2 = true;
117 } else if(args[i].equals("-gl3")) {
118 forceGL3 = true;
119 } else if(args[i].equals("-font")) {
120 i++;
121 font = FontFactory.get(IOUtil.getResource(args[i], PerfTextRendererNEWT00.class.getClassLoader(), PerfTextRendererNEWT00.class).getInputStream(), true);
122 } else if(args[i].equals("-wait")) {
123 wait = true;
124 } else if(args[i].equals("-loop")) {
125 i++;
126 loop_count = MiscUtils.atoi(args[i], loop_count);
127 if( 0 >= loop_count ) {
128 loop_count = Integer.MAX_VALUE;
129 }
130 } else if(args[i].equals("-long_text")) {
132 } else if(args[i].equals("-vsync")) {
133 do_vsync = true;
134 } else if(args[i].equals("-perf")) {
135 do_perf = true;
136 } else if(args[i].equals("-snap")) {
137 do_snap = true;
138 }
139 }
140 System.err.println("Excessuive performance test enabled: "+do_perf);
141 System.err.println("VSync requested: "+do_vsync);
142 if( wait ) {
143 MiscUtils.waitForKey("Start");
144 }
145 final int renderModes = Region.VBAA_RENDERING_BIT /* | Region.COLORCHANNEL_RENDERING_BIT */;
146 final int sampleCount = 4;
147
149 obj.test(renderModes, sampleCount, text);
150 }
151
152 static void sleep() {
153 try {
154 System.err.println("** new frame ** (sleep: "+duration+"ms)");
155 Thread.sleep(duration);
156 } catch (final InterruptedException ie) {}
157 }
158
159 static class Perf {
160 // all td_ values are in [ns]
161 public long td_graph = 0;
162 public long td_txt = 0;
163 public long td_draw = 0;
164 public long td_txt_draw = 0;
165 public long count = 0;
166
167 public Perf() {
168 final Instant startupMTime = Clock.getMonotonicStartupTime();
169 final Instant currentMTime = Clock.getMonotonicTime();
170 final Instant wallTime = Clock.getWallClockTime();
171 final Duration elapsedSinceStartup = Duration.between(startupMTime, currentMTime);
172 System.err.printf("Perf: Elapsed since startup: %,d [ms], %,d [ns]%n", elapsedSinceStartup.toMillis(), elapsedSinceStartup.toNanos());
173 System.err.printf("- monotonic startup %s, %,d [ms]%n", startupMTime, startupMTime.toEpochMilli());
174 System.err.printf("- monotonic current %s, %,d [ms]%n", currentMTime, currentMTime.toEpochMilli());
175 System.err.printf("- wall current %s%n", wallTime);
176 final long td = Clock.currentNanos();
177 System.err.printf("- currentNanos: Elapsed %,d [ns]%n", (td-t0));
178 System.err.printf(" - test-startup %,13d [ns]%n", t0);
179 System.err.printf(" - test-current %,13d [ns]%n", td);
180 }
181
182 public void clear() {
183 td_graph = 0;
184 td_txt = 0;
185 td_draw = 0;
186 td_txt_draw = 0;
187 count = 0;
188 }
189
190 public void print(final PrintStream out, final long frame, final String msg) {
191 out.printf("%3d / %3d: Perf %s: Total: graph %,2d, txt %,2d, draw %,2d, txt+draw %,2d [ms]%n",
192 count, frame, msg,
193 TimeUnit.NANOSECONDS.toMillis(td_graph),
194 TimeUnit.NANOSECONDS.toMillis(td_txt),
195 TimeUnit.NANOSECONDS.toMillis(td_draw), TimeUnit.NANOSECONDS.toMillis(td_txt_draw));
196 out.printf("%3d / %3d: Perf %s: PerLoop: graph %,4d, txt %,4d, draw %,4d, txt+draw %,4d [ns]%n",
197 count, frame, msg,
198 td_graph/count, td_txt/count, td_draw/count, td_txt_draw/count );
199 }
200 }
201
202 public void test(final int renderModes, final int sampleCount, final String text) throws InterruptedException, GLException, IOException {
203 final GLProfile glp;
204 if(forceGL3) {
205 glp = GLProfile.get(GLProfile.GL3);
206 } else if(forceES2) {
208 } else {
209 glp = GLProfile.getGL2ES2();
210 }
211
212 final Instant t1i = Clock.getMonotonicTime();
213 final long t1 = Clock.currentNanos();
214
215 final GLCapabilities caps = new GLCapabilities( glp );
216 caps.setAlphaBits(4);
217
218 final NEWTGLContext.WindowContext winctx = NEWTGLContext.createWindow(caps, win_width, win_height, false); // true);
219 final GLDrawable drawable = winctx.context.getGLDrawable();
220 final GL2ES2 gl = winctx.context.getGL().getGL2ES2();
221 if( !do_vsync ) {
222 gl.setSwapInterval(0);
223 }
224 {
225 final int glerr = gl.glGetError();
226 if( GL.GL_NO_ERROR != glerr ) {
227 System.err.println("Initial GL Error: "+glerr);
228 }
229 }
230 System.err.println(VersionUtil.getPlatformInfo());
231 System.err.println(JoglVersion.getAllAvailableCapabilitiesInfo(winctx.window.getScreen().getDisplay().getGraphicsDevice(), null).toString());
232 System.err.println(JoglVersion.getGLInfo(gl, null, false /* withCapsAndExts */).toString());
233 System.err.println("VSync Swap Interval: "+gl.getSwapInterval());
234 System.err.println("GLDrawable surface size: "+winctx.context.getGLDrawable().getSurfaceWidth()+" x "+winctx.context.getGLDrawable().getSurfaceHeight());
235
236 System.err.println("Requested Caps: "+caps);
237 System.err.println("Requested Region-RenderModes: "+Region.getRenderModeString(renderModes));
238 System.err.println("Chosen Caps: "+winctx.window.getChosenCapabilities());
239 System.err.println("Chosen Font: "+font.getFullFamilyName());
240
241 final GLReadBufferUtil screenshot = new GLReadBufferUtil(false, false);
242
246 renderer.setSampleCount(sampleCount);
247
248 final GLRegion region = GLRegion.create(gl.getGLProfile(), renderModes, null, font, text);
249 System.err.println("Region post ctor w/ pre-calculated buffer size");
250 region.printBufferStats(System.err);
251
252 final Perf perf = new Perf();
253 if( do_perf ) {
254 region.perfCounter().enable(true);
255 }
256
257 final AffineTransform translation = new AffineTransform();
258 final AffineTransform tmp1 = new AffineTransform();
259 final AffineTransform tmp2 = new AffineTransform();
260
261 for(int loop_i=0; loop_i < loop_count; ++loop_i) {
262 final long t2 = Clock.currentNanos(); // all initialized but graph
263 if( null != perf ) {
264 ++perf.count;
265 }
266
267 // init
268 // final GLRegion region = GLRegion.create(gl.getGLProfile(), renderModes, null);
269 // region.growBufferSize(123000, 62000); // hack-me
270 gl.glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
271 renderer.init(gl);
272 renderer.setColorStatic(0.1f, 0.1f, 0.1f, 1.0f);
273
274 // reshape
275 gl.glViewport(0, 0, drawable.getSurfaceWidth(), drawable.getSurfaceHeight());
276
277 // renderer.reshapePerspective(gl, 45.0f, drawable.getWidth(), drawable.getHeight(), 0.1f, 1000.0f);
278 renderer.reshapeOrtho(drawable.getSurfaceWidth(), drawable.getSurfaceHeight(), 0.1f, 1000.0f);
279 final int z0 = -1000;
280
281 // display
283 region.clear(gl);
284
285 final long t3 = Clock.currentNanos(); // all initialized w/ graph
286
287 final long t4;
288 final float fontScale;
289 {
290 // all sizes in em
291 final float x_width = font.getAdvanceWidth( font.getGlyphID('X') );
292
293 translation.setToTranslation(2*x_width, 0f);
294 final AABBox tbox_1 = font.getGlyphBounds(text, tmp1, tmp2);
295 final AABBox rbox_1 = TextRegionUtil.addStringToRegion(region, font, translation, text, fg_color, tmp1, tmp2);
296 t4 = Clock.currentNanos(); // text added to region
297 // int dw = drawable.getSurfaceWidth() -
298 fontScale = drawable.getSurfaceWidth() / ( rbox_1.getWidth() + 4*x_width ); // 2l + 2r
299 if( 0 == loop_i && !do_perf ) {
300 System.err.println("Text_1: tbox "+tbox_1);
301 System.err.println("Text_1: rbox "+rbox_1);
302 System.err.println("Font scale: "+fontScale);
303 }
304 }
305 final float dx = 0;
306 final float dy = drawable.getSurfaceHeight() - 2 * fontScale * font.getLineHeight();
307
308 final PMVMatrix4f pmv = renderer.getMatrix();
309 pmv.loadMvIdentity();
310 pmv.translateMv(dx, dy, z0);
311 pmv.scaleMv(fontScale, fontScale, 1f);
312 region.draw(gl, renderer);
313 final long t5 = Clock.currentNanos(); // text added to region
314 if( null != perf ) {
315 final long td_graph = t3 - t2;
316 final long td_txt = t4 - t3;
317 final long td_draw = t5 - t4;
318 final long td_txt_draw = t5 - t3;
319 perf.td_graph += td_graph;
320 perf.td_txt += td_txt;
321 perf.td_draw += td_draw;
322 perf.td_txt_draw += td_txt_draw;
323 if( 0 == loop_i ) {
324 final Duration td_launch0a = Duration.between(Clock.getMonotonicStartupTime(), t0i); // loading Gluegen - load test
325 final Duration td_launch0b = Duration.between(Clock.getMonotonicStartupTime(), t1i); // loading Gluegen - start test
326 final long td_launch1 = t1 - t0; // since loading this test
327 final long td_launch2 = t2 - t0; // gl
328 final long td_launch3 = t3 - t0; // w/ graph
329 final long td_launch_txt = t4 - t0;
330 final long td_launch_draw = t5 - t0;
331 System.err.printf("%n%n%3d: Perf Launch:%n"+
332 "- loading GlueGen - loading test %,6d [ms]%n"+
333 "- loading GlueGen - start test %,6d [ms]%n"+
334 "- loading test - start test %,6d [ms]%n"+
335 "- loading test - gl %,6d [ms]%n"+
336 "- loading test - graph %,6d [ms]%n"+
337 "- loading test - txt %,6d [ms]%n"+
338 "- loading test - draw %,6d [ms]%n",
339 loop_i+1,
340 td_launch0a.toMillis(), td_launch0b.toMillis(),
341 TimeUnit.NANOSECONDS.toMillis(td_launch1), TimeUnit.NANOSECONDS.toMillis(td_launch2),
342 TimeUnit.NANOSECONDS.toMillis(td_launch3), TimeUnit.NANOSECONDS.toMillis(td_launch_txt),
343 TimeUnit.NANOSECONDS.toMillis(td_launch_draw));
344 perf.print(System.err, loop_i+1, "Launch");
345 }
346 }
347 if( loop_count - 1 == loop_i && do_snap ) {
348 // print screen at end
349 gl.glFinish();
350 printScreen(screenshot, renderModes, drawable, gl, false, sampleCount);
351 }
352 drawable.swapBuffers();
353 if( null != perf && loop_count/2-1 == loop_i ) {
354 // print + reset counter @ 1/3 loops
355 if( do_perf ) {
356 region.perfCounter().print(System.err);
357 }
358 perf.print(System.err, loop_i+1, "Frame"+(loop_i+1));
359 perf.clear();
360 if( do_perf ) {
361 region.perfCounter().clear();
362 }
363 }
364 if( 0 == loop_i || loop_count - 1 == loop_i) {
365 // print counter @ start and end
366 System.err.println("GLRegion: for "+gl.getGLProfile()+" using int32_t indiced: "+region.usesI32Idx());
367 System.err.println("GLRegion: "+region);
368 System.err.println("Text length: "+text.length());
369 region.printBufferStats(System.err);
370 if( do_perf ) {
371 region.perfCounter().print(System.err);
372 }
373 perf.print(System.err, loop_i+1, "Frame"+(loop_i+1));
374 }
375 // region.destroy(gl);
376 }
377
378 region.destroy(gl);
379
380 sleep();
381
382 // dispose
383 screenshot.dispose(gl);
384 renderer.destroy(gl);
385
387 }
388 public static final String text_long =
389 "JOGL: Java™ Binding for OpenGL®, providing hardware-accelerated 3D graphics.\n\n"+
390 "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec nec sapien tellus.\n"+
391 "Ut purus odio, rhoncus sit amet commodo eget, ullamcorper vel urna. Mauris ultricies\n"+
392 "quam iaculis urna cursus ornare. Nullam ut felis a ante ultrices ultricies nec a elit.\n"+
393 "In hac habitasse platea dictumst. Vivamus et mi a quam lacinia pharetra at venenatis est.\n"+
394 "Morbi quis bibendum nibh. Donec lectus orci, sagittis in consequat nec, volutpat nec nisi.\n"+
395 "Donec ut dolor et nulla tristique varius. In nulla magna, fermentum id tempus quis, semper\n"+
396 "Maecenas in ipsum ac justo scelerisque sollicitudin. Quisque sit amet neque lorem,\n" +
397 "I “Ask Jeff” or ‘Ask Jeff’. Take the chef d’œuvre! Two of [of] (of) ‘of’ “of” of? of! of*.\n"+
398 "Les Woëvres, the Fôret de Wœvres, the Voire and Vauvise. Yves is in heaven.\n"+
399 "Lyford’s in Texas & L’Anse-aux-Griffons in Québec; the Łyna in Poland. Yriarte is in Yale.\n"+
400 "Kyoto and Ryotsu are both in Japan, Kwikpak on the Yukon delta, Kvæven in Norway…\n"+
401 "Von-Vincke-Straße in Münster, Vdovino in Russia, Ytterbium in the periodic table.\n"+
402 "Miłosz and Wū Wŭ all in the library? 1510–1620, 11:00 pm, and the 1980s are over.\n"+
403 "Ut purus odio, rhoncus sit amet commodo eget, ullamcorper vel urna. Mauris ultricies \n"+
404 "-------Press H to change text---------";
405
406 public static final String text_1b =
407 "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec nec sapien tellus. \n"+
408 "Ut purus odio, rhoncus sit amet commodo eget, ullamcorper vel urna. Mauris ultricies \n"+
409 "quam iaculis urna cursus ornare. Nullam ut felis a ante ultrices ultricies nec a elit. \n"+
410 "In hac habitasse platea dictumst. Vivamus et mi a quam lacinia pharetra at venenatis est. \n"+
411 "Morbi quis bibendum nibh. Donec lectus orci, sagittis in consequat nec, volutpat nec nisi. \n"+
412 "Donec ut dolor et nulla tristique varius. In nulla magna, fermentum id tempus quis, semper \n"+
413 "in lorem. Maecenas in ipsum ac justo scelerisque sollicitudin. Quisque sit amet neque lorem, \n" +
414 "I “Ask Jeff” or ‘Ask Jeff’. Take the chef d’œuvre! Two of"+
415 "abcdefh";
416 // ^
417 // |
418 //"abcdefgh";
419 // ^
420 // |
421
422 public static final String text_1s = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec nec sapien tellus.";
423 public static final String text_1 =
424 "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec nec sapien tellus. \n"+
425 "Ut purus odio, rhoncus sit amet commodo eget, ullamcorper vel urna. Mauris ultricies \n"+
426 "quam iaculis urna cursus ornare. Nullam ut felis a ante ultrices ultricies nec a elit. \n"+
427 "In hac habitasse platea dictumst. Vivamus et mi a quam lacinia pharetra at venenatis est. \n"+
428 "Morbi quis bibendum nibh. Donec lectus orci, sagittis in consequat nec, volutpat nec nisi. \n"+
429 "Donec ut dolor et nulla tristique varius. In nulla magna, fermentum id tempus quis, semper \n"+
430 "in lorem. Maecenas in ipsum ac justo scelerisque sollicitudin. Quisque sit amet neque lorem, \n" +
431 "-------Press H to change text---------";
432
433
434 public static void printScreen(final GLReadBufferUtil screenshot, final int renderModes, final GLDrawable drawable, final GL gl, final boolean exportAlpha, final int sampleCount) throws GLException, IOException {
435 final int screenshot_num = 0;
436 final String dir = "./";
437 final String objName = "TestTextRendererNEWT00-snap"+screenshot_num;
438 // screenshot_num++;
439 final String modeS = Region.getRenderModeString(renderModes);
440 final String bname = String.format((Locale)null, "%s-msaa%02d-%03dx%03d-%s%04d", objName,
441 drawable.getChosenGLCapabilities().getNumSamples(),
442 drawable.getSurfaceWidth(), drawable.getSurfaceHeight(), modeS, sampleCount);
443 final String filename = dir + bname +".png";
444 if(screenshot.readPixels(gl, false)) {
445 screenshot.write(new File(filename));
446 }
447 }
448
449}
Abstract Outline shape representation define the method an OutlineShape(s) is bound and rendered.
Definition: Region.java:62
static final int DEFAULT_AA_QUALITY
Default pass2 AA-quality rendering {@value} for Graph Region AA render-modes: VBAA_RENDERING_BIT.
Definition: Region.java:168
static String getRenderModeString(final int renderModes)
Returns a unique technical description string for renderModes as follows:
Definition: Region.java:251
PerfCounterCtrl perfCounter()
Definition: Region.java:553
final boolean usesI32Idx()
Returns true if implementation uses int32_t sized indices implying at least a GLProfile#isGL2ES3() al...
Definition: Region.java:305
A GLRegion is the OGL binding of one or more OutlineShapes Defined by its vertices and generated tria...
Definition: GLRegion.java:70
final GLRegion clear(final GL2ES2 gl)
Clears all buffers, i.e.
Definition: GLRegion.java:436
final void destroy(final GL2ES2 gl)
Delete and clear the associated OGL objects.
Definition: GLRegion.java:460
final void printBufferStats(final PrintStream out)
Print implementation buffer stats like detailed and total size and capacity in bytes etc.
Definition: GLRegion.java:317
final void draw(final GL2ES2 gl, final RegionRenderer renderer)
Renders the associated OGL objects specifying current width/hight of window for optional multi pass r...
Definition: GLRegion.java:518
static GLRegion create(final GLProfile glp, int renderModes, final TextureSequence colorTexSeq, final int pass2TexUnit, final int initialVerticesCount, final int initialIndicesCount)
Create a GLRegion using the passed render mode.
Definition: GLRegion.java:109
final void reshapeOrtho(final int width, final int height, final float near, final float far)
Orthogonal projection, method also calls reshapeNotify(int, int, int, int).
final void setColorStatic(final Vec4f rgbaColor)
final PMVMatrix4f getMatrix()
Borrow the current PMVMatrix4f.
final int setSampleCount(final int v)
Sets pass2 AA sample count clipped to the range [Region#MIN_AA_SAMPLE_COUNT..Region#MAX_AA_SAMPLE_COU...
static final GLCallback defaultBlendDisable
Default GL#GL_BLEND disable GLCallback, simply turning-off the GL#GL_BLEND state and turning-on depth...
final int setAAQuality(final int v)
Sets pass2 AA-quality rendering value clipped to the range [Region#MIN_AA_QUALITY....
static final GLCallback defaultBlendEnable
Default GL#GL_BLEND enable GLCallback, turning-off depth writing via GL#glDepthMask(boolean) if Rende...
final void init(final GL2ES2 gl)
Initialize shader and bindings for GPU based rendering bound to the given GL object's GLContext if no...
static RegionRenderer create()
Create a hardware accelerated RegionRenderer including its RenderState composition.
final void destroy(final GL2ES2 gl)
Deletes all ShaderPrograms and nullifies its references including RenderState#destroy(GL2ES2).
The RenderState is owned by RegionRenderer.
static final int BITHINT_GLOBAL_DEPTH_TEST_ENABLED
Bitfield hint, if set stating globally enabled GL#GL_DEPTH_TEST, otherwise disabled.
Text Type Rendering Utility Class adding the Font.Glyphs OutlineShape to a GLRegion.
static AABBox addStringToRegion(final Region region, final Font font, final AffineTransform transform, final CharSequence str, final Vec4f rgbaColor)
Add the string in 3D space w.r.t.
The optional property jogamp.graph.font.ctor allows user to specify the FontConstructor implementatio...
static final FontSet get(final int font)
4D Vector based upon four float components.
Definition: Vec4f.java:37
Axis Aligned Bounding Box.
Definition: AABBox.java:54
final float getWidth()
Definition: AABBox.java:879
final AffineTransform setToTranslation(final float mx, final float my)
PMVMatrix4f implements the basic computer graphics Matrix4f pack using projection (P),...
final PMVMatrix4f translateMv(final float x, final float y, final float z)
Translate the modelview matrix.
final PMVMatrix4f scaleMv(final float x, final float y, final float z)
Scale the modelview matrix.
final PMVMatrix4f loadMvIdentity()
Load the modelview matrix with the values of the given Matrix4f.
void setAlphaBits(final int alphaBits)
Sets the number of bits requested for the color buffer's alpha component.
Specifies a set of OpenGL capabilities.
A generic exception for OpenGL errors used throughout the binding as a substitute for RuntimeExceptio...
Specifies the the OpenGL profile.
Definition: GLProfile.java:77
static final String GL3
The desktop OpenGL core profile 3.x, with x >= 1.
Definition: GLProfile.java:576
static final String GLES2
The embedded OpenGL profile ES 2.x, with x >= 0.
Definition: GLProfile.java:585
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.
Definition: GLProfile.java:913
static StringBuilder getGLInfo(final GL gl, final StringBuilder sb)
static StringBuilder getAllAvailableCapabilitiesInfo(AbstractGraphicsDevice device, StringBuilder sb)
void test(final int renderModes, final int sampleCount, final String text)
static void printScreen(final GLReadBufferUtil screenshot, final int renderModes, final GLDrawable drawable, final GL gl, final boolean exportAlpha, final int sampleCount)
static void waitForKey(final String preMessage)
Definition: MiscUtils.java:100
static int atoi(final String str, final int def)
Definition: MiscUtils.java:57
static long atol(final String str, final long def)
Definition: MiscUtils.java:66
static WindowContext createWindow(final GLCapabilities caps, final int width, final int height, final boolean debugGL)
static void destroyWindow(final WindowContext winctx)
Utility to read out the current FB to TextureData, optionally writing the data back to a texture obje...
Interface wrapper for font implementation.
Definition: Font.java:60
float getLineHeight()
Returns line height, baseline-to-baseline in em-size [0..1], composed from ‘hhea’ table entries.
String getFullFamilyName()
Shall return the family and subfamily name, separated a dash.
AABBox getGlyphBounds(final CharSequence string)
Try using getGlyphBounds(CharSequence, AffineTransform, AffineTransform) to reuse AffineTransform ins...
int getGlyphID(final char codepoint)
Returns the Glyph ID mapped to given UTF16 (unicode) codepoint symbol.
float getAdvanceWidth(final int glyphID)
Returns advance-width of given glyphID in font em-size [0..1], sourced from hmtx table - same as Glyp...
GL getGL()
Casts this object to the GL interface.
GL2ES2 getGL2ES2()
Casts this object to the GL2ES2 interface.
GLProfile getGLProfile()
Returns the GLProfile associated with this GL object.
void setSwapInterval(int interval)
Set the swap interval of the current context and attached onscreen GLDrawable.
int getSwapInterval()
Return the current swap interval.
An abstraction for an OpenGL rendering target.
Definition: GLDrawable.java:51
int getSurfaceWidth()
Returns the width of this GLDrawable's surface client area in pixel units.
int getSurfaceHeight()
Returns the height of this GLDrawable's surface client area in pixel units.
void swapBuffers()
Swaps the front and back buffers of this drawable.
static final int GL_NO_ERROR
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_NO_ERROR" with expres...
Definition: GL.java:481
int glGetError()
Entry point to C language function: GLenum {@native glGetError}() Part of GL_ES_VERSION_2_0,...
static final int GL_COLOR_BUFFER_BIT
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_COLOR_BUFFER_BIT" wit...
Definition: GL.java:390
void glClearColor(float red, float green, float blue, float alpha)
Entry point to C language function: void {@native glClearColor}(GLfloat red, GLfloat green,...
void glClear(int mask)
Entry point to C language function: void {@native glClear}(GLbitfield mask) Part of GL_ES_VERSION_...
void glFinish()
Entry point to C language function: void {@native glFinish}() Part of GL_ES_VERSION_2_0,...
void glViewport(int x, int y, int width, int height)
Entry point to C language function: void {@native glViewport}(GLint x, GLint y, GLsizei width,...
static final int GL_DEPTH_BUFFER_BIT
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_DEPTH_BUFFER_BIT" wit...
Definition: GL.java:738