JOGL v2.6.0-rc-20250706
JOGL, High-Performance Graphics Binding for Java™ (public API).
UIMediaGrid01.java
Go to the documentation of this file.
1/**
2 * Copyright 2010-2023 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.demos.graph.ui;
29
30import java.io.File;
31import java.io.IOException;
32import java.net.URISyntaxException;
33import java.util.ArrayList;
34import java.util.Arrays;
35import java.util.List;
36
37import com.jogamp.common.net.Uri;
38import com.jogamp.graph.curve.Region;
39import com.jogamp.graph.font.Font;
40import com.jogamp.graph.font.FontFactory;
41import com.jogamp.graph.font.FontScale;
42import com.jogamp.graph.ui.Group;
43import com.jogamp.graph.ui.Scene;
44import com.jogamp.graph.ui.Shape;
45import com.jogamp.graph.ui.layout.Alignment;
46import com.jogamp.graph.ui.layout.BoxLayout;
47import com.jogamp.graph.ui.layout.Gap;
48import com.jogamp.graph.ui.layout.GridLayout;
49import com.jogamp.graph.ui.layout.Margin;
50import com.jogamp.graph.ui.layout.Padding;
51import com.jogamp.graph.ui.shapes.Button;
52import com.jogamp.graph.ui.shapes.Label;
53import com.jogamp.graph.ui.shapes.MediaButton;
54import com.jogamp.graph.ui.shapes.Rectangle;
55import com.jogamp.graph.ui.widgets.MediaPlayer;
56import com.jogamp.graph.ui.widgets.RangeSlider;
57import com.jogamp.graph.ui.widgets.RangedGroup;
58import com.jogamp.graph.ui.widgets.RangedGroup.SliderParam;
59import com.jogamp.math.Vec2f;
60import com.jogamp.math.Vec2i;
61import com.jogamp.math.Vec3f;
62import com.jogamp.math.geom.AABBox;
63import com.jogamp.math.util.PMVMatrix4f;
64import com.jogamp.newt.event.KeyAdapter;
65import com.jogamp.newt.event.KeyEvent;
66import com.jogamp.newt.event.MouseEvent;
67import com.jogamp.newt.event.WindowAdapter;
68import com.jogamp.newt.event.WindowEvent;
69import com.jogamp.newt.opengl.GLWindow;
70import com.jogamp.opengl.GL;
71import com.jogamp.opengl.GLAutoDrawable;
72import com.jogamp.opengl.GLCapabilities;
73import com.jogamp.opengl.GLCapabilitiesImmutable;
74import com.jogamp.opengl.GLEventAdapter;
75import com.jogamp.opengl.GLProfile;
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;
81
82import jogamp.graph.ui.TreeTool;
83
84/**
85 * MediaButtons in a {@link RangedGroup} w/ vertical slider, filled by media files from a directory.
86 */
87public class UIMediaGrid01 {
88 private static final float MediaGridWidth = 1f;
89
90 // static CommandlineOptions options = new CommandlineOptions(1280, 720, Region.VBAA_RENDERING_BIT);
91 static CommandlineOptions options = new CommandlineOptions(1280, 720, Region.NORM_RENDERING_BIT, 0, 0, 8);
92
93 private static final boolean VERBOSE_UI = false;
94 private static final List<String> MEDIA_SUFFIXES = Arrays.asList("mp4", "mkv", "m2v", "avi");
95 private static int aid = GLMediaPlayer.STREAM_ID_AUTO;
96 private static int sid = GLMediaPlayer.STREAM_ID_NONE;
97 private static String alang = null;
98 private static String slang = null;
99 private static int start_pos = 0;
100 private static float videoAspectRatio = 16f/9f;
101 private static boolean letterBox = true;
102 private static boolean enableStills = true;
103 private static int texCount = GLMediaPlayer.TEXTURE_COUNT_DEFAULT;
104
105 public static void main(final String[] args) throws IOException {
106 float mmPerCellWidth = 50f;
107 int maxMediaFiles = 10000; // Integer.MAX_VALUE;
108 int gridColumns = -1;
109 String subFallbackFontFilename = null;
110 String mediaDir = null;
111 if( 0 != args.length ) {
112 final int[] idx = { 0 };
113 for (idx[0] = 0; idx[0] < args.length; ++idx[0]) {
114 if( options.parse(args, idx) ) {
115 continue;
116 } else if (args[idx[0]].equals("-dir")) {
117 idx[0]++;
118 mediaDir = args[idx[0]];
119 } else if(args[idx[0]].equals("-max")) {
120 idx[0]++;
121 maxMediaFiles = MiscUtils.atoi(args[idx[0]], maxMediaFiles);
122 } else if(args[idx[0]].equals("-aid")) {
123 idx[0]++;
124 aid = MiscUtils.atoi(args[idx[0]], aid);
125 } else if(args[idx[0]].equals("-sid")) {
126 idx[0]++;
127 sid = MiscUtils.atoi(args[idx[0]], sid);
128 } else if(args[idx[0]].equals("-alang")) {
129 idx[0]++;
130 alang = args[idx[0]];
131 } else if(args[idx[0]].equals("-slang")) {
132 idx[0]++;
133 slang = args[idx[0]];
134 } else if(args[idx[0]].equals("-start")) {
135 idx[0]++;
136 start_pos = MiscUtils.atoi(args[idx[0]], start_pos);
137 } else if(args[idx[0]].equals("-ratio")) {
138 idx[0]++;
139 videoAspectRatio = MiscUtils.atof(args[idx[0]], videoAspectRatio);
140 } else if(args[idx[0]].equals("-zoom")) {
141 letterBox = false;
142 } else if(args[idx[0]].equals("-mmPerCell")) {
143 idx[0]++;
144 mmPerCellWidth = MiscUtils.atof(args[idx[0]], mmPerCellWidth);
145 } else if(args[idx[0]].equals("-col")) {
146 idx[0]++;
147 gridColumns = MiscUtils.atoi(args[idx[0]], gridColumns);
148 } else if(args[idx[0]].equals("-fallbackFont")) {
149 idx[0]++;
150 subFallbackFontFilename = args[idx[0]];
151 } else if(args[idx[0]].equals("-texCount")) {
152 idx[0]++;
153 texCount = MiscUtils.atoi(args[idx[0]], texCount);
154 } else if(args[idx[0]].equals("-noStills")) {
155 enableStills = false;
156 }
157 }
158 }
159 if( null != subFallbackFontFilename ) {
160 FontFactory.setFallbackFont( FontFactory.get( new File( subFallbackFontFilename ) ) );
161 }
162 System.err.println(options);
163 System.err.println("mediaDir "+mediaDir);
164 System.err.println("maxMediaFiles "+maxMediaFiles);
165 System.err.println("aid "+aid+", alang "+alang+"; sid "+sid+", slang "+slang);
166 System.err.println("texCount "+texCount);
167 System.err.println("boxRatio "+videoAspectRatio);
168 System.err.println("letterBox "+letterBox);
169 System.err.println("columns "+gridColumns);
170 System.err.println("FallbackFont "+FontFactory.getFallbackFont());
171
172 final List<Uri> mediaFiles = new ArrayList<Uri>();
173 if( null != mediaDir && mediaDir.length() > 0 ) {
174 final File dir = new File(mediaDir);
175 final File[] files = dir.listFiles((final File pathname) -> {
176 if( !pathname.canRead() || !pathname.isFile() ) {
177 System.err.println("Not a file or not readable: "+pathname);
178 return false;
179 }
180 final String name = pathname.getName();
181 final int dot = name.lastIndexOf(".");
182 if( 0 >= dot || dot == name.length() - 1 ) {
183 System.err.println("Not having a suffixe: "+pathname);
184 return false;
185 }
186 final String suffix = name.substring(dot+1);
187 if( !MEDIA_SUFFIXES.contains(suffix) ) {
188 System.err.println("Not having a media suffix: "+pathname+", suffix '"+suffix+"'");
189 return false;
190 }
191 return true;
192 });
193 Arrays.sort(files, (final File f1, final File f2) -> {
194 return f1.getAbsolutePath().compareTo(f2.getAbsolutePath());
195 });
196 for(final File f : files) {
197 try {
198 final Uri uri = Uri.valueOf(f);
199 if( mediaFiles.size() < maxMediaFiles ) {
200 mediaFiles.add( uri );
201 System.err.println("Adding media file: "+uri);
202 } else {
203 System.err.println("Dropping media file: "+uri);
204 }
205 } catch (final URISyntaxException e) {}
206 }
207 }
208 if( 0 == mediaFiles.size() ) {
209 System.err.println("No media files, exit.");
210 return;
211 }
212 System.err.println("Media Files Count "+mediaFiles.size());
213 final GLCapabilities reqCaps = options.getGLCaps();
214 System.out.println("Requested: " + reqCaps);
215
216 final Animator animator = new Animator(0 /* w/o AWT */);
217 animator.setUpdateFPSFrames(1*60, null); // System.err);
218 final GLWindow window = GLWindow.create(reqCaps);
219 window.invoke(false, (final GLAutoDrawable glad) -> {
220 glad.getGL().setSwapInterval(options.swapInterval);
221 return true;
222 } );
223 window.setSize(options.surface_width, options.surface_height);
224 window.setVisible(true);
225 System.out.println("Chosen: " + window.getChosenGLCapabilities());
226 window.setTitle(UIMediaGrid01.class.getSimpleName()+": "+window.getSurfaceWidth()+" x "+window.getSurfaceHeight());
227 window.addWindowListener(new WindowAdapter() {
228 @Override
229 public void windowResized(final WindowEvent e) {
230 window.setTitle(UIMediaGrid01.class.getSimpleName()+": "+window.getSurfaceWidth()+" x "+window.getSurfaceHeight());
231 }
232 @Override
233 public void windowDestroyNotify(final WindowEvent e) {
234 animator.stop();
235 }
236 });
237 animator.add(window);
238
239 final Scene scene = new Scene(options.graphAASamples);
240 scene.setClearParams(new float[] { 1f, 1f, 1f, 1f}, GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
241 scene.setPMvCullingEnabled(true);
242
243 scene.attachInputListenerTo(window);
244 window.addGLEventListener(scene);
245
246
247 final float winAspectRatio, dpiV;
248 final Vec2i gridDim;
249 final int mediaRowsPerPage;
250 {
251 winAspectRatio = (float)window.getSurfaceWidth() / (float)window.getSurfaceHeight();
252 final float[] ppmm = window.getPixelsPerMM(new float[2]);
253 final float[] dpi = FontScale.ppmmToPPI( new float[] { ppmm[0], ppmm[1] } );
254 System.err.println("DPI "+dpi[0]+" x "+dpi[1]+", "+ppmm[0]+" x "+ppmm[1]+" pixel/mm");
255 dpiV = dpi[1];
256
257 final float[] hasSurfacePixelScale1 = window.getCurrentSurfaceScale(new float[2]);
258 System.err.println("HiDPI PixelScale: "+hasSurfacePixelScale1[0]+"x"+hasSurfacePixelScale1[1]+" (has)");
259 final float mmPerCellHeight = mmPerCellWidth / videoAspectRatio;
260 int _mediaRowsPerPage = (int)( ( window.getSurfaceHeight() / ppmm[1] ) / mmPerCellHeight );
261 if( 0 >= gridColumns ) {
262 gridColumns = (int)( ( window.getSurfaceWidth() * MediaGridWidth / ppmm[0] ) / mmPerCellWidth );
263 }
264 if( mediaFiles.size() < gridColumns * _mediaRowsPerPage ) {
265 gridColumns = (int)Math.floor( Math.sqrt ( mediaFiles.size() ) );
266 _mediaRowsPerPage = gridColumns;
267 }
268 mediaRowsPerPage = _mediaRowsPerPage;
269 gridDim = new Vec2i(gridColumns, mediaRowsPerPage);
270 }
271 final float mediaCellWidth = videoAspectRatio;
272 final float mediaCellHeight = 1;
273 final Vec2f mediaGridSize = new Vec2f(gridDim.x() * mediaCellWidth, mediaRowsPerPage * mediaCellHeight);
274 System.err.println("GridDim "+gridDim);
275 System.err.println("GridSize "+mediaGridSize);
276 System.err.println("CellSize "+mediaCellWidth+" x "+mediaCellHeight+", vAspectRatio "+videoAspectRatio);
277 System.err.println("Window "+window.getSurfaceWidth()+" x "+window.getSurfaceHeight()+", wAspectRatio "+winAspectRatio);
278
279 final RangedGroup mediaView;
280 {
281 final Group mediaGrid = new Group(new GridLayout(gridDim.x(), mediaCellWidth*0.9f, mediaCellHeight*0.9f, Alignment.FillCenter,
282 new Gap(mediaCellHeight*0.1f, mediaCellWidth*0.1f)));
283 mediaGrid.setInteractive(false).setDragAndResizable(false).setToggleable(false).setName("MediaGrid");
284 addMedia(scene, reqCaps.getGLProfile(), mediaGrid, mediaFiles, videoAspectRatio);
285 mediaGrid.setRelayoutOnDirtyShapes(false); // avoid group re-validate to ease load in Group.isShapeDirty() w/ thousands of glyphs
286 if( VERBOSE_UI ) {
287 mediaGrid.validate(reqCaps.getGLProfile());
288 System.err.println("MediaGrid "+mediaGrid);
289 System.err.println("MediaGrid "+mediaGrid.getLayout());
290 }
291 mediaView = new RangedGroup(options.renderModes, mediaGrid, mediaGridSize,
292 null,
293 new SliderParam(new Vec2f(mediaCellWidth/20f, mediaGridSize.y()), mediaCellHeight/30f, true));
294 mediaView.setPaddding(new Padding(mediaCellHeight/16));
295 mediaView.getVertSlider().setColor(0.3f, 0.3f, 0.3f, 0.7f).setName("MediaView");
296 // mediaView.setRelayoutOnDirtyShapes(false); // avoid group re-validate to ease load in Group.isShapeDirty() w/ thousands of glyphs
297 if( VERBOSE_UI ) {
298 mediaView.getVertSlider().addChangeListener((final RangeSlider w, final float old_val, final float val, final float old_val_pct, final float val_pct, final Vec3f pos, final MouseEvent e) -> {
299 final Vec2f minmax = w.getMinMax();
300 final float row_f = val / mediaCellHeight;
301 System.err.println("VertSlider: row "+row_f+", val["+old_val+" -> "+val+"], pct["+(100*old_val_pct)+"% -> "+(100*val_pct)+"%], minmax "+minmax);
302 });
303 }
304 if( VERBOSE_UI ) {
305 mediaView.validate(reqCaps.getGLProfile());
306 System.err.println("GlyphView "+mediaView);
307 }
308 }
309 final Group mainGrid = new Group(new GridLayout(1, 0, 0, Alignment.None));
310 mainGrid.setName("MainGrid");
311 mainGrid.addShape(mediaView);
312 {
313 final Font fontInfo = FontFactory.getDefaultFont();
314 final Label infoLabel = new Label(options.renderModes, fontInfo, "Not yet");
315 infoLabel.setColor(0.1f, 0.1f, 0.1f, 1f);
316 final Group labelBox = new Group(new BoxLayout(mediaGridSize.x(), mediaCellHeight / 10, new Alignment(Alignment.Bit.Fill.value | Alignment.Bit.CenterVert.value),
317 new Margin(0, 0.005f)));
318 labelBox.addShape(infoLabel);
320 @Override
321 public void display(final GLAutoDrawable drawable) {
322 infoLabel.setText( scene.getStatusText(drawable, options.renderModes, dpiV) );
323 }
324 });
325 mainGrid.addShape(labelBox);
326 }
327 scene.addShape(mainGrid);
328
329 window.addKeyListener(new KeyAdapter() {
330 @Override
331 public void keyReleased(final KeyEvent e) {
332 final short keySym = e.getKeySymbol();
333 if( keySym == KeyEvent.VK_S ) {
334 printScreenOnGLThread(scene, window.getChosenGLCapabilities());
335 } else if( keySym == KeyEvent.VK_F4 || keySym == KeyEvent.VK_ESCAPE || keySym == KeyEvent.VK_Q ) {
336 MiscUtils.destroyWindow(window);
337 } else if( keySym == KeyEvent.VK_D ) {
338 final PMVMatrix4f pmv = new PMVMatrix4f();
339 scene.setupMatrix(pmv);
340 final int[] shapeIdx = { 0 };
341 TreeTool.forAllRendered(scene, false, pmv, (final Shape s, final PMVMatrix4f pmv_) -> {
342 ++shapeIdx[0];
343 System.err.printf("%03d: shape %s/%s, %s%n", shapeIdx[0], s.getClass().getSimpleName(), s.getName(), s);
344 return false;
345 });
346 }
347 }
348 });
349
350 animator.start();
351 scene.waitUntilDisplayed();
352 {
353 final AABBox sceneBox = scene.getBounds();
354 final AABBox mainGridBox = mainGrid.getBounds();
355 final float sx = sceneBox.getWidth() / mainGridBox.getWidth();
356 final float sy = sceneBox.getHeight() / mainGridBox.getHeight();
357 final float sxy = Math.min(sx, sy);
358 System.err.println("SceneBox "+sceneBox);
359 System.err.println("MainGridBox "+mainGridBox);
360 System.err.println("scale sx "+sx+", sy "+sy+", sxy "+sxy);
361 // scale, moveTo origin bottom-left, then move up to top-left corner.
362 mainGrid.scale(sxy, sxy, 1f).moveTo(sceneBox.getLow()).move(0, sceneBox.getHeight()-mainGridBox.getHeight()*sxy, 0);
363 }
364 printScreenOnGLThread(scene, window.getChosenGLCapabilities());
365 // stay open ..
366 }
367 static void printScreenOnGLThread(final Scene scene, final GLCapabilitiesImmutable caps) {
368 scene.screenshot(true, scene.nextScreenshotFile(null, UIMediaGrid01.class.getSimpleName(), options.renderModes, caps, "media"));
369 }
370
371 static void addMedia(final Scene scene, final GLProfile glp, final Group grid,
372 final List<Uri> mediaFiles, final float defRatio) {
373 final float zoomSize = 1; // 0.95f;
374 for(final Uri medium : mediaFiles) {
375 final GLMediaPlayer glMPlayer = GLMediaPlayerFactory.createDefault();
376 if( printNativeInfoOnce ) {
377 glMPlayer.printNativeInfo(System.err);
378 printNativeInfoOnce = false;
379 }
380 // mPlayer.setTextureMinMagFilter( new int[] { GL.GL_NEAREST, GL.GL_NEAREST } );
381 glMPlayer.setTextureMinMagFilter( new int[] { GL.GL_LINEAR, GL.GL_LINEAR } );
382 glMPlayer.setTextureUnit(1);
383
384 final List<Shape> customCtrls = new ArrayList<Shape>();
385 if( true ) {
386 final Font fontSymbols = FontFactory.getSymbolsFont();
387 if( null == fontSymbols ) {
388 grid.addShape( new Rectangle(options.renderModes, defRatio, 1, 0.10f) );
389 return;
390 }
391 final Button button = new Button(options.renderModes, fontSymbols,
392 fontSymbols.getUTF16String("reset_tv"), MediaPlayer.CtrlButtonWidth, MediaPlayer.CtrlButtonHeight, scene.getZEpsilon(16));
393 button.setName("reset");
394 button.setSpacing(MediaPlayer.SymSpacing, MediaPlayer.FixedSymSize).setPerp().setColor(MediaPlayer.CtrlCellCol);
395 button.onClicked((final Shape s0, final Vec3f pos, final MouseEvent e) -> {
396 TreeTool.forAll(scene, (final Shape s1) -> {
397 System.err.println("- "+s1.getName());
398 if( s1 instanceof MediaButton ) {
399 final MediaButton mb = (MediaButton)s1;
400 final GLMediaPlayer mp = mb.getGLMediaPlayer();
401 mp.seek(0);
402 mp.setPlaySpeed(1f);
403 mp.setAudioVolume( 0f );
404 }
405 if( s1.getName().equals("muteLabel") ) {
406 s1.setVisible(true);
407 }
408 if( s1.getName().equals("MediaGrid") ) {
409 s1.markShapeDirty();
410 System.err.println("Reset: "+s1);
411 }
412 return false;
413 });
414 });
415 customCtrls.add(button);
416 }
417 final MediaPlayer graphMPlayer = new MediaPlayer(options.renderModes, scene, glMPlayer, medium, defRatio, letterBox, zoomSize, enableStills, customCtrls);
418 grid.addShape( graphMPlayer );
419 glMPlayer.playStream(medium, GLMediaPlayer.STREAM_ID_AUTO, alang, aid, slang, sid, texCount);
420 if( start_pos > 0 ) {
421 glMPlayer.seek(start_pos * 1000);
422 }
423 }
424 }
425 private static boolean printNativeInfoOnce = true;
426}
Abstract Outline shape representation define the method an OutlineShape(s) is bound and rendered.
Definition: Region.java:62
static final int NORM_RENDERING_BIT
Rendering-Mode bit for Region.
Definition: Region.java:79
The optional property jogamp.graph.font.ctor allows user to specify the FontConstructor implementatio...
static synchronized void setFallbackFont(final Font f)
Registers given Font as the default fallback font.
static synchronized Font getFallbackFont()
Returns registered fallback Font, maybe null.
static final FontSet get(final int font)
static Font getDefaultFont()
Returns default Font of default FontSet or null if n/a.
Simple static font scale methods for unit conversions.
Definition: FontScale.java:37
static float[] ppmmToPPI(final float[] ppmm)
Converts [1/mm] to [1/inch] in place.
Definition: FontScale.java:105
Group of Shapes, optionally utilizing a Group.Layout.
Definition: Group.java:61
void addShape(final Shape s)
Adds a Shape.
Definition: Group.java:225
Layout getLayout()
Return current Group.Layout.
Definition: Group.java:150
AABBox getBounds(final PMVMatrix4f pmv, final Shape shape)
Returns AABBox dimension of given Shape from this container's perspective, i.e.
Definition: Group.java:686
void setRelayoutOnDirtyShapes(final boolean v)
Set relayout on dirty shapes mode, defaults to true.
Definition: Group.java:514
GraphUI Scene.
Definition: Scene.java:102
void addShape(final Shape s)
Adds a Shape.
Definition: Scene.java:287
final void setClearParams(final float[] clearColor, final int clearMask)
Sets the clear parameter for glClearColor(..) and glClear(..) to be issued at display(GLAutoDrawable)...
Definition: Scene.java:221
final void setPMvCullingEnabled(final boolean v)
Enable or disable Project-Modelview (PMv) frustum culling per Shape for this container.
Definition: Scene.java:230
void waitUntilDisplayed()
Blocks until first display(GLAutoDrawable) has completed after construction or dispose(GLAutoDrawable...
Definition: Scene.java:584
void setupMatrix(final PMVMatrix4f pmv, final Recti viewport)
Setup PMVMatrix4f GLMatrixFunc#GL_PROJECTION and GLMatrixFunc#GL_MODELVIEW by calling getPMVMatrixSet...
Definition: Scene.java:753
void addGLEventListener(final GLEventListener listener)
Definition: Scene.java:435
AABBox getBounds(final PMVMatrix4f pmv, final Shape shape)
Returns AABBox dimension of given Shape from this container's perspective, i.e.
Definition: Scene.java:676
synchronized void attachInputListenerTo(final GLWindow window)
Definition: Scene.java:246
String getStatusText(final GLAutoDrawable glad, final int renderModes, final float dpi)
Return a formatted status string containing avg fps and avg frame duration.
Definition: Scene.java:1381
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:
Definition: Scene.java:1434
Generic Shape, potentially using a Graph via GraphShape or other means of representing content.
Definition: Shape.java:87
Shape setColor(final float r, final float g, final float b, final float a)
Set base color.
Definition: Shape.java:1389
Shape setName(final String name)
Set a symbolic name for this shape for identification.
Definition: Shape.java:339
final String getName()
Return the optional symbolic name for this shape, defaults to noname.
Definition: Shape.java:341
final Shape setInteractive(final boolean v)
Set whether this shape is interactive in general, i.e.
Definition: Shape.java:1711
final Shape moveTo(final float tx, final float ty, final float tz)
Move to scaled position.
Definition: Shape.java:543
final Shape setDragAndResizable(final boolean v)
Set whether this shape is draggable and resizable.
Definition: Shape.java:1801
final Shape validate(final GL2ES2 gl)
Validates the shape's underlying GLRegion.
Definition: Shape.java:850
final Shape setPaddding(final Padding padding)
Sets the unscaled padding for this shape, which is included in unscaled getBounds() and also includes...
Definition: Shape.java:376
final Shape scale(final Vec3f s)
Multiply current scale factor by given scale.
Definition: Shape.java:661
final Shape setToggleable(final boolean toggleable)
Set this shape toggleable, default is off.
Definition: Shape.java:1573
Immutable layout alignment options, including Bit#Fill.
Definition: Alignment.java:35
static final Alignment None
No alignment constant.
Definition: Alignment.java:37
static final Alignment FillCenter
Bit#Fill, Bit#CenterHoriz and Bit#CenterVert alignment constant.
Definition: Alignment.java:45
GraphUI Stack Group.Layout.
Definition: BoxLayout.java:53
GraphUI CSS property Gap, scaled spacing between (grid) cells not belonging to the cell element.
Definition: Gap.java:38
GraphUI Grid Group.Layout.
Definition: GridLayout.java:56
GraphUI CSS property Margin, scaled space between or around elements and not included in the element'...
Definition: Margin.java:41
GraphUI CSS property Padding, unscaled space belonging to the element and included in the element's s...
Definition: Padding.java:38
A GraphUI text label GraphShape.
Definition: Label.java:50
boolean setText(final CharSequence text)
Set the text to be rendered.
Definition: Label.java:94
RangeSlider Widget either utilizing a simple positional round knob or a rectangular page-sized knob.
Vec2f getMinMax()
Returns slider value range, see setMinMax(Vec2f, float).
final RangeSlider addChangeListener(final ChangeListener l)
final Shape setColor(final float r, final float g, final float b, final float a)
Sets the slider knob color.
RangeSlider configuration parameter for RangedGroup.
Ranged Group Widget, displaying a clipped content Group with optional horizontal and/or vertical Rang...
RangeSlider getVertSlider()
Returns the used vertical RangeSlider or null.
2D Vector based upon two float components.
Definition: Vec2f.java:37
2D Vector based upon two integer components.
Definition: Vec2i.java:34
3D Vector based upon three float components.
Definition: Vec3f.java:37
Axis Aligned Bounding Box.
Definition: AABBox.java:54
final float getWidth()
Definition: AABBox.java:879
final Vec3f getLow()
Returns the minimum left-bottom-far (xyz) coordinate.
Definition: AABBox.java:140
final float getHeight()
Definition: AABBox.java:883
PMVMatrix4f implements the basic computer graphics Matrix4f pack using projection (P),...
static final short VK_F4
Constant for the F4 function key.
Definition: KeyEvent.java:686
static final short VK_ESCAPE
Constant for the ESCAPE function key.
Definition: KeyEvent.java:485
final short getKeySymbol()
Returns the virtual key symbol reflecting the current keyboard layout.
Definition: KeyEvent.java:176
static final short VK_D
See VK_A.
Definition: KeyEvent.java:601
static final short VK_S
See VK_A.
Definition: KeyEvent.java:631
static final short VK_Q
See VK_A.
Definition: KeyEvent.java:627
Pointer event of type PointerType.
Definition: MouseEvent.java:74
NEWT Window events are provided for notification purposes ONLY.
An implementation of GLAutoDrawable and Window interface, using a delegated Window instance,...
Definition: GLWindow.java:121
final int getSurfaceHeight()
Returns the height of this GLDrawable's surface client area in pixel units.
Definition: GLWindow.java:466
final void setTitle(final String title)
Definition: GLWindow.java:297
final float[] getPixelsPerMM(final float[] ppmmStore)
Returns the pixels per millimeter of this window's NativeSurface according to the main monitor's curr...
Definition: GLWindow.java:520
final void addKeyListener(final KeyListener l)
Appends the given com.jogamp.newt.event.KeyListener to the end of the list.
Definition: GLWindow.java:902
final float[] getCurrentSurfaceScale(final float[] result)
Returns the current pixel scale of the associated NativeSurface.
Definition: GLWindow.java:505
final int getSurfaceWidth()
Returns the width of this GLDrawable's surface client area in pixel units.
Definition: GLWindow.java:461
final void setSize(final int width, final int height)
Sets the size of the window's client area in window units, excluding decorations.
Definition: GLWindow.java:625
final void setVisible(final boolean visible)
Calls setVisible(true, visible), i.e.
Definition: GLWindow.java:615
final void addWindowListener(final WindowListener l)
Appends the given com.jogamp.newt.event.WindowListener to the end of the list.
Definition: GLWindow.java:882
static GLWindow create(final GLCapabilitiesImmutable caps)
Creates a new GLWindow attaching a new Window referencing a new default Screen and default Display wi...
Definition: GLWindow.java:169
Specifies a set of OpenGL capabilities.
final GLProfile getGLProfile()
Returns the GL profile you desire or used by the drawable.
Specifies the the OpenGL profile.
Definition: GLProfile.java:77
MediaButtons in a RangedGroup w/ vertical slider, filled by media files from a directory.
static void main(final String[] args)
int graphAASamples
Sample count for Graph Region AA render-modes: Region#VBAA_RENDERING_BIT or Region#MSAA_RENDERING_BIT...
static int atoi(final String str, final int def)
Definition: MiscUtils.java:60
static void destroyWindow(final GLAutoDrawable glad)
Definition: MiscUtils.java:269
static float atof(final String str, final float def)
Definition: MiscUtils.java:78
final synchronized void add(final GLAutoDrawable drawable)
Adds a drawable to this animator's list of rendering drawables.
final void setUpdateFPSFrames(final int frames, final PrintStream out)
final synchronized boolean start()
Starts this animator, if not running.
Definition: Animator.java:344
final synchronized boolean stop()
Stops this animator.
Definition: Animator.java:368
CenterVert
Vertical center alignment.
Definition: Alignment.java:67
Fill
Scale object to parent size, e.g.
Definition: Alignment.java:61
Interface wrapper for font implementation.
Definition: Font.java:60
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...
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.
Specifies an immutable set of OpenGL capabilities.
GLCapabilitiesImmutable getChosenGLCapabilities()
Fetches the GLCapabilitiesImmutable corresponding to the chosen OpenGL capabilities (pixel format / v...
static final int GL_LINEAR
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_LINEAR" with expressi...
Definition: GL.java:323
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
GLMediaPlayer interface specifies a TextureSequence state machine using a multiplexed audio/video str...
static final int STREAM_ID_NONE
Constant {@value} for mute or not available.
static final int TEXTURE_COUNT_DEFAULT
Default texture count, value {@value}.
static final int STREAM_ID_AUTO
Constant {@value} for auto or unspecified.