28package com.jogamp.opengl.demos.graph.ui;
31import java.io.IOException;
32import java.net.URISyntaxException;
33import java.util.ArrayList;
34import java.util.Arrays;
36import java.util.Locale;
38import com.jogamp.common.av.AudioSink;
39import com.jogamp.common.net.Uri;
40import com.jogamp.common.util.IOUtil;
41import com.jogamp.common.util.VersionUtil;
42import com.jogamp.graph.curve.Region;
43import com.jogamp.graph.curve.opengl.RegionRenderer;
44import com.jogamp.graph.curve.opengl.RenderState;
45import com.jogamp.graph.font.Font;
46import com.jogamp.graph.font.FontFactory;
47import com.jogamp.graph.font.FontScale;
48import com.jogamp.graph.ui.GraphShape;
49import com.jogamp.graph.ui.Group;
50import com.jogamp.graph.ui.Scene;
51import com.jogamp.graph.ui.Shape;
52import com.jogamp.graph.ui.layout.Alignment;
53import com.jogamp.graph.ui.layout.Gap;
54import com.jogamp.graph.ui.layout.GridLayout;
55import com.jogamp.graph.ui.shapes.Button;
56import com.jogamp.graph.ui.shapes.GLButton;
57import com.jogamp.graph.ui.shapes.ImageButton;
58import com.jogamp.graph.ui.shapes.Label;
59import com.jogamp.graph.ui.shapes.MediaButton;
60import com.jogamp.math.FloatUtil;
61import com.jogamp.math.Vec2f;
62import com.jogamp.math.Vec3f;
63import com.jogamp.math.geom.AABBox;
64import com.jogamp.math.util.PMVMatrix4f;
65import com.jogamp.graph.ui.shapes.BaseButton;
66import com.jogamp.nativewindow.ScalableSurface;
67import com.jogamp.newt.Display;
68import com.jogamp.newt.MonitorDevice;
69import com.jogamp.newt.NewtFactory;
70import com.jogamp.newt.Screen;
71import com.jogamp.newt.Window;
72import com.jogamp.newt.event.MouseEvent;
73import com.jogamp.newt.event.WindowAdapter;
74import com.jogamp.newt.event.WindowEvent;
75import com.jogamp.newt.opengl.GLWindow;
76import com.jogamp.openal.sound3d.AudioSystem3D;
77import com.jogamp.openal.util.ALAudioSink;
78import com.jogamp.openal.util.SimpleSineSynth;
79import com.jogamp.opengl.GL;
80import com.jogamp.opengl.GL2ES2;
81import com.jogamp.opengl.GLAnimatorControl;
82import com.jogamp.opengl.GLAutoDrawable;
83import com.jogamp.opengl.GLCapabilities;
84import com.jogamp.opengl.GLEventListener;
85import com.jogamp.opengl.GLPipelineFactory;
86import com.jogamp.opengl.GLRunnable;
87import com.jogamp.opengl.JoglVersion;
88import com.jogamp.opengl.demos.es2.GearsES2;
89import com.jogamp.opengl.demos.graph.FontSetDemos;
90import com.jogamp.opengl.demos.graph.MSAATool;
91import com.jogamp.opengl.demos.util.CommandlineOptions;
92import com.jogamp.opengl.demos.util.MiscUtils;
93import com.jogamp.opengl.util.Animator;
94import com.jogamp.opengl.util.av.GLMediaPlayer;
95import com.jogamp.opengl.util.av.GLMediaPlayer.EventMask;
96import com.jogamp.opengl.util.av.GLMediaPlayer.GLMediaEventListener;
97import com.jogamp.opengl.util.av.GLMediaPlayerFactory;
98import com.jogamp.opengl.util.caps.NonFSAAGLCapsChooser;
99import com.jogamp.opengl.util.texture.ImageSequence;
100import com.jogamp.opengl.util.texture.TextureIO;
102import jogamp.graph.ui.TreeTool;
117 static final boolean DEBUG =
false;
118 static final boolean TRACE =
false;
122 public static void main(
final String[] args) {
125 String fontfilename =
null;
126 String filmURL =
null;
128 if( 0 != args.length ) {
129 final int[] idx = { 0 };
130 for (idx[0] = 0; idx[0] < args.length; ++idx[0]) {
131 if( options.
parse(args, idx) ) {
133 }
else if(args[idx[0]].equals(
"-font")) {
135 fontfilename = args[idx[0]];
136 }
else if(args[idx[0]].equals(
"-pixelScale")) {
138 final float pS =
MiscUtils.
atof(args[idx[0]], reqSurfacePixelScale[0]);
139 reqSurfacePixelScale[0] = pS;
140 reqSurfacePixelScale[1] = pS;
141 }
else if(args[idx[0]].equals(
"-film") || args[idx[0]].equals(
"-file")) {
143 filmURL = args[idx[0]];
147 System.err.println(options);
151 System.err.println(VersionUtil.getPlatformInfo());
155 System.out.println(
"Requested: " + caps);
175 animator.
add(window);
189 static private final String defaultMediaURL =
"http://archive.org/download/BigBuckBunny_328/BigBuckBunny_512kb.mp4";
191 private boolean debug =
false;
192 private boolean trace =
false;
194 private final float noAADPIThreshold;
195 private final Scene scene;
198 private int renderModes;
200 private final Font font;
201 private final Font fontButtons;
202 private final Font fontSymbols;
203 private final Font fontFPS;
204 private final Uri filmURL;
206 private final float relTop = 90f/100f;
207 private final float relMiddle = 22f/100f;
210 private static final float buttonXSizeNorm = 0.09f;
211 private static final float fontSizePt = 10f;
213 private static final float fontSizeFixedNorm = 0.04f;
214 private float dpiV = 96;
223 private int currentText = 0;
225 private String actionText =
null;
226 private Label[] labels =
null;
227 private String[] strings =
null;
230 private Label truePtSizeLabel =
null;
231 private Label jogampLabel =
null;
232 private Label fpsLabel =
null;
236 private final String jogamp =
"JogAmp - Jogl Graph Module Demo";
237 private final String truePtSize = fontSizePt+
" pt font size label - true scale!";
239 private final String longText =
"JOGL: Java™ Binding for the OpenGL® API.\n\n"+
240 "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec \n"+
241 "Ut purus odio, rhoncus sit amet commodo eget, ullamcorper vel\n"+
242 "quam iaculis urna cursus ornare. Nullam ut felis a ante ultrices\n"+
243 "In hac habitasse platea dictumst. Vivamus et mi a quam lacinia\n"+
244 "Morbi quis bibendum nibh. Donec lectus orci, sagittis in consequat\n"+
245 "Donec ut dolor et nulla tristique varius. In nulla magna, fermentum\n"+
246 "in lorem. Maecenas in ipsum ac justo scelerisque sollicitudin.\n"+
248 "Lyford’s in Texas & L’Anse-aux-Griffons in Québec;\n"+
249 "Kwikpak on the Yukon delta, Kvæven in Norway, Kyulu in Kenya, not Rwanda.…\n"+
250 "Ytterbium in the periodic table. Are Toussaint L’Ouverture, Wölfflin, Wolfe,\n"+
252 "The quick brown fox jumps over the lazy dog\n";
258 this(
null,
null, renderModes,
false,
false);
267 public UISceneDemo20(
final String fontfilename,
final String filmURL,
final int renderModes,
final boolean debug,
final boolean trace) {
268 this(fontfilename, filmURL, 0f, renderModes, debug, trace);
277 public UISceneDemo20(
final String fontfilename,
final String filmURL,
final float noAADPIThreshold,
final boolean debug,
final boolean trace) {
278 this(fontfilename, filmURL, noAADPIThreshold, 0, debug, trace);
281 private UISceneDemo20(
final String fontfilename,
final String filmURL,
final float noAADPIThreshold,
final int renderModes,
final boolean debug,
final boolean trace) {
282 this.noAADPIThreshold = noAADPIThreshold;
286 this.renderModes = renderModes;
289 if(
null == fontfilename ) {
290 font =
FontFactory.
get(IOUtil.getResource(
"fonts/freefont/FreeSerif.ttf",
297 fontButtons = FontFactory.get(FontFactory.UBUNTU).getDefault();
298 fontSymbols = FontFactory.get(FontFactory.SYMBOLS).getDefault();
299 fontFPS = FontFactory.get(IOUtil.getResource(
"fonts/freefont/FreeMono.ttf",
300 FontSetDemos.class.getClassLoader(), FontSetDemos.class).getInputStream(),
true);
303 }
catch (
final IOException ioe) {
304 throw new RuntimeException(ioe);
307 this.filmURL = Uri.cast(
null != filmURL ? filmURL : defaultMediaURL );
308 }
catch (
final URISyntaxException e1) {
309 throw new RuntimeException(e1);
319 private void rotateButtons(
final Vec3f angdeg) {
320 angdeg.scale(FloatUtil.PI / 180.0f);
321 final List<Shape> sl =
new ArrayList<Shape>();
324 for(
final Shape s : sl) {
325 s.setRotation( s.getRotation().rotateByEuler( angdeg ) );
329 private void setButtonsSpacing(
final float dx,
final float dy) {
330 final List<Shape> sl =
new ArrayList<Shape>();
333 for(
final Shape s : sl) {
334 if( s instanceof Button ) {
335 final Button lb = (Button) s;
336 final float sx = lb.getSpacing().x()+dx, sy = lb.getSpacing().y()+dy;
337 System.err.println(
"Spacing: X "+sx+
", Y "+sy);
338 lb.setSpacing(sx, sy);
343 private void setButtonsCorner(
final float dc) {
344 final List<Shape> sl =
new ArrayList<Shape>();
347 for(
final Shape s : sl) {
348 if( s instanceof BaseButton ) {
349 final BaseButton rb = (BaseButton)s;
350 final float c = rb.getCorner()+dc;
351 System.err.println(
"Corner: "+c);
357 private void resetButtons() {
358 final List<Shape> sl =
new ArrayList<Shape>();
361 for(
final Shape s : sl) {
362 if( s instanceof BaseButton ) {
363 final BaseButton b = (BaseButton)s;
364 b.setRotation( b.getRotation().setIdentity() );
365 b.setCorner(BaseButton.ROUND_CORNER);
366 if( b instanceof Button ) {
367 ((Button)b).setSpacing(Button.DEFAULT_SPACING_X, Button.DEFAULT_SPACING_Y);
384 private void initSound(
final Shape shape,
385 final com.jogamp.openal.sound3d.Context context,
386 final com.jogamp.openal.sound3d.Source aSource)
388 final com.jogamp.openal.sound3d.Listener audioListener = AudioSystem3D.getListener();
389 context.makeCurrent(
true);
392 f3x2 = audioListener.getOrientation();
393 System.err.printf(
"Listener init orientation: at[%.3f %.3f %.3f], up[%.3f %.3f %.3f]%n",
394 f3x2[0], f3x2[1], f3x2[2], f3x2[3], f3x2[4], f3x2[5]);
395 f3x2 =
new float[]{ 0f, 0f, -1f, 0f, 1f, 0f };
396 audioListener.setOrientation(f3x2);
397 f3x2 = audioListener.getOrientation();
398 System.err.printf(
"Listener set orientation: at[%.3f %.3f %.3f], up[%.3f %.3f %.3f]%n",
399 f3x2[0], f3x2[1], f3x2[2], f3x2[3], f3x2[4], f3x2[5]);
401 com.jogamp.openal.sound3d.Vec3f ap = audioListener.
getPosition();
402 System.err.printf(
"Listener init pos: %.3f %.3f %.3f%n", ap.v1, ap.v2, ap.v3);
403 audioListener.setPosition(0, 0, -0.25f);
404 ap = audioListener.getPosition();
405 System.err.printf(
"Listener set pos: %.3f %.3f %.3f%n", ap.v1, ap.v2, ap.v3);
407 System.err.printf(
"Source init rel: %b%n", aSource.isSourceRelative());
408 aSource.setSourceRelative(
false);
409 System.err.printf(
"Source set rel: %b%n", aSource.isSourceRelative());
411 ap = aSource.getDirection();
412 System.err.printf(
"Source init dir: %.3f %.3f %.3f%n", ap.v1, ap.v2, ap.v3);
414 final float rollOff0 = aSource.getRolloffFactor();
415 System.err.printf(
"Source init rollOff: %.3f%n", rollOff0);
417 final float refDist0 = aSource.getReferenceDistance();
418 aSource.setReferenceDistance(0.75f);
419 final float refDist1 = aSource.getReferenceDistance();
420 System.err.printf(
"Source ref-dist: %.3f -> %.3f%n", refDist0, refDist1);
422 ap = aSource.getPosition();
423 System.err.printf(
"Source init pos: %.3f %.3f %.3f%n", ap.v1, ap.v2, ap.v3);
424 AudioSystem3D.checkError(context.getDevice(),
"setup",
true,
false);
426 setSoundPosition(shape, context, aSource);
428 context.release(
true);
432 private void setSoundPosition(
final Shape shape,
433 final com.jogamp.openal.sound3d.Context context,
434 final com.jogamp.openal.sound3d.Source aSource) {
437 final PMVMatrix4f pmv =
new PMVMatrix4f();
438 worldBounds = scene.
getBounds(pmv, shape);
440 context.makeCurrent(
true);
442 aSource.setPosition(worldBounds.getCenter().x(), worldBounds.getCenter().y(), worldBounds.getCenter().z());
443 System.err.println(
"Source pos: "+worldBounds.getCenter());
445 context.release(
true);
449 private static void setSineSoundLabel(
final Button shape,
final float freq,
final float amp) {
451 if( shape.isToggleOn() ) {
452 s = String.format(
"scroll %.0f Hz\nctrl-scroll %.2f amp\nmove spatial", freq, amp);
453 shape.setSpacing(0.05f, 0.20f);
455 s = String.format(
"click to enable\nf %.0f Hz, a %.2f", freq, amp);
456 shape.setSpacing(Button.DEFAULT_SPACING_X, Button.DEFAULT_SPACING_Y);
462 private void initButtons(
final GL2ES2 gl) {
463 final boolean pass2Mode = Region.isTwoPass( renderModes ) ;
467 final float buttonLWidth = buttonXSizeNorm;
468 final float buttonLHeight = buttonLWidth / 2.5f;
469 buttonsLeft.
setLayout(
new GridLayout(buttonLWidth, buttonLHeight, Alignment.Fill,
new Gap(buttonLHeight*0.50f, buttonLWidth*0.10f), 7));
471 final float buttonRWidth = 2f*buttonLWidth;
472 final float buttonRHeight = 2f*buttonLHeight;
474 buttonsRight.
setLayout(
new GridLayout(1, buttonRWidth, buttonRHeight, Alignment.Fill,
new Gap(buttonLHeight*0.50f, buttonLWidth*0.10f)));
476 System.err.println(
"Button Size: "+buttonLWidth+
" x "+buttonLHeight);
477 final Vec2f fixedSymSize =
new Vec2f(0.0f, 1.0f);
478 final Vec2f symSpacing =
new Vec2f(0f, 0.2f);
481 button =
new Button(renderModes, fontSymbols, fontSymbols.
getUTF16String(
"fast_forward"), buttonLWidth, buttonLHeight);
482 ((Button)button).setSpacing(symSpacing, fixedSymSize);
484 button.addMouseListener(
new Shape.MouseGestureAdapter() {
486 public void mouseClicked(
final MouseEvent e) {
487 if(
null != labels[currentText] ) {
490 currentText = (currentText+1)%labels.length;
491 if(
null != labels[currentText] ) {
495 button.addMouseListener(dragZoomRotateListener);
498 button =
new Button(renderModes, fontButtons,
"Show fps",
"Hide fps", buttonLWidth, buttonLHeight, Button.DEFAULT_LABEL_ZOFFSET);
500 button.setToggleable(
true);
502 button.addMouseListener(
new Shape.MouseGestureAdapter() {
504 public void mouseClicked(final MouseEvent e) {
505 final GLAnimatorControl a = cDrawable.getAnimator();
509 fpsLabel.setVisible(!fpsLabel.isVisible());
511 button.addMouseListener(dragZoomRotateListener);
514 button =
new Button(renderModes, fontButtons,
" V-Sync ", buttonLWidth, buttonLHeight);
516 button.setToggleable(
true);
517 button.setToggle(gl.getSwapInterval()>0);
518 button.addMouseListener(
new Shape.MouseGestureAdapter() {
520 public void mouseClicked(final MouseEvent e) {
521 cDrawable.invoke(false, new GLRunnable() {
523 public boolean run(final GLAutoDrawable drawable) {
524 final GL gl = drawable.getGL();
525 gl.setSwapInterval(gl.getSwapInterval()<=0?1:0);
526 final GLAnimatorControl a = drawable.getAnimator();
534 button.addMouseListener(dragZoomRotateListener);
537 button =
new Button(renderModes, fontButtons,
" < Tilt > ", buttonLWidth, buttonLHeight);
538 button.addMouseListener(
new Shape.MouseGestureAdapter() {
540 public void mouseClicked(final MouseEvent e) {
541 final Shape.EventInfo shapeEvent = (Shape.EventInfo) e.getAttachment();
542 if( shapeEvent.objPos.x() < shapeEvent.shape.getBounds().getCenter().x() ) {
543 rotateButtons(new Vec3f( 0f, -5f, 0f ) );
545 rotateButtons(new Vec3f( 0f, 5f, 0f ) );
549 public void mouseWheelMoved(
final MouseEvent e) {
550 rotateButtons(
new Vec3f( 0f, e.getRotation()[1], 0f ) );
555 button =
new Button(renderModes, fontButtons,
"< Samples >", buttonLWidth, buttonLHeight);
556 button.addMouseListener(
new Shape.MouseGestureAdapter() {
558 public void mouseClicked(final MouseEvent e) {
559 final Shape.EventInfo shapeEvent = (Shape.EventInfo) e.getAttachment();
560 int sampleCount = scene.getSampleCount();
561 if( shapeEvent.objPos.x() < shapeEvent.shape.getBounds().getCenter().x() ) {
568 sampleCount = scene.setSampleCount(sampleCount);
570 button.addMouseListener(dragZoomRotateListener);
573 button =
new Button(renderModes, fontButtons,
"< Quality >", buttonLWidth, buttonLHeight);
574 button.addMouseListener(
new Shape.MouseGestureAdapter() {
576 public void mouseClicked(final MouseEvent e) {
577 final Shape.EventInfo shapeEvent = (Shape.EventInfo) e.getAttachment();
578 if( shapeEvent.shape instanceof GraphShape ) {
579 int quality = scene.getAAQuality();
580 if( shapeEvent.objPos.x() < shapeEvent.shape.getBounds().getCenter().x() ) {
587 scene.setAAQuality(quality);
590 button.addMouseListener(dragZoomRotateListener);
594 button =
new Button(renderModes, fontSymbols, fontSymbols.
getUTF16String(
"power_settings_new"), buttonLWidth, buttonLHeight);
595 ((Button)button).setSpacing(symSpacing, fixedSymSize);
596 button.setID(BUTTON_QUIT);
597 button.setColor(0.7f, 0.3f, 0.3f, 1.0f);
598 ((Button)button).setLabelColor(1.2f, 1.2f, 1.2f, 1.0f);
599 button.setPressedColorMod(1.1f, 0.0f, 0.0f, 1.0f);
600 button.addMouseListener(
new Shape.MouseGestureAdapter() {
602 public void mouseClicked(
final MouseEvent e) {
603 MiscUtils.destroyWindow(cDrawable);
605 button.addMouseListener(dragZoomRotateListener);
610 button =
new Button(renderModes, fontSymbols, fontSymbols.
getUTF16String(
"flip"), buttonLWidth, buttonLHeight);
611 ((Button)button).setSpacing(symSpacing, fixedSymSize);
612 button.addMouseListener(
new Shape.MouseGestureAdapter() {
614 public void mouseClicked(
final MouseEvent e) {
615 rotateButtons(
new Vec3f ( 0f, 180f, 0f ));
617 button.addMouseListener(dragZoomRotateListener);
620 button =
new Button(renderModes, fontButtons,
" X Flip ", buttonLWidth, buttonLHeight);
621 button.addMouseListener(
new Shape.MouseGestureAdapter() {
623 public void mouseClicked(final MouseEvent e) {
624 rotateButtons(new Vec3f ( 180f, 0f, 0f ));
626 button.addMouseListener(dragZoomRotateListener);
629 button =
new Button(renderModes, fontButtons,
"< Space >", buttonLWidth, buttonLHeight);
630 button.addMouseListener(
new Shape.MouseGestureAdapter() {
632 public void mouseClicked(final MouseEvent e) {
633 final Shape.EventInfo shapeEvent = (Shape.EventInfo) e.getAttachment();
635 if( shapeEvent.objPos.x() < shapeEvent.shape.getBounds().getCenter().x() ) {
636 dx=-0.01f; dy=-0.005f;
640 setButtonsSpacing(dx, dy);
643 public void mouseWheelMoved(
final MouseEvent e) {
644 setButtonsSpacing(e.getRotation()[0]/100f, e.getRotation()[1]/200f);
648 button =
new Button(renderModes, fontButtons,
"< Corner >", buttonLWidth, buttonLHeight);
649 button.addMouseListener(
new Shape.MouseGestureAdapter() {
651 public void mouseClicked(final MouseEvent e) {
652 final Shape.EventInfo shapeEvent = (Shape.EventInfo) e.getAttachment();
654 if( shapeEvent.objPos.x() < shapeEvent.shape.getBounds().getCenter().x() ) {
659 setButtonsCorner(dc);
662 public void mouseWheelMoved(
final MouseEvent e) {
663 setButtonsCorner(e.getRotation()[1]/20f);
667 button =
new Button(renderModes, fontSymbols, fontSymbols.
getUTF16String(
"undo"), buttonLWidth, buttonLHeight);
668 ((Button)button).setSpacing(symSpacing, fixedSymSize);
669 button.addMouseListener(
new Shape.MouseGestureAdapter() {
671 public void mouseClicked(
final MouseEvent e) {
674 button.addMouseListener(dragZoomRotateListener);
677 button =
new Button(renderModes, fontSymbols, fontSymbols.
getUTF16String(
"camera"), buttonLWidth, buttonLHeight);
678 ((Button)button).setSpacing(symSpacing, fixedSymSize);
679 button.addMouseListener(
new Shape.MouseGestureAdapter() {
681 public void mouseClicked(
final MouseEvent e) {
682 scene.screenshot(
false, scene.
nextScreenshotFile(
null, UISceneDemo20.class.getSimpleName(), options.
renderModes, gl.getContext().getGLDrawable().getChosenGLCapabilities(),
null));
684 button.addMouseListener(dragZoomRotateListener);
691 final int texUnitMediaPlayer, texUnitImageButton, texUnitGLELButton;
694 texUnitMediaPlayer=1;
695 texUnitImageButton=2;
700 final GLMediaPlayer mPlayer = GLMediaPlayerFactory.createDefault();
701 mPlayer.setTextureUnit(texUnitMediaPlayer);
702 mPlayer.setAudioChannelLimit(1);
703 button =
new MediaButton(renderModes, buttonRWidth, buttonRHeight, mPlayer);
704 button.setID(BUTTON_MOVIE);
705 ((MediaButton)button).setVerbose(
false).addDefaultEventListener().setFixedARatioResize(
true);
706 button.setToggleable(
true);
707 button.setToggle(
true);
708 button.setToggleOffColorMod(0f, 1f, 0f, 1.0f);
709 button.addMouseListener(dragZoomRotateListener);
711 final ALAudioSink[] alAudioSink = {
null };
713 button.onToggle( (
final Shape s) -> {
714 mPlayer.setAudioVolume( s.isToggleOn() ? 1f : 0f );
716 mPlayer.addEventListener(
new GLMediaEventListener() {
718 public void attributesChanged(
final GLMediaPlayer mp,
final EventMask eventMask,
final long when) {
719 System.err.println(
"MediaButton AttributesChanges: "+eventMask+
", when "+when);
720 System.err.println(
"MediaButton State: "+mp);
721 if( eventMask.isSet(GLMediaPlayer.EventMask.Bit.Init) ) {
722 final AudioSink audioSink = mp.getAudioSink();
723 if( audioSink instanceof ALAudioSink ) {
724 alAudioSink[0] = (ALAudioSink)audioSink;
726 alAudioSink[0] =
null;
729 if( eventMask.isSet(GLMediaPlayer.EventMask.Bit.EOS) ) {
730 alAudioSink[0] =
null;
735 button.onMove((
final Shape shape,
final Vec3f origin,
final Vec3f dest,
final MouseEvent e) -> {
736 final ALAudioSink aSink = alAudioSink[0];
737 if(
null != aSink && aSink.getContext().isValid() ) {
738 setSoundPosition(shape, aSink.getContext(), aSink.getSource());
741 button.onDraw( (
final Shape shape,
final GL2ES2 gl_,
final RegionRenderer renderer_) -> {
742 final ALAudioSink aSink = alAudioSink[0];
743 if(
null != aSink && aSink.getContext().isValid() ) {
744 initSound(shape, aSink.getContext(), aSink.getSource());
745 System.err.println(
"Media Audio: "+aSink);
752 mPlayer.playStream(filmURL, GLMediaPlayer.STREAM_ID_AUTO, GLMediaPlayer.STREAM_ID_AUTO, GLMediaPlayer.STREAM_ID_NONE, GLMediaPlayer.TEXTURE_COUNT_DEFAULT);
755 final SimpleSineSynth sineSound =
new SimpleSineSynth();
760 sineSound.setFreq(200f);
761 sineSound.setAmplitude(0.1f);
762 final Button sineButton =
new Button(renderModes, fontButtons,
"lala", buttonRWidth, buttonRHeight);
764 button.setToggleable(
true);
765 button.setToggle(
false);
766 setSineSoundLabel(sineButton, sineSound.getFreq(), sineSound.getAmplitude());
768 final ALAudioSink aSink = sineSound.getSink();
769 final com.jogamp.openal.sound3d.Source aSource = aSink.getSource();
771 button.addMouseListener(
new Shape.MouseGestureAdapter() {
773 public void mouseReleased(final MouseEvent e) {
778 public void mouseDragged(
final MouseEvent e) {
779 final Shape.EventInfo shapeEvent = (Shape.EventInfo) e.getAttachment();
780 if( e.getPointerCount() == 1 ) {
781 final AABBox worldBounds;
783 final PMVMatrix4f pmv =
new PMVMatrix4f();
784 worldBounds = scene.
getBounds(pmv, shapeEvent.shape);
786 actionText = String.format((Locale)
null,
"Pos %s", worldBounds.getCenter());
790 public void mouseClicked(
final MouseEvent e) {
791 final Shape.EventInfo info = (Shape.EventInfo)e.getAttachment();
792 if( info.shape.isToggleOn() ) {
797 setSineSoundLabel(sineButton, sineSound.getFreq(), sineSound.getAmplitude());
800 public void mouseWheelMoved(
final MouseEvent e) {
801 if( e.isControlDown() ) {
802 final float a1 = sineSound.getAmplitude() + + e.getRotation()[1] / 20f;
803 sineSound.setAmplitude(a1);
805 final float f1 = sineSound.getFreq() + e.getRotation()[1] * 10f;
806 sineSound.setFreq(f1);
808 setSineSoundLabel(sineButton, sineSound.getFreq(), sineSound.getAmplitude());
809 System.err.println(
"Sine "+sineSound);
812 button.onDraw( (
final Shape shape,
final GL2ES2 gl_,
final RegionRenderer renderer_) -> {
813 if(
null != aSink && aSink.getContext().isValid() ) {
814 initSound(shape, aSink.getContext(), aSource);
815 System.err.println(
"Sine Audio: "+aSink);
821 button.onMove( (
final Shape shape,
final Vec3f origin,
final Vec3f dest,
final MouseEvent e) -> {
822 setSoundPosition(shape, aSink.getContext(), aSource);
827 final ImageSequence imgSeq =
new ImageSequence(texUnitImageButton,
true);
828 button =
new ImageButton(renderModes, buttonRWidth, buttonRHeight, imgSeq);
830 imgSeq.addFrame(gl, UISceneDemo20.class,
"button-released-145x53.png", TextureIO.PNG);
831 imgSeq.addFrame(gl, UISceneDemo20.class,
"button-pressed-145x53.png", TextureIO.PNG);
832 }
catch (
final IOException e2) {
833 e2.printStackTrace();
835 imgSeq.setManualStepping(
true);
836 button.addMouseListener(dragZoomRotateListener);
837 button.addMouseListener(
new Shape.MouseGestureAdapter() {
839 public void mousePressed(final MouseEvent e) {
840 final Shape.EventInfo info = (Shape.EventInfo)e.getAttachment();
841 final ImageButton s = (ImageButton)info.shape;
843 System.err.println(
"XXX: "+s);
846 public void mouseReleased(
final MouseEvent e) {
847 final Shape.EventInfo info = (Shape.EventInfo)e.getAttachment();
848 final ImageButton s = (ImageButton)info.shape;
856 final GearsES2 gears =
new GearsES2(0);
857 gears.setVerbose(
false);
858 gears.setClearColor(
new float[] { 0.9f, 0.9f, 0.9f, 1f } );
859 final boolean[] animate = {
true };
860 new Thread(
new Runnable() {
863 System.err.println(
"Gears Anim: Waiting");
865 gears.waitForInit(
true);
866 }
catch (
final InterruptedException e) { }
867 System.err.println(
"Gears Anim: Started");
868 while( gears.isInit() ) {
870 final float ry = ( gears.getRotY() + 1 ) % 360;
875 }
catch (
final InterruptedException e) { }
877 System.err.println(
"Gears Anim: End");
880 button =
new GLButton(renderModes, buttonRWidth, buttonRHeight,
881 texUnitGLELButton, gears,
false );
882 button.setID(BUTTON_GLEL);
883 button.setToggleable(
true);
884 button.setToggle(
false);
885 ((GLButton)button).setAnimate(
false);
886 button.addMouseListener(dragZoomRotateListener);
887 button.addMouseListener(
new Shape.MouseGestureAdapter() {
889 public void mouseClicked(
final MouseEvent e) {
890 final Shape.EventInfo info = (Shape.EventInfo)e.getAttachment();
891 final GLButton s = (GLButton)info.shape;
892 s.setAnimate( s.isToggleOn() );
893 animate[0] = s.getAnimate();
899 private void initTexts() {
900 strings =
new String[4];
903 strings[i++] =
"- Mouse Scroll Over Object\n"+
906 " - Shift: Y-Rotation\n"+
907 " - Tilt, Space and Corner\n"+
908 " - Their respective action via wheel\n"+
909 " (shift = other value)\n"+
911 "- Mouse Drag On Object\n"+
912 " - Click on Object and drag mouse\n"+
913 " - Current postion in status line at bottom\n"+
914 " - Resize when click on 1/4 bottom-left or bottom-right corner.\n"+
916 "- Tilt Button Rotate Whole Button Group";
918 strings[i++] =
"abcdefghijklmn\nopqrstuvwxyz\n"+
921 "0123456789.:,;(*!?/\\\")$%^&-+@~#<>{}[]";
923 strings[i++] =
"The quick brown fox jumps over the lazy dog";
925 strings[i++] = longText;
927 labels =
new Label[i];
929 currentText = strings.length - 1;
933 private static final boolean enableOthers =
true;
936 private void initLabels(
final GL2ES2 gl) {
937 jogampLabel =
new Label(renderModes, font, fontSizeFixedNorm, jogamp);
942 truePtSizeLabel =
new Label(renderModes, font, truePtSize);
944 truePtSizeLabel.
setColor(0.1f, 0.1f, 0.1f, 1.0f);
952 fpsLabel =
new Label(renderModes, fontFPS,
"Nothing there yet");
955 fpsLabel.
setColor(0.1f, 0.1f, 0.1f, 1.0f);
962 if( upObj instanceof
Window ) {
968 System.err.println(
"Monitor detected: "+monitor);
969 System.err.println(
"Monitor dpi: "+monitorDPI[0]+
" x "+monitorDPI[1]);
971 System.err.println(
"Surface dpi "+sDPI[0]+
" x "+sDPI[1]);
973 System.err.println(
"Using default DPI of "+dpiV);
976 final boolean noAA = dpiV >= noAADPIThreshold;
977 final String noAAs = noAA ?
" >= " :
" < ";
978 System.err.println(
"AUTO RenderMode: dpi "+dpiV+noAAs+noAADPIThreshold+
" -> noAA "+noAA);
982 System.err.println(
"UISceneDemo20: init (1)");
986 System.err.println(
"UISceneDemo20: init (0)");
988 cDrawable = drawable;
997 System.err.println(
"VSync Swap Interval: "+gl.getSwapInterval());
998 System.err.println(
"Chosen: "+drawable.getChosenGLCapabilities());
1001 gl.setSwapInterval(1);
1011 scene.
init(drawable);
1021 System.err.println(
"UISceneDemo20: reshape: "+x+
"/"+y+
" "+width+
"x"+height);
1022 System.err.println(
"UISceneDemo20: drawable: "+drawable);
1027 System.err.println(
"Reshape: Scene Plane.0 "+scene.
getBounds());
1030 System.err.println(
"Reshape: Scene Plane.0 "+lastSceneWidth+
" x "+lastSceneHeight);
1032 scene.
reshape(drawable, x, y, width, height);
1035 System.err.println(
"Reshape: Scene Plane.1 "+sceneBox);
1036 System.err.println(
"Reshape: Scene zEpsilon "+zEpsilon);
1038 final float sceneWidth = sceneBox.
getWidth();
1039 final float sceneHeight = sceneBox.
getHeight();
1040 final float button_sxy = sceneWidth > sceneHeight ? sceneWidth : sceneHeight;
1042 TreeTool.forAll(buttonsLeft, (
final Shape s) -> {
if( s instanceof
Button) { ((
Button)s).setLabelZOffset(zEpsilon); }
return false; } );
1043 TreeTool.forAll(buttonsRight, (
final Shape s) -> {
if( s instanceof
Button) { ((
Button)s).setLabelZOffset(zEpsilon); }
return false; } );
1047 buttonsLeft.
setScale(button_sxy, button_sxy, 1f);
1048 buttonsRight.
setScale(button_sxy, button_sxy, 1f);
1050 final float dz = 0f;
1051 final float dxLeft = sceneBox.
getMinX();
1052 final float dyBottom = sceneBox.
getMinY();
1053 final float dyTop = dyBottom + sceneHeight * relTop;
1055 System.err.println(
"XXX: dw "+sceneWidth+
", dh "+sceneHeight+
", dyTop "+dyTop);
1056 System.err.println(
"BL "+buttonsLeft);
1057 System.err.println(
"BL "+buttonsLeft.
getLayout());
1058 System.err.println(
"BR "+buttonsRight);
1059 System.err.println(
"BR "+buttonsRight.
getLayout());
1063 jogampLabel.
setScale(sceneHeight, sceneHeight, 1f);
1065 final float dxMiddleAbs = dxLeft + sceneWidth * relMiddle;
1070 final float scale = pixelSize10Pt / height * sceneHeight;
1071 System.err.println(
"10Pt PixelSize: Display "+dpiV+
" dpi, fontSize "+fontSizePt+
" pt, "+
FontScale.
ptToMM(fontSizePt)+
" mm -> "+pixelSize10Pt+
" pixels, "+scale+
" scene-size");
1072 truePtSizeLabel.
setScale(scale, scale, 1f);
1077 final float scale = sceneWidth / ( 1.4f * fbox.
getWidth() );
1078 fpsLabel.
setScale(scale, scale, 1f);
1081 System.err.println(
"StatusLabel Scale: " + scale +
" = " + sceneWidth +
" / " + fbox.
getWidth() +
", " + fbox);
1082 System.err.println(
"StatusLabel: " + fpsLabel);
1084 if(
null != labels[currentText] ) {
1085 labels[currentText].
setScale(sceneHeight, sceneHeight, 1f);
1086 labels[currentText].
moveTo(dxMiddleAbs,
1090 System.err.println(
"Label["+currentText+
"] MOVE: "+labels[currentText]);
1091 System.err.println(
"Label["+currentText+
"] MOVE: "+labels[currentText].getPosition());
1097 System.err.println(
"UISceneDemo20: dispose");
1109 if(
null == labels[currentText]) {
1111 final float sceneHeight = sbox.
getHeight();
1114 labels[currentText] =
new Label(renderModes, font, fontSizeFixedNorm, strings[currentText]);
1115 labels[currentText].
setScale(sceneHeight, sceneHeight, 1f);
1116 labels[currentText].
setColor(0.1f, 0.1f, 0.1f, 1.0f);
1117 labels[currentText].
setVisible(enableOthers);
1120 labels[currentText].
move(dxMiddle,
1125 scene.
addShape(labels[currentText]);
1126 System.err.println(
"Label["+currentText+
"] CTOR: "+labels[currentText]);
1127 System.err.println(
"Label["+currentText+
"] CTOR: "+labels[currentText].getPosition());
1131 if(
null == actionText ) {
1138 if( fpsLabel.
setText(text) ) {
1151 public void mouseReleased(
final MouseEvent e) {
1156 public void mouseDragged(
final MouseEvent e) {
1157 final Shape.EventInfo shapeEvent = (Shape.EventInfo) e.getAttachment();
1158 if( e.getPointerCount() == 1 ) {
1159 final AABBox worldBounds;
1162 worldBounds = scene.
getBounds(pmv, shapeEvent.shape);
1164 actionText = String.format((Locale)
null,
"Pos %s", worldBounds.
getCenter());
1169 public void mouseWheelMoved(
final MouseEvent e) {
1170 final Shape.EventInfo shapeEvent = (Shape.EventInfo) e.getAttachment();
1171 final Vec3f rot =
new Vec3f(e.getRotation()).
scale( FloatUtil.PI / 180.0f );
1173 final float tmp = rot.x(); rot.setX( rot.y() ); rot.setY( tmp );
1174 shapeEvent.shape.setRotation( shapeEvent.shape.getRotation().rotateByEuler( rot.scale( 2f ) ) );
Abstract Outline shape representation define the method an OutlineShape(s) is bound and rendered.
static String getRenderModeString(final int renderModes)
Returns a unique technical description string for renderModes as follows:
static final int VBAA_RENDERING_BIT
Rendering-Mode bit for Region.
final void setHintBits(final int mask)
The optional property jogamp.graph.font.ctor allows user to specify the FontConstructor implementatio...
static final FontSet get(final int font)
Simple static font scale methods for unit conversions.
static float ptToMM(final float points)
Converts the the given points size to mm, dividing by 72 * 25.4 points per inch.
static float toPixels(final float points, final float res_dpi)
Converts typical font size in points and screen resolution in dpi (pixels-per-inch) to font size in p...
Group of Shapes, optionally utilizing a Group.Layout.
void addShape(final Shape s)
Adds a Shape.
void removeAllShapes(final GL2ES2 gl, final RegionRenderer renderer)
Removes all contained shapes with Shape#destroy(GL2ES2, RegionRenderer).
List< Shape > getShapes()
Returns added Shapes.
Layout getLayout()
Return current Group.Layout.
Group setLayout(final Layout l)
Set Group.Layout.
void addShape(final Shape s)
Adds a Shape.
void addDisposeAction(final GLRunnable action)
Add a user one-time GLRunnable disposal action to an internal list, all invoked at {@Link dispose(GLA...
void init(final GLAutoDrawable drawable)
Called by the drawable immediately after the OpenGL context is initialized.
RegionRenderer getRenderer()
Returns the associated RegionRenderer.
Shape getShapeByID(final int id)
int setAAQuality(final int v)
Sets RegionRenderer#setAAQuality(int).
void dispose(final GLAutoDrawable drawable)
Disposes all added Shapes.
final void setPMVMatrixSetup(final PMVMatrixSetup setup)
Set a custom PMVMatrixSetup.
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)
void display(final GLAutoDrawable drawable)
Called by the drawable to initiate OpenGL rendering by the client.
void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height)
Reshape scene using setupMatrix(PMVMatrix4f, int, int, int, int) using PMVMatrixSetup.
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:
Convenient adapter combining dummy implementation for MouseListener and GestureListener.
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 setFixedARatioResize(final boolean v)
Sets whether aspect-ratio shall be kept at resize, if isResizable().
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 float getScaledHeight()
Returns the scaled height of the bounding AABBox for this shape.
final Vec3f getPosition()
Returns position Vec3f reference, i.e.
final boolean isVisible()
Returns true if this shape is set visible by the user, otherwise false.
final Shape validate(final GL2ES2 gl)
Validates the shape's underlying GLRegion.
final Shape addMouseListener(final MouseGestureListener l)
final Shape setVisible(final boolean v)
Enable (default) or disable this shape's visibility.
A GraphUI text label GraphShape.
boolean setText(final CharSequence text)
Set the text to be rendered.
float getScaledLineHeight()
Returns Font#getLineHeight() * getFontScale() * getScaleY().
Basic Float math utility functions.
static boolean isZero(final float a, final float epsilon)
Returns true if value is zero, i.e.
Axis Aligned Bounding Box.
final AABBox scale(final float s)
Scale this AABBox by a constant around fixed center.
final Vec3f getCenter()
Returns computed center of this AABBox of getLow() and getHigh().
PMVMatrix4f implements the basic computer graphics Matrix4f pack using projection (P),...
Visual output device, i.e.
static float[] perMMToPerInch(final float[] ppmm)
Converts [1/mm] to [1/inch] in place.
final float[] getPixelsPerMM(final float[] ppmmStore)
Returns the pixels per millimeter value according to the current mode's surface resolution.
static Display createDisplay(final String name)
Create a Display entity.
static Screen createScreen(final Display display, final int index)
Create a Screen entity.
A screen may span multiple MonitorDevices representing their combined virtual size.
Pointer event of type PointerType.
NEWT Window events are provided for notification purposes ONLY.
An implementation of GLAutoDrawable and Window interface, using a delegated Window instance,...
final void setTitle(final String title)
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.
CapabilitiesChooser setCapabilitiesChooser(final CapabilitiesChooser chooser)
Set the CapabilitiesChooser to help determine the native visual type.
final boolean setSurfaceScale(final float[] pixelScale)
Request a pixel scale in x- and y-direction for the associated NativeSurface, where size_in_pixel_uni...
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.
abstract GL setGL(GL gl)
Sets the GL pipeline object for this GLContext.
Factory for pipelining GL instances.
static final GL create(final String pipelineClazzBaseName, final Class<?> reqInterface, final GL downstream, final Object[] additionalArgs)
Creates a pipelined GL instance using the given downstream downstream and optional arguments addition...
static StringBuilder getGLInfo(final GL gl, final StringBuilder sb)
Complex interactive GraphUI Scene demo with different Button and Label Shapes layout on the screen.
static final int BUTTON_GLEL
UISceneDemo20(final String fontfilename, final String filmURL, final int renderModes, final boolean debug, final boolean trace)
void display(final GLAutoDrawable drawable)
Called by the drawable to initiate OpenGL rendering by the client.
static final int BUTTON_MOVIE
static void main(final String[] args)
void dispose(final GLAutoDrawable drawable)
Notifies the listener to perform the release of all OpenGL resources per GLContext,...
static final int BUTTON_NEXTTEXT
Shape getShapeByID(final int name)
void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height)
Called by the drawable during the first repaint after the component has been resized.
UISceneDemo20(final String fontfilename, final String filmURL, final float noAADPIThreshold, final boolean debug, final boolean trace)
static final int BUTTON_QUIT
void init(final GLAutoDrawable drawable)
Called by the drawable immediately after the OpenGL context is initialized.
static final int BUTTON_VSYNC
UISceneDemo20(final int renderModes)
static final float DefaultNoAADPIThreshold
Default DPI threshold value to disable VBAA: {@value} dpi.
static final int BUTTON_FPS
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 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.
final synchronized boolean stop()
Stops this animator.
Custom GLCapabilitiesChooser, filtering out all full screen anti-aliasing (FSAA, multisample) capabil...
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...
static String getUTF16String(final char codepoint)
Returns UTF-16 representation of the specified (unicode) codepoint symbol like Character#toChars(int)...
Adding mutable surface pixel scale property to implementing class, usually to a NativeSurface impleme...
float[] getMaximumSurfaceScale(final float[] result)
Returns the maximum pixel scale of the associated NativeSurface.
static final float AUTOMAX_PIXELSCALE
Setting surface-pixel-scale of {@value}, results in maximum platform dependent pixel-scale,...
float[] getCurrentSurfaceScale(final float[] result)
Returns the current pixel scale of the associated NativeSurface.
Specifying NEWT's Window functionality:
float[] getPixelsPerMM(final float[] ppmmStore)
Returns the pixels per millimeter of this window's NativeSurface according to the main monitor's curr...
MonitorDevice getMainMonitor()
Returns the MonitorDevice with the highest viewport coverage of this window.
void resetFPSCounter()
Reset all performance counter (startTime, currentTime, frame number)
An animator control interface, which implementation may drive a com.jogamp.opengl....
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.
Object getUpstreamWidget()
Method may return the upstream UI toolkit object holding this GLAutoDrawable instance,...
void addGLEventListener(GLEventListener listener)
Adds the given listener to the end of this drawable queue.
GL2ES2 getGL2ES2()
Casts this object to the GL2ES2 interface.
GLContext getContext()
Returns the GLContext associated which this GL object.
Declares events which client code can use to manage OpenGL rendering into a GLAutoDrawable.
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...
void glClearColor(float red, float green, float blue, float alpha)
Entry point to C language function: void {@native glClearColor}(GLfloat red, GLfloat green,...
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...
void glClear(int mask)
Entry point to C language function: void {@native glClear}(GLbitfield mask) Part of GL_ES_VERSION_...
static final int GL_BLEND
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_BLEND" with expressio...
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...