28package com.jogamp.opengl.demos.graph.ui;
30import java.io.IOException;
31import java.net.URISyntaxException;
32import java.util.Arrays;
33import java.util.Random;
35import com.jogamp.common.net.Uri;
36import com.jogamp.common.os.Clock;
37import com.jogamp.common.util.IOUtil;
38import com.jogamp.common.util.InterruptSource;
39import com.jogamp.graph.curve.Region;
40import com.jogamp.graph.font.Font;
41import com.jogamp.graph.font.FontFactory;
42import com.jogamp.graph.ui.GraphShape;
43import com.jogamp.graph.ui.Group;
44import com.jogamp.graph.ui.Scene;
45import com.jogamp.graph.ui.Shape;
46import com.jogamp.graph.ui.AnimGroup;
47import com.jogamp.graph.ui.layout.Alignment;
48import com.jogamp.graph.ui.layout.Gap;
49import com.jogamp.graph.ui.layout.GridLayout;
50import com.jogamp.graph.ui.shapes.Button;
51import com.jogamp.graph.ui.shapes.Label;
52import com.jogamp.graph.ui.shapes.Rectangle;
53import com.jogamp.math.FloatUtil;
54import com.jogamp.math.Quaternion;
55import com.jogamp.math.Vec2f;
56import com.jogamp.math.Vec3f;
57import com.jogamp.math.Vec4f;
58import com.jogamp.math.geom.AABBox;
59import com.jogamp.newt.MonitorDevice;
60import com.jogamp.newt.event.KeyAdapter;
61import com.jogamp.newt.event.KeyEvent;
62import com.jogamp.newt.event.MouseAdapter;
63import com.jogamp.newt.event.MouseEvent;
64import com.jogamp.newt.event.WindowAdapter;
65import com.jogamp.newt.event.WindowEvent;
66import com.jogamp.newt.opengl.GLWindow;
67import com.jogamp.opengl.GL;
68import com.jogamp.opengl.GL2ES2;
69import com.jogamp.opengl.GLAnimatorControl;
70import com.jogamp.opengl.GLAutoDrawable;
71import com.jogamp.opengl.GLCapabilities;
72import com.jogamp.opengl.GLEventListener;
73import com.jogamp.opengl.GLProfile;
74import com.jogamp.opengl.JoglVersion;
75import com.jogamp.opengl.demos.graph.FontSetDemos;
76import com.jogamp.opengl.demos.util.CommandlineOptions;
77import com.jogamp.opengl.demos.util.MiscUtils;
78import com.jogamp.opengl.util.Animator;
79import com.jogamp.opengl.util.av.GLMediaPlayer;
80import com.jogamp.opengl.util.av.GLMediaPlayerFactory;
81import com.jogamp.opengl.util.av.GLMediaPlayer.GLMediaEventListener;
83import jogamp.graph.ui.TreeTool;
109 static final boolean DEBUG =
false;
111 static final String[] originalTexts = {
112 " JOGL, Java™ Binding for the OpenGL® API ",
113 " GraphUI, Resolution Independent Curves ",
114 " JogAmp, Java™ libraries for 3D & Media "
118 static float frame_velocity = 5f / 1e3f;
119 static float velocity = 30 / 1e3f;
120 static float ang_velo = velocity * 60f;
121 static int autoSpeed = -1;
123 static Uri audioUri =
null;
126 static final int[] manualScreenShorCount = { 0 };
128 static void setVelocity(
final float v) {
130 ang_velo = velocity * 60f;
134 public static void main(
final String[] args)
throws IOException {
135 setVelocity(80/1000f);
137 options.keepRunning =
true;
138 boolean showAnimBox =
true;
140 if (0 != args.length) {
141 final int[] idx = { 0 };
142 for (idx[0] = 0; idx[0] < args.length; ++idx[0]) {
143 if( options.
parse(args, idx) ) {
145 }
else if (args[idx[0]].equals(
"-v")) {
147 setVelocity(
MiscUtils.
atoi(args[idx[0]], (
int) velocity * 1000) / 1000f);
148 }
else if(args[idx[0]].equals(
"-aspeed")) {
149 setVelocity(80/1000f);
151 options.keepRunning =
true;
152 }
else if(args[idx[0]].equals(
"-rspeed")) {
155 }
else if(args[idx[0]].equals(
"-no_anim_box")) {
157 }
else if(args[idx[0]].equals(
"-audio")) {
160 audioUri = Uri.cast( args[idx[0]] );
161 }
catch (
final URISyntaxException e1) {
162 System.err.println(e1);
170 System.err.println(options);
173 System.out.println(
"Requested: " + reqCaps);
207 final float pixPerMM, dpiV;
215 animator.
add(window);
226 window.
invoke(
true, (drawable) -> {
227 final GL gl = drawable.
getGL();
236 final float sceneBoxFrameWidth;
238 sceneBoxFrameWidth = sceneBox.
getWidth() * 0.0025f;
241 r.
setColor(0.45f, 0.45f, 0.45f, 0.9f);
250 animGroup.
scale(0.85f, 0.85f, 1f);
254 animGroup.
scale(1.0f, 1.0f, 1f);
261 System.err.println(
"SceneBox " + sceneBox);
263 System.err.println(
"AnimGroup.0: "+animGroup);
265 final Label statusLabel;
267 final AABBox fbox = fontStatus.
getGlyphBounds(
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA");
269 System.err.println(
"StatusLabelScale: " + statusLabelScale +
" = " + sceneBox.
getWidth() +
" / " + fbox.
getWidth() +
", " + fbox);
271 statusLabel =
new Label(options.
renderModes, fontStatus,
"Nothing there yet");
272 statusLabel.
setScale(statusLabelScale, statusLabelScale, 1f);
273 statusLabel.
setColor(0.1f, 0.1f, 0.1f, 1.0f);
277 sub01SetupWindowListener(window, scene, animGroup, statusLabel, dpiV);
280 final StringBuilder sb =
new StringBuilder();
281 for(
final String s : originalTexts) {
282 sb.append(s).append(
"\n");
293 statusLabel.
setText(
"Press enter to continue");
297 window.
invoke(
true, (drawable) -> {
308 sub02AddUItoScene(scene, animGroup, 2, window);
313 final boolean[] z_only = {
true };
317 final float g_w = animBox.
getWidth();
318 System.err.println(
"AnimBox " + animBox);
319 System.err.println(
"AnimGroup.1 " + animGroup);
321 final float[] y_pos = { 0 };
322 window.
invoke(
true, (drawable) -> {
323 final float fontScale2;
325 final String vs =
"Welcome to Göthel Software *** Jausoft *** https://jausoft.com *** We do software ... Bremerhaven 19°C, Munich";
328 System.err.println(
"FontScale2: " + fontScale2 +
" = " + g_w +
" / " + fbox.
getWidth());
331 y_pos[0] = clippedBox.
getMaxY();
335 final String vs =
"Welcome to Göthel Software *** Jausoft *** https://jausoft.com *** We do software ... ";
336 y_pos[0] -= fontScale2 * 1.5f;
338 font, vs, fontScale2,
new Vec4f(0.1f, 0.1f, 0.1f, 0.9f),
339 50 / 1e3f , clippedBox, y_pos[0]);
344 final String vs =
"Berlin 23°C, London 20°C, Paris 22°C, Madrid 26°C, Lisbon 28°C, Moscow 22°C, Prag 22°C, Bremerhaven 19°C, Munich 25°C, Fukushima 40°C, Bejing 30°C, Rome 29°C, Beirut 28°C, Damaskus 29°C *** ";
345 y_pos[0] -= fontScale2 * 1.2f;
347 font, vs, fontScale2,
new Vec4f(0.1f, 0.1f, 0.1f, 0.9f),
348 30 / 1e3f , clippedBox, y_pos[0]);
356 if(
null != audioUri ) {
365 System.err.println();
366 System.err.println(
"Next animation loop ...");
372 final String curText = originalTexts[txt_idx];
373 final float fontScale;
374 final AnimGroup.
Set[] dynAnimSet = {
null,
null,
null };
378 System.err.println(
"FontScale: " + fontScale +
" = " + g_w +
" / " + fbox.
getWidth());
380 z_only[0] = !z_only[0];
381 window.
invoke(
true, (drawable) -> {
385 options.
renderModes, font, curText, fontScale,
new Vec4f(0.1f, 0.1f, 0.1f, 1f),
392 final GL gl = drawable.
getGL();
395 final float fontScale2;
398 fontScale2 = g_w / fbox.
getWidth() * 0.6f;
406 sd.shape.setColor(0.1f, 0.1f, 0.1f, 0.9f);
409 animBox.getMinX() + as.refShape.getScaledWidth() * 1.0f,
410 animBox.getMinY() + as.refShape.getScaledHeight() * 2.0f, 0f);
412 sd.startPos.set( sd.targetPos.x() + animBox.getWidth(),
413 sd.targetPos.y(), sd.targetPos.z());
414 sd.shape.moveTo( sd.startPos );
420 final float size2 = fontScale/2;
421 final float yscale = 1.1f;
427 final AnimGroup.ShapeSetup shapeSetup = (
final AnimGroup.Set as,
final int idx,
final AnimGroup.ShapeData sd) -> {
428 sd.targetPos.add(animBox.
getMinX() + as.refShape.getScaledWidth() * 1.0f,
429 y_pos[0] - as.refShape.getScaledHeight() * 1.5f, 0f);
431 sd.startPos.set( sd.targetPos.x() + animBox.
getWidth(),
432 sd.targetPos.y(), sd.targetPos.z());
433 sd.shape.moveTo( sd.startPos );
435 refShape.
setColor(1.0f, 0.0f, 0.0f, 0.9f);
437 dynAnimSet[2].addShape(animGroup, refShape, shapeSetup);
442 dynAnimSet[2].addShape(animGroup, s, shapeSetup);
449 dynAnimSet[2].addShape(animGroup, s, shapeSetup);
456 final long t0_us = Clock.currentNanos() / 1000;
457 while ( (
null == dynAnimSet[0] || dynAnimSet[0].isAnimationActive() || animGroup.
getTickPaused() ) && window.
isNativeValid() ) {
458 try { Thread.sleep(250); }
catch (
final InterruptedException e1) { }
461 final float has_dur_s = ((Clock.currentNanos() / 1000) - t0_us) / 1e6f;
462 System.err.printf(
"Text travel-duration %.3f s, %d chars%n", has_dur_s, curText.length());
463 if( scene.
getScreenshotCount() - manualScreenShorCount[0] < 1 + originalTexts.length ) {
466 try { Thread.sleep(1500); }
catch (
final InterruptedException e1) { }
468 try { Thread.sleep(250); }
catch (
final InterruptedException e1) { }
470 if( autoSpeed > 0 ) {
471 if( velocity < 60/1000f ) {
472 setVelocity(velocity + 9/1000f);
474 setVelocity(velocity - 9/1000f);
477 }
else if( autoSpeed < 0 ) {
478 if( velocity > 11/1000f ) {
479 setVelocity(velocity - 9/1000f);
481 setVelocity(velocity + 9/1000f);
485 txt_idx = ( txt_idx + 1 ) % originalTexts.length;
488 window.
invoke(
true, (drawable) -> {
504 static void sub01SetupWindowListener(
final GLWindow window,
final Scene scene,
final AnimGroup animGroup,
final Label statusLabel,
final float dpiV) {
512 public void windowDestroyNotify(
final WindowEvent e) {
514 if(
null != animator ) {
521 public void keyReleased(
final KeyEvent e) {
522 final short keySym = e.getKeySymbol();
523 if (keySym == KeyEvent.VK_PLUS ||
524 keySym == KeyEvent.VK_ADD)
526 if (e.isShiftDown()) {
527 setVelocity(velocity + 10 / 1000f);
529 setVelocity(velocity + 1 / 1000f);
531 }
else if (keySym == KeyEvent.VK_MINUS ||
532 keySym == KeyEvent.VK_SUBTRACT)
534 if (e.isShiftDown()) {
535 setVelocity(velocity - 10 / 1000f);
537 setVelocity(velocity - 1 / 1000f);
539 }
else if( keySym == KeyEvent.VK_F4 || keySym == KeyEvent.VK_ESCAPE || keySym == KeyEvent.VK_Q ) {
540 MiscUtils.destroyWindow(window);
541 }
else if( keySym == KeyEvent.VK_SPACE ) {
543 }
else if( keySym == KeyEvent.VK_ENTER ) {
550 public void mouseWheelMoved(
final MouseEvent e) {
552 if( e.isControlDown() ) {
554 }
else if( e.isAltDown() ) {
557 final float angle = e.getRotation()[1] < 0f ? FloatUtil.adegToRad(-1f) : FloatUtil.adegToRad(1f);
564 public void init(
final GLAutoDrawable drawable) {
565 System.err.println(JoglVersion.getGLInfo(drawable.getGL(),
null));
568 public void dispose(
final GLAutoDrawable drawable) {}
570 public void display(
final GLAutoDrawable drawable) {
573 final Vec3f euler = rot.
toEuler(
new Vec3f());
574 if( FloatUtil.HALF_PI <= euler.y() ) {
576 }
else if( euler.y() <= -FloatUtil.HALF_PI ) {
579 rot.rotateByAngleY( frame_velocity * dir );
582 final String text = String.format(
"%s, v %.1f mm/s, r %.3f rad/s",
587 public void reshape(
final GLAutoDrawable drawable,
final int x,
final int y,
final int width,
final int height) {}
598 static void sub02AddUItoScene(
final Scene scene,
final AnimGroup animGroup,
final int mainAnimSetIdx,
final GLWindow window)
throws IOException {
599 final AABBox sceneBox = scene.
getBounds();
600 final Group buttonsRight =
new Group();
602 final Font fontButtons = FontFactory.get(FontFactory.UBUNTU).getDefault();
603 final Font fontSymbols = FontFactory.get(FontFactory.SYMBOLS).getDefault();
605 final float buttonWidth = sceneBox.getWidth() * 0.09f;
606 final float buttonHeight = buttonWidth / 3.0f;
608 final Vec2f fixedSymSize =
new Vec2f(0.0f, 1.0f);
609 final Vec2f symSpacing =
new Vec2f(0f, 0.2f);
611 buttonsRight.setLayout(
new GridLayout(buttonWidth, buttonHeight, Alignment.Fill,
new Gap(buttonHeight*0.50f, buttonWidth*0.10f), 7));
613 final Button button =
new Button(options.
renderModes, fontSymbols,
614 fontSymbols.getUTF16String(
"play_arrow"), fontSymbols.getUTF16String(
"pause"),
615 buttonWidth, buttonHeight, buttonZOffset);
616 button.setSpacing(symSpacing, fixedSymSize);
617 button.onToggle((
final Shape s) -> {
618 System.err.println(
"Play/Pause "+s);
619 animGroup.setTickPaused ( s.isToggleOn() );
620 if( s.isToggleOn() ) {
621 animGroup.setTickPaused ( false );
622 if(
null != mPlayer ) {
626 animGroup.setTickPaused ( true );
627 if(
null != mPlayer ) {
628 mPlayer.
pause(
false);
632 button.setToggle(
true);
633 buttonsRight.addShape(button);
636 final Button button =
new Button(options.
renderModes, fontSymbols, fontSymbols.getUTF16String(
"fast_forward"), buttonWidth, buttonHeight, buttonZOffset);
637 button.setSpacing(symSpacing, fixedSymSize);
638 button.addMouseListener(
new Shape.MouseGestureAdapter() {
640 public void mouseClicked(final MouseEvent e) {
641 final AnimGroup.Set as = animGroup.getAnimSet(mainAnimSetIdx);
643 as.setAnimationActive(false);
646 buttonsRight.addShape(button);
649 final Button button =
new Button(options.
renderModes, fontSymbols,
650 fontSymbols.getUTF16String(
"rotate_right"), fontSymbols.getUTF16String(
"stop_circle"),
651 buttonWidth, buttonHeight, buttonZOffset);
652 button.setSpacing(symSpacing, fixedSymSize);
653 button.setToggleable(
true);
654 button.onToggle((
final Shape s) -> {
657 buttonsRight.addShape(button);
660 final Button button =
new Button(options.
renderModes, fontButtons,
" < Rot > ", buttonWidth, buttonHeight, buttonZOffset);
661 button.addMouseListener(
new Shape.MouseGestureAdapter() {
663 public void mouseClicked(final MouseEvent e) {
664 final Shape.EventInfo shapeEvent = (Shape.EventInfo) e.getAttachment();
666 if( e.isControlDown() ) {
668 } else if( e.isAltDown() ) {
671 if( shapeEvent.objPos.x() < shapeEvent.shape.getBounds().getCenter().x() ) {
672 rotateShape(animGroup, FloatUtil.adegToRad(1f), axis);
674 rotateShape(animGroup, FloatUtil.adegToRad(-1f), axis);
677 buttonsRight.addShape(button);
680 final Button button =
new Button(options.
renderModes, fontButtons,
" < Velo > ", buttonWidth, buttonHeight, buttonZOffset);
681 button.addMouseListener(
new Shape.MouseGestureAdapter() {
683 public void mouseClicked(final MouseEvent e) {
684 final Shape.EventInfo shapeEvent = (Shape.EventInfo) e.getAttachment();
685 final float scale = e.isShiftDown() ? 1f : 10f;
686 if( shapeEvent.objPos.x() < shapeEvent.shape.getBounds().getCenter().x() ) {
687 setVelocity(velocity - scale / 1000f);
689 setVelocity(velocity + scale / 1000f);
691 final AnimGroup.Set as = animGroup.getAnimSet(mainAnimSetIdx);
693 as.setAnimationActive(false);
696 buttonsRight.addShape(button);
699 final Button button =
new Button(options.
renderModes, fontSymbols, fontSymbols.getUTF16String(
"camera"), buttonWidth, buttonHeight, buttonZOffset);
700 button.setSpacing(symSpacing, fixedSymSize);
701 button.addMouseListener(
new Shape.MouseGestureAdapter() {
703 public void mouseClicked(final MouseEvent e) {
704 scene.screenshot(false, scene.nextScreenshotFile(null, UISceneDemo03.class.getSimpleName(), options.renderModes, window.getChosenGLCapabilities(), null));
705 manualScreenShorCount[0]++;
707 buttonsRight.addShape(button);
710 final Button button =
new Button(options.
renderModes, fontSymbols, fontSymbols.getUTF16String(
"power_settings_new"), buttonWidth, buttonHeight, buttonZOffset);
711 button.setSpacing(symSpacing, fixedSymSize);
712 button.setColor(0.7f, 0.3f, 0.3f, 1.0f);
713 button.addMouseListener(
new Shape.MouseGestureAdapter() {
715 public void mouseClicked(final MouseEvent e) {
716 MiscUtils.destroyWindow(window);
718 buttonsRight.addShape(button);
720 TreeTool.forAll(buttonsRight, (
final Shape s) -> { s.setDragAndResizable(
false);
return false; });
722 buttonsRight.moveTo(sceneBox.getWidth()/2f - buttonsRight.getScaledWidth()*1.02f,
723 sceneBox.getHeight()/2f - buttonsRight.getScaledHeight()*1.02f, 0f);
726 System.err.println(
"Buttons-Right: Button-1 "+buttonsRight.getShapes().get(0));
727 System.err.println(
"Buttons-Right: SceneBox "+sceneBox);
728 System.err.println(
"Buttons-Right: scaled "+buttonsRight.getScaledWidth()+
" x "+buttonsRight.getScaledHeight());
729 System.err.println(
"Buttons-Right: Box "+buttonsRight.getBounds());
730 System.err.println(
"Buttons-Right: "+buttonsRight);
746 final float sign = angle >= 0f ? 1f : -1f;
749 case 0: v = euler.x();
break;
750 case 1: v = euler.y();
break;
751 case 2: v = euler.z();
break;
754 final float av = Math.abs(v);
757 angle = 2f * eps * sign;
760 case 0: euler.
add(angle, 0, 0);
break;
761 case 1: euler.
add(0, angle, 0);
break;
762 case 2: euler.
add(0, 0, angle);
break;
764 System.err.println(
"Rot: angleDelta "+angle+
" (eps "+eps+
"): "+eulerOld+
" -> "+euler);
771 System.err.println(
"MediaPlayer.1 AttributesChanges: "+eventMask+
", when "+when);
772 System.err.println(
"MediaPlayer.1 State: "+mp);
774 new InterruptSource.Thread() {
782 System.out.println(
"MediaPlayer.1 "+mp);
783 }
catch (
final Exception e) {
792 boolean destroy =
false;
793 Throwable err =
null;
795 if( eventMask.isSet(GLMediaPlayer.EventMask.Bit.EOS) ) {
798 System.err.println(
"MovieSimple State: Exception");
801 new InterruptSource.Thread() {
811 if( eventMask.isSet(GLMediaPlayer.EventMask.Bit.Error) ) {
817 System.err.println(
"MovieSimple State: Exception");
818 err.printStackTrace();
Abstract Outline shape representation define the method an OutlineShape(s) is bound and rendered.
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)
Animation-Set covering its ShapeData elements, LerpFunc and animation parameter.
Animation Shapes data covering one Shape of Set.
Sine target LerpFunc, approaching ShapeData's target position utilizing the angular value for sine am...
Default target LerpFunc, approaching ShapeData's target position inclusive angular rotation around gi...
Group of animated Shapes including other static Shapes, optionally utilizing a Group....
final boolean getTickPaused()
final Set addGlyphSetRandom01(final float pixPerMM, final GLProfile glp, final PMVMatrix4f pmv, final Recti viewport, final int renderModes, final Font font, final CharSequence text, final float fontScale, final Vec4f fgCol, final float accel, final float velocity, final float ang_accel, final float ang_velo, final AABBox animBox, final boolean z_only, final Random random, final LerpFunc lerp)
Add a new Set with ShapeData for each GlyphShape, moving towards its target position using a fixed di...
final void removeAnimSets(final GL2ES2 gl, final RegionRenderer renderer, final List< Set > asList)
Removes the given Sets and destroys them, including their ShapeData and Shape.
final Set addGlyphSet(final float pixPerMM, final GLProfile glp, final PMVMatrix4f pmv, final Recti viewport, final int renderModes, final Font font, final char refChar, final CharSequence text, final float fontScale, final float accel, final float velocity, final float ang_accel, final float ang_velo, final LerpFunc lerp, final ShapeSetup op)
Add a new Set with ShapeData for each GlyphShape, moving towards its target position using a generic ...
Set addAnimSet(final float pixPerMM, final GLProfile glp, final PMVMatrix4f pmv, final Recti viewport, final float accel, final float velocity, final float ang_accel, final float ang_velo, final LerpFunc lerp, final Shape refShape)
Add a new Set with an empty ShapeData container.
final Set addGlyphSetHorizScroll01(final float pixPerMM, final GLProfile glp, final PMVMatrix4f pmv, final Recti viewport, final int renderModes, final Font font, final CharSequence text, final float fontScale, final Vec4f fgCol, final float velocity, final AABBox animBox, final float y_offset)
Add a new Set with ShapeData for each GlyphShape, implementing horizontal continuous scrolling while...
Graph based GLRegion Shape.
void addShape(final Shape s)
Adds a Shape.
final void setPMvCullingEnabled(final boolean v)
Enable or disable Project-Modelview (PMv) frustum culling per Shape for this container.
AABBox getBounds(final PMVMatrix4f pmv, final Shape shape)
Returns AABBox dimension of given Shape from this container's perspective, i.e.
void addShape(final Shape s)
Adds a Shape.
final void setClearParams(final float[] clearColor, final int clearMask)
Sets the clear parameter for glClearColor(..) and glClear(..) to be issued at display(GLAutoDrawable)...
RegionRenderer getRenderer()
Returns the associated RegionRenderer.
Shape removeShape(final Shape s)
Removes given shape, w/o Shape#destroy(GL2ES2, RegionRenderer).
final void setPMvCullingEnabled(final boolean v)
Enable or disable Project-Modelview (PMv) frustum culling per Shape for this container.
int setAAQuality(final int v)
Sets RegionRenderer#setAAQuality(int).
void waitUntilDisplayed()
Blocks until first display(GLAutoDrawable) has completed after construction or dispose(GLAutoDrawable...
final Recti getViewport(final Recti target)
Copies the current int[4] viewport in given target and returns it for chaining.
PMVMatrix4f getMatrix()
Borrow the current PMVMatrix4f.
static float getZEpsilon(final int zBits, final PMVMatrixSetup setup)
Default Z precision on 16-bit depth buffer using -1 z-position and DEFAULT_ZNEAR.
AABBox getBounds(final PMVMatrix4f pmv, final Shape shape)
Returns AABBox dimension of given Shape from this container's perspective, i.e.
synchronized void attachInputListenerTo(final GLWindow window)
int getScreenshotCount()
Return the number of nextScreenshotFile(String, String, int, GLCapabilitiesImmutable,...
String getStatusText(final GLAutoDrawable glad, final int renderModes, final float dpi)
Return a formatted status string containing avg fps and avg frame duration.
File nextScreenshotFile(final String dir, final String prefix, final int renderModes, final GLCapabilitiesImmutable caps, final String contentDetail)
Return the unique next technical screenshot PNG File instance as follows:
Generic Shape, potentially using a Graph via GraphShape or other means of representing content.
Shape setColor(final float r, final float g, final float b, final float a)
Set base color.
final Shape move(final float dtx, final float dty, final float dtz)
Move about scaled distance.
final Shape setScale(final Vec3f s)
Set scale factor to given scale.
final Shape setInteractive(final boolean v)
Set whether this shape is interactive in general, i.e.
final Shape setResizable(final boolean resizable)
Set whether this shape is resizable, i.e.
final Shape moveTo(final float tx, final float ty, final float tz)
Move to scaled position.
final float getScaledWidth()
Returns the scaled width of the bounding AABBox for this shape.
final Shape setToggle(final boolean v)
Set this shape's toggle state, default is off.
final AABBox getBounds()
Returns the unscaled bounding AABBox for this shape, borrowing internal instance.
final Quaternion getRotation()
Returns Quaternion for rotation.
final boolean isToggleOn()
Returns true this shape's toggle state.
final Shape validate(final GL2ES2 gl)
Validates the shape's underlying GLRegion.
final Shape setRotation(final Quaternion q)
Sets the rotation Quaternion.
final Shape scale(final Vec3f s)
Multiply current scale factor by given scale.
final Shape setRotationPivot(final float px, final float py, final float pz)
Set unscaled rotation origin, aka pivot.
final Shape setToggleable(final boolean toggleable)
Set this shape toggleable, default is off.
A GraphUI text label GraphShape.
boolean setText(final CharSequence text)
Set the text to be rendered.
A GraphUI rectangle GraphShape.
Basic Float math utility functions.
static final float QUARTER_PI
The value PI/4, i.e.
static final float PI
The value PI, i.e.
static float adegToRad(final float arc_degree)
Converts arc-degree to radians.
static final float HALF_PI
The value PI/2, i.e.
Quaternion implementation supporting Gimbal-Lock free rotations.
Vec3f toEuler(final Vec3f result)
Transform this quaternion to Euler rotation angles in radians (pitchX, yawY and rollZ).
final Quaternion setFromEuler(final Vec3f angradXYZ)
Initializes this quaternion from the given Euler rotation array angradXYZ in radians.
Quaternion rotateByAngleY(final float angle)
Rotate this quaternion around Y axis with the given angle in radians.
Quaternion rotateByAngleZ(final float angle)
Rotate this quaternion around Z axis with the given angle in radians.
3D Vector based upon three float components.
static final Vec3f UNIT_Z
static final Vec3f UNIT_Y
Vec3f add(final float dx, final float dy, final float dz)
this = this + { dx, dy, dz }, returns this.
4D Vector based upon four float components.
Axis Aligned Bounding Box.
final AABBox resizeWidth(final float deltaLeft, final float deltaRight)
Resize width of this AABBox with explicit left- and right delta values.
final Frustum getFrustum()
Returns the frustum, derived from projection x modelview.
Visual output device, i.e.
static float[] perMMToPerInch(final float[] ppmm)
Converts [1/mm] to [1/inch] in place.
NEWT Window events are provided for notification purposes ONLY.
An implementation of GLAutoDrawable and Window interface, using a delegated Window instance,...
final int getSurfaceHeight()
Returns the height of this GLDrawable's surface client area in pixel units.
final boolean isNativeValid()
final void addMouseListener(final MouseListener l)
Appends the given MouseListener to the end of the list.
final void setTitle(final String title)
final float[] getPixelsPerMM(final float[] ppmmStore)
Returns the pixels per millimeter of this window's NativeSurface according to the main monitor's curr...
final void addKeyListener(final KeyListener l)
Appends the given com.jogamp.newt.event.KeyListener to the end of the list.
final int getSurfaceWidth()
Returns the width of this GLDrawable's surface client area in pixel units.
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 addWindowListener(final WindowListener l)
Appends the given com.jogamp.newt.event.WindowListener to the end of the list.
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.
Specifies the the OpenGL profile.
static JoglVersion getInstance()
StringBuilder toString(final GL gl, StringBuilder sb)
Res independent Shape, Scene attached to GLWindow showing multiple animated shape movements.
static void main(final String[] args)
static void rotateShape(final Shape shape, float angle, final int axis)
Rotate the shape while avoiding 90 degree position.
GLCapabilities getGLCaps()
int graphAASamples
Sample count for Graph Region AA render-modes: Region#VBAA_RENDERING_BIT or Region#MSAA_RENDERING_BIT...
int graphAAQuality
Pass2 AA-quality rendering for Graph Region AA render-modes: VBAA_RENDERING_BIT.
void parse(final String[] args)
static void waitForKey(final String preMessage)
static int atoi(final String str, final int def)
static void destroyWindow(final GLAutoDrawable glad)
static float atof(final String str, final float def)
final synchronized void add(final GLAutoDrawable drawable)
Adds a drawable to this animator's list of rendering drawables.
final synchronized Thread setExclusiveContext(final Thread t)
Dedicate all GLAutoDrawable's context to the given exclusive context thread.
final void setUpdateFPSFrames(final int frames, final PrintStream out)
final synchronized boolean start()
Starts this animator, if not running.
float getDescent()
Distance from baseline of lowest descender, a negative value.
float getLineGap()
Typographic line gap, a positive value.
Interface wrapper for font implementation.
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...
String toString()
Returns getFullFamilyName().
An animator control interface, which implementation may drive a com.jogamp.opengl....
boolean stop()
Stops this animator.
A higher-level abstraction than GLDrawable which supplies an event based mechanism (GLEventListener) ...
boolean invoke(boolean wait, GLRunnable glRunnable)
Enqueues a one-shot GLRunnable, which will be executed within the next display() call after all regis...
GLAnimatorControl getAnimator()
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.
GL getGL()
Casts this object to the GL interface.
GLProfile getGLProfile()
Returns the GL profile you desire or used by the drawable.
GLCapabilitiesImmutable getChosenGLCapabilities()
Fetches the GLCapabilitiesImmutable corresponding to the chosen OpenGL capabilities (pixel format / v...
static final int GL_VERSION
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_VERSION" with express...
void glEnable(int cap)
Entry point to C language function: void {@native glEnable}(GLenum cap) Part of GL_ES_VERSION_2_0,...
String glGetString(int name)
Entry point to C language function: const GLubyte * {@native glGetString}(GLenum name) Part of GL_...
static final int GL_DEPTH_TEST
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_DEPTH_TEST" with expr...
static final int GL_VENDOR
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_VENDOR" with expressi...
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...