JOGL v2.6.0-rc-20250706
JOGL, High-Performance Graphics Binding for Java™ (public API).
UIGraphDemoU01a.java
Go to the documentation of this file.
1/**
2 * Copyright 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.IOException;
31
32import com.jogamp.graph.curve.Region;
33import com.jogamp.graph.curve.opengl.GLRegion;
34import com.jogamp.graph.curve.opengl.RegionRenderer;
35import com.jogamp.graph.curve.opengl.TextRegionUtil;
36import com.jogamp.graph.font.Font;
37import com.jogamp.graph.font.Font.Glyph;
38import com.jogamp.graph.font.FontFactory;
39import com.jogamp.graph.font.FontSet;
40import com.jogamp.graph.ui.GraphShape;
41import com.jogamp.graph.ui.shapes.CrossHair;
42import com.jogamp.math.FloatUtil;
43import com.jogamp.math.Matrix4f;
44import com.jogamp.math.Recti;
45import com.jogamp.math.Vec2f;
46import com.jogamp.math.Vec2i;
47import com.jogamp.math.Vec3f;
48import com.jogamp.math.Vec4f;
49import com.jogamp.math.geom.AABBox;
50import com.jogamp.math.geom.plane.AffineTransform;
51import com.jogamp.math.util.PMVMatrix4f;
52import com.jogamp.newt.event.WindowAdapter;
53import com.jogamp.newt.event.WindowEvent;
54import com.jogamp.newt.opengl.GLWindow;
55import com.jogamp.opengl.GL;
56import com.jogamp.opengl.GL2ES2;
57import com.jogamp.opengl.GLAutoDrawable;
58import com.jogamp.opengl.GLCapabilities;
59import com.jogamp.opengl.GLEventListener;
60import com.jogamp.opengl.JoglVersion;
61import com.jogamp.opengl.demos.util.CommandlineOptions;
62import com.jogamp.opengl.demos.util.MiscUtils;
63import com.jogamp.opengl.util.Animator;
64
65/**
66 * Res independent Graph + GraphUI integration demo
67 * using a GraphUI Shape and Graph text rendering
68 * within a regular GLEventListener, attached to a GLWindow.
69 * <p>
70 * This demo showcases how to integrate Graph and GraphUI with different projection variations.
71 * </p>
72 * <p>
73 * Pass '-projPersp' to main-function to use perspective projection, otherwise orthogonal projection is used.
74 * </p>
75 * <p>
76 * Pass '-projWin' to main-function to use orthogonal projection with window coordinates, otherwise [-0.5, 0.5] is being used
77 * </p>
78 * <p>
79 * Default projection is orthogonal with width = 1, world-model range [-0.5, 0.5].
80 * </p>
81 * <p>
82 * The world-model height is always scaled to window aspect ratio.
83 * </p>
84 * <p>
85 * 0/0 origin in its bottom-left corner, same as GraphUI
86 * </p>
87 * <p>
88 * Pass '-x <int>' and '-y <int>' widget position in window coordinates (bottom left origin). Default is center, i.e. half window width and height.<br/>
89 * Note: Reshape won't adjust and this is merely to demonstrate the coordinate space.
90 * </p>
91 */
92public class UIGraphDemoU01a {
93 static final CommandlineOptions options = new CommandlineOptions(1280, 720, Region.VBAA_RENDERING_BIT );
94 static final Vec4f text_color = new Vec4f( 0, 1, 0, 1 );
95 static Font font;
96 static boolean projOrtho = true;
97 static boolean projOrthoWin = false;
98 static boolean textOnly = false;
99 static int pass2TexUnit = GLRegion.DEFAULT_TWO_PASS_TEXTURE_UNIT;
100 static final Vec2i winOrigin = new Vec2i(options.surface_width/2, options.surface_height/2);
101 static final float normWidgetSize = 1/4f;
102
103 public static void main(final String[] args) throws IOException {
104 if( 0 != args.length ) {
105 final int[] idx = { 0 };
106 for(idx[0]=0; idx[0]<args.length; ++idx[0]) {
107 if( options.parse(args, idx) ) {
108 continue;
109 } else if(args[idx[0]].equals("-projPersp")) {
110 projOrtho = false;
111 projOrthoWin = false;
112 } else if(args[idx[0]].equals("-projWin")) {
113 projOrtho = true;
114 projOrthoWin = true;
115 } else if(args[idx[0]].equals("-texUnit")) {
116 idx[0]++;
117 pass2TexUnit = MiscUtils.atoi(args[idx[0]], pass2TexUnit);
118 } else if(args[idx[0]].equals("-x")) {
119 idx[0]++;
120 winOrigin.setX( MiscUtils.atoi(args[idx[0]], winOrigin.x()) );
121 } else if(args[idx[0]].equals("-y")) {
122 idx[0]++;
123 winOrigin.setY( MiscUtils.atoi(args[idx[0]], winOrigin.y()) );
124 } else if(args[idx[0]].equals("-textOnly")) {
125 textOnly = true;
126 }
127 }
128 }
129 System.err.println(JoglVersion.getInstance().toString());
130
131 System.err.println(options);
132 System.err.println("Ortho Projection "+projOrtho+", Ortho-Win "+projOrthoWin);
133 System.err.println("pass2TexUnit "+pass2TexUnit);
134
135 final GLCapabilities reqCaps = options.getGLCaps();
136 System.out.println("Requested: " + reqCaps);
137
138 //
139 // Resolution independent, no screen size
140 //
142 System.err.println("Font: "+font.getFullFamilyName());
143
144 final Animator animator = new Animator(0 /* w/o AWT */);
145
146 final MyRenderer renderer = new MyRenderer();
147
148 final GLWindow window = GLWindow.create(reqCaps);
149 window.setSize(options.surface_width, options.surface_height);
150 window.setTitle(UIGraphDemoU01a.class.getSimpleName()+": "+window.getSurfaceWidth()+" x "+window.getSurfaceHeight());
151 window.setVisible(true);
152 System.out.println("Chosen: " + window.getChosenGLCapabilities());
153 window.addGLEventListener(renderer);
154 window.addWindowListener(new WindowAdapter() {
155 @Override
156 public void windowResized(final WindowEvent e) {
157 window.setTitle(UIGraphDemoU01a.class.getSimpleName()+": "+window.getSurfaceWidth()+" x "+window.getSurfaceHeight());
158 }
159 @Override
160 public void windowDestroyNotify(final WindowEvent e) {
161 animator.stop();
162 }
163 });
164
165 animator.setUpdateFPSFrames(1*60, null); // System.err);
166 animator.add(window);
167 animator.start();
168
169 }
170
171 public static class MyRenderer implements GLEventListener {
172 private final float angle;
173 private final float zNear;
174 private final float zFar;
175 private final float sceneDist;
176
177 /** World dimension in world-model (object) coordinates. */
178 private final Vec2f worldDim = new Vec2f(1f, 1f);
179 /** World origin (bottom left) offset. */
180 private final Vec3f worldOrigin = new Vec3f();
181 /** Graph region renderer */
182 private final RegionRenderer renderer;
183 /** The Graph region for text */
184 private GLRegion textRegion;
185 /** The GraphUI shape */
186 private GraphShape shape;
187
188 public MyRenderer() {
189 if( projOrtho ) {
190 angle = 0.0f;
191 zNear = -1f;
192 zFar = 1f;
193 sceneDist = zNear;
194 } else {
195 angle = FloatUtil.QUARTER_PI;
196 zNear = 0.1f;
197 zFar = 7000.0f;
198 sceneDist = -zNear;
199 }
201 renderer.setAAQuality(options.graphAAQuality);
202 renderer.setSampleCount(options.graphAASamples);
203 }
204
205 @Override
206 public void init(final GLAutoDrawable drawable) {
207 final GL2ES2 gl = drawable.getGL().getGL2ES2();
208 System.err.println(JoglVersion.getGLInfo(gl, null));
209
210 if( !textOnly ) {
211 shape = new CrossHair(options.renderModes, normWidgetSize, normWidgetSize, normWidgetSize/100f); // normalized: 1 is 100% surface size (width and/or height)
212 shape.setTextureUnit(pass2TexUnit);
213 shape.setColor(0, 0, 1, 1);
214 System.err.println("Init: Shape bounds "+shape.getBounds(drawable.getGLProfile()));
215 System.err.println("Init: Shape "+shape);
216 }
217
218 renderer.init(gl);
219
220 if( null == textRegion ) {
221 textRegion = GLRegion.create(gl.getGLProfile(), options.renderModes, null, pass2TexUnit, 0, 0);
222 }
223 }
224
225 @Override
226 public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) {
227 renderer.reshapeNotify(x, y, width, height);
228 setMatrix(renderer.getMatrix(), renderer.getViewport());
229
230 // scale shapes from normalized size 1 and to keep aspect ratio
231 if( !textOnly ) {
232 final float s = Math.min(worldDim.x(), worldDim.y());
233 shape.setScale(s, s, 1f);
234 }
235 }
236 private void setMatrix(final PMVMatrix4f pmv, final Recti viewport) {
237 pmv.loadPIdentity();
238 final float ratio = (float)viewport.width()/(float)viewport.height();
239 if( projOrthoWin ) {
240 worldDim.setX( viewport.width() );
241 worldDim.setY( worldDim.x() / ratio ); // adjust aspect ratio
242 pmv.orthoP(0, worldDim.x(), 0, worldDim.y(), zNear, zFar);
243 // similar: renderer.reshapeOrtho(viewport.width(), viewport.height(), zNear, zFar);
244 } else if( projOrtho ) {
245 worldDim.setY( worldDim.x() / ratio ); // adjust aspect ratio
246 pmv.orthoP(-worldDim.x()/2f, worldDim.x()/2f, -worldDim.y()/2f, worldDim.y()/2f, zNear, zFar);
247 } else {
248 pmv.perspectiveP(angle, ratio, zNear, zFar);
249 {
250 final Vec3f obj00Coord = new Vec3f();
251 final Vec3f obj11Coord = new Vec3f();
252
253 winToPlaneCoord(pmv, viewport, zNear, zFar, viewport.x(), viewport.y(), -sceneDist, obj00Coord);
254 winToPlaneCoord(pmv, viewport, zNear, zFar, viewport.width(), viewport.height(), -sceneDist, obj11Coord);
255
256 final AABBox planeBox = new AABBox();
257 planeBox.setSize( obj00Coord, obj11Coord );
258 worldDim.set(planeBox.getWidth(), planeBox.getHeight());
259 }
260 }
261 pmv.translateP(0f, 0f, sceneDist); // nose to plane
262
263 pmv.loadMvIdentity();
264
265 winToPlaneCoord(pmv, viewport, zNear, zFar, winOrigin.x(), winOrigin.y(), -sceneDist, worldOrigin);
266 {
267 final Matrix4f p = pmv.getP();
268 final Matrix4f mv = pmv.getMv();
269 System.err.println("Reshape VP: "+viewport);
270 System.err.println("Reshape P :"); System.err.println(p.toString());
271 System.err.println("Reshape Mv:"); System.err.println(mv.toString());
272 System.err.println("World Dim : "+worldDim);
273 System.err.println("Window Origin: "+winOrigin);
274 System.err.println("World Origin : "+worldOrigin);
275 }
276 pmv.translateMv(worldOrigin.x(), worldOrigin.y(), 0); // move to custom origin
277 }
278 public static void winToPlaneCoord(final PMVMatrix4f pmv, final Recti viewport,
279 final float zNear, final float zFar,
280 final float winX, final float winY, final float objOrthoZ,
281 final Vec3f objPos) {
282 final float winZ = FloatUtil.getOrthoWinZ(objOrthoZ, zNear, zFar);
283 pmv.mapWinToObj(winX, winY, winZ, viewport, objPos);
284 }
285
286 @Override
287 public void display(final GLAutoDrawable drawable) {
288 final GL2ES2 gl = drawable.getGL().getGL2ES2();
289
290 gl.glClearColor(1f, 1f, 1f, 1f);
292
293 final PMVMatrix4f pmv = renderer.getMatrix();
294
295 if( onceAtDisplay ) {
296 final Matrix4f p = pmv.getP();
297 final Matrix4f mv = pmv.getMv();
298 System.err.println("Display.0: P :"); System.err.println(p.toString());
299 System.err.println("Display.0: Mv:"); System.err.println(mv.toString());
300 }
301
302 renderer.enable(gl, true);
303 {
304 pmv.pushMv();
305 drawText(gl, pmv, " Hello JogAmp Users!");
306 pmv.popMv();
307 }
308 if( !textOnly ) {
309 pmv.pushMv();
310 shape.applyMatToMv(pmv);
311
312 shape.draw(gl, renderer);
313 if( onceAtDisplay ) {
314 final Matrix4f p = pmv.getP();
315 final Matrix4f mv = pmv.getMv();
316 System.err.println("Display.1: P :"); System.err.println(p.toString());
317 System.err.println("Display.1: Mv:"); System.err.println(mv.toString());
318 System.err.println("Display.1: Shape bounds "+shape.getBounds(drawable.getGLProfile()));
319 System.err.println("Display.1: Shape "+shape);
320 final Recti shapePort = shape.getSurfacePort(pmv, renderer.getViewport(), new Recti());
321 System.err.println("Display.1: Shape SurfacePort "+shapePort);
322 }
323 pmv.popMv();
324 }
325 renderer.enable(gl, false);
326 onceAtDisplay = false;
327 }
328 private void drawText(final GL2ES2 gl, final PMVMatrix4f pmv, final String text) {
329 final AffineTransform tempT1 = new AffineTransform();
330 final AffineTransform tempT2 = new AffineTransform();
331
332 final AABBox txt_box_em = font.getGlyphBounds(text, tempT1, tempT2);
333 final float full_width_s = worldDim.x() / txt_box_em.getWidth();
334 final float full_height_s = worldDim.y() / txt_box_em.getHeight();
335 final float txt_scale = full_width_s < full_height_s ? full_width_s * normWidgetSize : full_height_s * normWidgetSize;
336 pmv.scaleMv(txt_scale, txt_scale, 1f);
337 pmv.translateMv(-txt_box_em.getWidth(), 0f, 0f);
338 final AABBox txt_box_r = TextRegionUtil.drawString3D(gl, textRegion.clear(gl), renderer, font, text, text_color, tempT1, tempT2);
339
340 if( onceAtDisplay ) {
341 System.err.println("XXX: full_width: "+worldDim.x()+" / "+txt_box_em.getWidth()+" -> "+full_width_s);
342 System.err.println("XXX: full_height: "+worldDim.y()+" / "+txt_box_em.getHeight()+" -> "+full_height_s);
343 System.err.println("XXX: txt_scale: "+txt_scale);
344 System.err.println("XXX: txt_box_em "+txt_box_em);
345 System.err.println("XXX: txt_box_r "+txt_box_r);
346 final AABBox textPort = txt_box_r.mapToWindow(new AABBox(), pmv.getPMv(), renderer.getViewport(), true /* useCenterZ */);
347 System.err.println("Display.1: Shape TextPort "+textPort);
348
349 final Font.GlyphVisitor visitor = new Font.GlyphVisitor() {
350 int idx = 0;
351 @Override
352 public void visit(final Glyph glyph, final AffineTransform t) {
353 System.err.println("idx["+idx+"]: "+glyph);
354 ++idx;
355 }
356 };
357 final AABBox txt_box_r2 = font.processString(visitor, null, text, new AffineTransform(), new AffineTransform());
358 System.err.println("XXX: txt_box_r2 "+txt_box_r2);
359 {
360 final Glyph g = font.getGlyph( ' ' );
361 System.err.println("XXX: space "+g);
362 }
363 {
364 final Glyph g = font.getGlyph( '\t' );
365 System.err.println("XXX: tab "+g);
366 }
367 }
368 }
369 private boolean onceAtDisplay = true;
370
371 @Override
372 public void dispose(final GLAutoDrawable drawable) {
373 final GL2ES2 gl = drawable.getGL().getGL2ES2();
374 textRegion.destroy(gl);
375 if( !textOnly ) {
376 shape.destroy(gl, renderer);
377 }
378 renderer.destroy(gl);
379 System.err.println("Destroyed");
380 }
381 }
382}
Abstract Outline shape representation define the method an OutlineShape(s) is bound and rendered.
Definition: Region.java:62
static final int DEFAULT_TWO_PASS_TEXTURE_UNIT
Definition: Region.java:181
static final int VBAA_RENDERING_BIT
Rendering-Mode bit for Region.
Definition: Region.java:115
A GLRegion is the OGL binding of one or more OutlineShapes Defined by its vertices and generated tria...
Definition: GLRegion.java:70
final GLRegion clear(final GL2ES2 gl)
Clears all buffers, i.e.
Definition: GLRegion.java:436
final void destroy(final GL2ES2 gl)
Delete and clear the associated OGL objects.
Definition: GLRegion.java:460
static GLRegion create(final GLProfile glp, int renderModes, final TextureSequence colorTexSeq, final int pass2TexUnit, final int initialVerticesCount, final int initialIndicesCount)
Create a GLRegion using the passed render mode.
Definition: GLRegion.java:109
final void enable(final GL2ES2 gl, final boolean enable)
Enabling or disabling the RenderState's current shader program.
final PMVMatrix4f getMatrix()
Borrow the current PMVMatrix4f.
final void reshapeNotify(final int x, final int y, final int width, final int height)
No PMVMatrix4f operation is performed here.
final int setSampleCount(final int v)
Sets pass2 AA sample count clipped to the range [Region#MIN_AA_SAMPLE_COUNT..Region#MAX_AA_SAMPLE_COU...
static final GLCallback defaultBlendDisable
Default GL#GL_BLEND disable GLCallback, simply turning-off the GL#GL_BLEND state and turning-on depth...
final int setAAQuality(final int v)
Sets pass2 AA-quality rendering value clipped to the range [Region#MIN_AA_QUALITY....
static final GLCallback defaultBlendEnable
Default GL#GL_BLEND enable GLCallback, turning-off depth writing via GL#glDepthMask(boolean) if Rende...
final void init(final GL2ES2 gl)
Initialize shader and bindings for GPU based rendering bound to the given GL object's GLContext if no...
static RegionRenderer create()
Create a hardware accelerated RegionRenderer including its RenderState composition.
final Recti getViewport(final Recti target)
Copies the current Rect4i viewport in given target and returns it for chaining.
final void destroy(final GL2ES2 gl)
Deletes all ShaderPrograms and nullifies its references including RenderState#destroy(GL2ES2).
Text Type Rendering Utility Class adding the Font.Glyphs OutlineShape to a GLRegion.
AABBox drawString3D(final GL2ES2 gl, final RegionRenderer renderer, final Font font, final CharSequence str, final Vec4f rgbaColor)
Render the string in 3D space w.r.t.
The optional property jogamp.graph.font.ctor allows user to specify the FontConstructor implementatio...
static final FontSet get(final int font)
static final int UBUNTU
Ubuntu is the default font family, {@value}.
Graph based GLRegion Shape.
Definition: GraphShape.java:55
void setTextureUnit(final int pass2TexUnit)
Set the 2nd pass texture unit.
Definition: GraphShape.java:89
Shape setColor(final float r, final float g, final float b, final float a)
Set base color.
Definition: Shape.java:1389
final Shape setScale(final Vec3f s)
Set scale factor to given scale.
Definition: Shape.java:641
void draw(final GL2ES2 gl, final RegionRenderer renderer)
Renders the shape.
Definition: Shape.java:798
final Recti getSurfacePort(final PMVMatrix4f pmv, final Recti viewport, final Recti surfacePort)
Retrieve surface (view) port of this shape, i.e.
Definition: Shape.java:1067
final AABBox getBounds()
Returns the unscaled bounding AABBox for this shape, borrowing internal instance.
Definition: Shape.java:732
final void destroy(final GL2ES2 gl, final RegionRenderer renderer)
Destroys all data.
Definition: Shape.java:457
final void applyMatToMv(final PMVMatrix4f pmv)
Applies the internal Matrix4f to the given modelview matrix, i.e.
Definition: Shape.java:908
A GraphUI Crosshair GraphShape.
Definition: CrossHair.java:41
Basic Float math utility functions.
Definition: FloatUtil.java:83
static float getOrthoWinZ(final float orthoZ, final float zNear, final float zFar)
Returns orthogonal distance (1f/zNear-1f/orthoZ) / (1f/zNear-1f/zFar);.
static final float QUARTER_PI
The value PI/4, i.e.
Basic 4x4 float matrix implementation using fields for intensive use-cases (host operations).
Definition: Matrix4f.java:89
StringBuilder toString(final StringBuilder sb, final String rowPrefix, final String f)
Definition: Matrix4f.java:2085
Rectangle with x, y, width and height integer components.
Definition: Recti.java:34
2D Vector based upon two float components.
Definition: Vec2f.java:37
void set(final Vec2f o)
this = o, returns this.
Definition: Vec2f.java:73
void setY(final float y)
Definition: Vec2f.java:139
void setX(final float x)
Definition: Vec2f.java:138
2D Vector based upon two integer components.
Definition: Vec2i.java:34
void setX(final int x)
Definition: Vec2i.java:92
void setY(final int y)
Definition: Vec2i.java:93
3D Vector based upon three float components.
Definition: Vec3f.java:37
4D Vector based upon four float components.
Definition: Vec4f.java:37
Axis Aligned Bounding Box.
Definition: AABBox.java:54
final float getWidth()
Definition: AABBox.java:879
final float getHeight()
Definition: AABBox.java:883
AABBox mapToWindow(final AABBox result, final Matrix4f mat4PMv, final Recti viewport, final boolean useCenterZ)
Assume this bounding box as being in object space and compute the window bounding box.
Definition: AABBox.java:966
final AABBox setSize(final float[] low, final float[] high)
Set size of the AABBox specifying the coordinates of the low and high.
Definition: AABBox.java:173
PMVMatrix4f implements the basic computer graphics Matrix4f pack using projection (P),...
final PMVMatrix4f translateMv(final float x, final float y, final float z)
Translate the modelview matrix.
final PMVMatrix4f scaleMv(final float x, final float y, final float z)
Scale the modelview matrix.
final PMVMatrix4f loadMvIdentity()
Load the modelview matrix with the values of the given Matrix4f.
final Matrix4f getMv()
Returns the modelview matrix (Mv).
final PMVMatrix4f translateP(final float x, final float y, final float z)
Translate the projection matrix.
final PMVMatrix4f perspectiveP(final float fovy_rad, final float aspect, final float zNear, final float zFar)
Multiply the projection matrix with the perspective/frustum matrix.
final Matrix4f getPMv()
Returns the pre-multiplied projection x modelview, P x Mv.
final void orthoP(final float left, final float right, final float bottom, final float top, final float zNear, final float zFar)
Multiply the projection matrix with the orthogonal matrix.
final PMVMatrix4f loadPIdentity()
Load the projection matrix with the values of the given Matrix4f.
final Matrix4f getP()
Returns the projection matrix (P).
final PMVMatrix4f popMv()
Pop the modelview matrix from its stack.
final boolean mapWinToObj(final float winx, final float winy, final float winz, final Recti viewport, final Vec3f objPos)
Map window coordinates to object coordinates.
final PMVMatrix4f pushMv()
Push the modelview matrix to its stack, while preserving its values.
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 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.
static JoglVersion getInstance()
static StringBuilder getGLInfo(final GL gl, final StringBuilder sb)
StringBuilder toString(final GL gl, StringBuilder sb)
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.
void dispose(final GLAutoDrawable drawable)
Notifies the listener to perform the release of all OpenGL resources per GLContext,...
void display(final GLAutoDrawable drawable)
Called by the drawable to initiate OpenGL rendering by the client.
void init(final GLAutoDrawable drawable)
Called by the drawable immediately after the OpenGL context is initialized.
static void winToPlaneCoord(final PMVMatrix4f pmv, final Recti viewport, final float zNear, final float zFar, final float winX, final float winY, final float objOrthoZ, final Vec3f objPos)
Res independent Graph + GraphUI integration demo using a GraphUI Shape and Graph text rendering withi...
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.
static int atoi(final String str, final int def)
Definition: MiscUtils.java:60
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
static final int FAMILY_LIGHT
Font family LIGHT, {@value}.
Definition: FontSet.java:39
Font get(int family, int stylebits)
static final int STYLE_SERIF
SERIF style/family bit flag.
Definition: FontSet.java:54
General purpose Font.Glyph visitor.
Definition: Font.java:298
Interface wrapper for font implementation.
Definition: Font.java:60
Glyph getGlyph(final String name)
Returns the Glyph mapped to given name.
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...
AABBox processString(final Font.GlyphVisitor visitor, final AffineTransform transform, final CharSequence string)
Try using processString(GlyphVisitor, AffineTransform, CharSequence, AffineTransform,...
A higher-level abstraction than GLDrawable which supplies an event based mechanism (GLEventListener) ...
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.
GL2ES2 getGL2ES2()
Casts this object to the GL2ES2 interface.
GLProfile getGLProfile()
Returns the GLProfile associated with this GL object.
GLCapabilitiesImmutable getChosenGLCapabilities()
Fetches the GLCapabilitiesImmutable corresponding to the chosen OpenGL capabilities (pixel format / v...
GLProfile getGLProfile()
Fetches the GLProfile for this drawable.
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...
Definition: GL.java:390
void glClearColor(float red, float green, float blue, float alpha)
Entry point to C language function: void {@native glClearColor}(GLfloat red, GLfloat green,...
void glClear(int mask)
Entry point to C language function: void {@native glClear}(GLbitfield mask) Part of GL_ES_VERSION_...
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