JOGL v2.6.0-rc-20250706
JOGL, High-Performance Graphics Binding for Java™ (public API).
UIShapeClippingDemo00.java
Go to the documentation of this file.
1/**
2 * Copyright 2010-2024 JogAmp Community. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without modification, are
5 * permitted provided that the following conditions are met:
6 *
7 * 1. Redistributions of source code must retain the above copyright notice, this list of
8 * conditions and the following disclaimer.
9 *
10 * 2. Redistributions in binary form must reproduce the above copyright notice, this list
11 * of conditions and the following disclaimer in the documentation and/or other materials
12 * provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
15 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
16 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
19 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
21 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
22 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 *
24 * The views and conclusions contained in the software and documentation are those of the
25 * authors and should not be interpreted as representing official policies, either expressed
26 * or implied, of JogAmp Community.
27 */
28package com.jogamp.opengl.demos.graph.ui;
29
30import java.io.File;
31import java.io.IOException;
32
33import com.jogamp.common.util.InterruptSource;
34import com.jogamp.graph.curve.Region;
35import com.jogamp.graph.curve.opengl.RegionRenderer;
36import com.jogamp.graph.ui.Scene;
37import com.jogamp.graph.ui.Shape;
38import com.jogamp.graph.ui.shapes.Rectangle;
39import com.jogamp.math.FloatUtil;
40import com.jogamp.math.Vec3f;
41import com.jogamp.math.geom.Cube;
42import com.jogamp.math.geom.Frustum;
43import com.jogamp.math.geom.plane.AffineTransform;
44import com.jogamp.math.util.PMVMatrix4f;
45import com.jogamp.newt.Window;
46import com.jogamp.newt.event.KeyAdapter;
47import com.jogamp.newt.event.KeyEvent;
48import com.jogamp.newt.event.KeyListener;
49import com.jogamp.newt.event.MouseAdapter;
50import com.jogamp.newt.event.MouseEvent;
51import com.jogamp.newt.event.WindowAdapter;
52import com.jogamp.newt.event.WindowEvent;
53import com.jogamp.newt.opengl.GLWindow;
54import com.jogamp.opengl.GL;
55import com.jogamp.opengl.GL2ES2;
56import com.jogamp.opengl.GLAutoDrawable;
57import com.jogamp.opengl.GLCapabilities;
58import com.jogamp.opengl.GLEventListener;
59import com.jogamp.opengl.GLException;
60import com.jogamp.opengl.GLPipelineFactory;
61import com.jogamp.opengl.GLRunnable;
62import com.jogamp.opengl.demos.graph.MSAATool;
63import com.jogamp.opengl.demos.util.CommandlineOptions;
64import com.jogamp.opengl.util.Animator;
65import com.jogamp.opengl.util.GLReadBufferUtil;
66
67/**
68 * Basic UIShape Clipping demo, using manual invocation via GLEventListener w/o a Scene.
69 * <p>
70 * The Clip-Rectangle acts as the clipping area, AABBox transformed into Cube in Mv-space producing the Frustum.
71 * </p>
72 * <p>
73 * The Shape-Rectangle is rendering as a child-node to the Clip-Rectangle,
74 * i.e. using its PMVMatrix4f as parent.
75 * </p>
76 *
77 * Action Cursor-Keys:
78 * - With Shift : Move the clipping-rectangle itself
79 * - With Control: Resize Left and Bottom Clipping Edge of AABBox
80 * - No Modifiers: Resize Right and Top Clipping Edge of AABBox
81 */
82public class UIShapeClippingDemo00 implements GLEventListener {
83 static final boolean DEBUG = false;
84 static final boolean TRACE = false;
85
86 static CommandlineOptions options = new CommandlineOptions(1280, 720, Region.VBAA_RENDERING_BIT);
87
88 static final float szw = 1/3f * 0.8f;
89 static final float szh = szw * 1f/2f;
90 static Rectangle clipRect;
91
92 public static void main(final String[] args) throws IOException {
93 final int[] idx = { 0 };
94 for (idx[0] = 0; idx[0] < args.length; ++idx[0]) {
95 if( options.parse(args, idx) ) {
96 continue;
97 }
98 }
99 System.err.println(options);
100 final GLCapabilities reqCaps = options.getGLCaps();
101 System.out.println("Requested: " + reqCaps);
102
103 final GLWindow window = GLWindow.create(reqCaps);
104 // window.setPosition(10, 10);
105 window.setSize(options.surface_width, options.surface_height);
106 window.setTitle(UIShapeClippingDemo00.class.getSimpleName()+": "+window.getSurfaceWidth()+" x "+window.getSurfaceHeight());
107
108 clipRect = new Rectangle(options.renderModes, szw, szh, 1/2000f);
109 clipRect.move(-szw/2f, -szh/2f, Scene.DEFAULT_Z16_EPSILON).setColor(0, 0, 0, 1); // above
110
111 final UIShapeClippingDemo00 uiGLListener = new UIShapeClippingDemo00(options.renderModes, DEBUG, TRACE);
112 uiGLListener.attachInputListenerTo(window);
113 window.addGLEventListener(uiGLListener);
114 window.setVisible(true);
115 System.out.println("Chosen: " + window.getChosenGLCapabilities());
116
117 final Animator animator = new Animator(0 /* w/o AWT */);
118 animator.setUpdateFPSFrames(5*60, null);
119 animator.add(window);
120
121 window.addKeyListener(new KeyAdapter() {
122 @Override
123 public void keyPressed(final KeyEvent arg0) {
124 final short keySym = arg0.getKeySymbol();
125 final float less = 0.99f;
126 final float more = 1.01f;
127 final float x = clipRect.getX();
128 final float y = clipRect.getY();
129 final float z = clipRect.getZ();
130 final float w = clipRect.getWidth();
131 final float h = clipRect.getHeight();
132 if( keySym == KeyEvent.VK_LEFT ) {
133 if( arg0.isShiftDown() ) {
134 final float d = w*more - w;
135 clipRect.move(-d, 0, 0);
136 } else if( arg0.isControlDown() ) {
137 final float d = w*more - w;
138 clipRect.setPosition(x-d, y, z);
139 clipRect.setDimension(w*more, h, clipRect.getLineWidth());
140 } else {
141 clipRect.setDimension(w*less, h, clipRect.getLineWidth());
142 }
143 } else if( keySym == KeyEvent.VK_RIGHT ) {
144 if( arg0.isShiftDown() ) {
145 final float d = w*more - w;
146 clipRect.move(d, 0, 0);
147 } else if( arg0.isControlDown() ) {
148 final float d = w - w*less;
149 clipRect.setPosition(x+d, y, z);
150 clipRect.setDimension(w*less, h, clipRect.getLineWidth());
151 } else {
152 clipRect.setDimension(w*more, h, clipRect.getLineWidth());
153 }
154 } else if( keySym == KeyEvent.VK_UP ) {
155 if( arg0.isShiftDown() ) {
156 final float d = h*more - h;
157 clipRect.move(0, d, 0);
158 } else if( arg0.isControlDown() ) {
159 final float d = h - h*less;
160 clipRect.setPosition(x, y+d, z);
161 clipRect.setDimension(w, h*less, clipRect.getLineWidth());
162 } else {
163 clipRect.setDimension(w, h*more, clipRect.getLineWidth());
164 }
165 } else if( keySym == KeyEvent.VK_DOWN ) {
166 if( arg0.isShiftDown() ) {
167 final float d = h*more - h;
168 clipRect.move(0, -d, 0);
169 } else if( arg0.isControlDown() ) {
170 final float d = h*more - h;
171 clipRect.setPosition(x, y-d, z);
172 clipRect.setDimension(w, h*more, clipRect.getLineWidth());
173 } else {
174 clipRect.setDimension(w, h*less, clipRect.getLineWidth());
175 }
176 } else if( keySym == KeyEvent.VK_F4 || keySym == KeyEvent.VK_ESCAPE || keySym == KeyEvent.VK_Q ) {
177 new InterruptSource.Thread( () -> { window.destroy(); } ).start();
178 }
179 }
180 });
181 window.addWindowListener(new WindowAdapter() {
182 @Override
183 public void windowDestroyed(final WindowEvent e) {
184 animator.stop();
185 }
186 });
187
188 animator.start();
189 }
190
191 private final GLReadBufferUtil screenshot;
192 private final int renderModes;
193 private final RegionRenderer rRenderer;
194 private final boolean debug;
195 private final boolean trace;
196
197 private Shape shape;
198
199 private KeyAction keyAction;
200
201 private volatile GLAutoDrawable autoDrawable = null;
202
203 private final float[] position = new float[] {0,0,0};
204
205 private static final float xTran = 0f;
206 private static final float yTran = 0f;
207 private static final float zTran = -1/5f;
208 private static final float zNear = 0.1f;
209 private static final float zFar = 7000.0f;
210
211 boolean ignoreInput = false;
212
213 protected final AffineTransform tempT1 = new AffineTransform();
214 protected final AffineTransform tempT2 = new AffineTransform();
215
216 public UIShapeClippingDemo00(final int renderModes, final boolean debug, final boolean trace) {
217 this.renderModes = renderModes;
219 this.rRenderer.setAAQuality(options.graphAAQuality);
220 this.rRenderer.setSampleCount(options.graphAASamples);
221 this.debug = debug;
222 this.trace = trace;
223 this.screenshot = new GLReadBufferUtil(false, false);
224
225 this.shape = new Rectangle(renderModes, szw*0.9f, szh*0.9f, 0);
226 this.shape.move(szw*0.1f*0.5f, szh*0.1f*0.5f, -Scene.DEFAULT_Z16_EPSILON); // below
227 }
228
229 public final RegionRenderer getRegionRenderer() { return rRenderer; }
230 public final float[] getPosition() { return position; }
231
232 @Override
233 public void init(final GLAutoDrawable drawable) {
234 autoDrawable = drawable;
235 GL2ES2 gl = drawable.getGL().getGL2ES2();
236 if(debug) {
237 gl = gl.getContext().setGL( GLPipelineFactory.create("com.jogamp.opengl.Debug", null, gl, null) ).getGL2ES2();
238 }
239 if(trace) {
240 gl = gl.getContext().setGL( GLPipelineFactory.create("com.jogamp.opengl.Trace", null, gl, new Object[] { System.err } ) ).getGL2ES2();
241 }
242 gl.glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
244
245 gl.setSwapInterval(1);
247 // gl.glEnable(GL.GL_POLYGON_OFFSET_FILL);
248 MSAATool.dump(drawable);
249
250 if( drawable instanceof Window ) {
251 final Window window = (Window)drawable;
252 window.addMouseListener(new MouseAdapter() {
253 @Override
254 public void mouseWheelMoved(final MouseEvent e) {
255 final Vec3f rot = new Vec3f(e.getRotation()).scale( FloatUtil.PI / 180.0f );
256 // swap axis for onscreen rotation matching natural feel
257 final float tmp = rot.x(); rot.setX( rot.y() ); rot.setY( tmp );
258 clipRect.setRotation( clipRect.getRotation().rotateByEuler( rot.scale( 2f ) ) );
259 }
260 });
261 }
262 }
263
264 @Override
265 public void reshape(final GLAutoDrawable drawable, final int xstart, final int ystart, final int width, final int height) {
266 // final GL2ES2 gl = drawable.getGL().getGL2ES2();
267 // gl.glViewport(xstart, ystart, width, height);
268
269 rRenderer.reshapePerspective(FloatUtil.QUARTER_PI, width, height, zNear, zFar);
270 // rRenderer.reshapeOrtho(width, height, zNear, zFar);
271
272 final PMVMatrix4f pmv = rRenderer.getMatrix();
273 pmv.loadMvIdentity();
274 pmv.translateMv(xTran, yTran, zTran);
275
276 if( drawable instanceof Window ) {
277 ((Window)drawable).setTitle(UIShapeClippingDemo00.class.getSimpleName()+": "+drawable.getSurfaceWidth()+" x "+drawable.getSurfaceHeight());
278 }
279 }
280
281 @Override
282 public void display(final GLAutoDrawable drawable) {
283 final GL2ES2 gl = drawable.getGL().getGL2ES2();
284
285 gl.glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
287
288 final RegionRenderer renderer = getRegionRenderer();
289 renderer.enable(gl, true);
290 {
291 final PMVMatrix4f pmv = renderer.getMatrix();
292 pmv.pushMv();
293 {
294 clipRect.applyMatToMv(pmv);
295 final Frustum clipFrustumMv = new Cube( clipRect.getBounds() ).transform( pmv.getMv() ).updateFrustumPlanes(new Frustum());
296 renderer.setClipFrustum( clipFrustumMv );
297 // System.err.println("Clipping "+renderer.getClipBBox());
298 if( null != shape && shape.isVisible() ) {
299 pmv.pushMv();
300 shape.applyMatToMv(pmv);
301 shape.draw(gl, renderer);
302 pmv.popMv();
303 }
304 // System.err.println("draw.0: "+shape);
305 renderer.setClipFrustum(null);
306 clipRect.draw(gl, renderer);
307 }
308 pmv.popMv();
309 }
310 renderer.enable(gl, false);
311 }
312
313 @Override
314 public void dispose(final GLAutoDrawable drawable) {
315 final GL2ES2 gl = drawable.getGL().getGL2ES2();
316 if( null != shape ) {
317 shape.destroy(gl, getRegionRenderer());
318 shape = null;
319 }
320 if( null != clipRect ) {
321 clipRect.destroy(gl, getRegionRenderer());
322 }
323 autoDrawable = null;
324 screenshot.dispose(gl);
325 rRenderer.destroy(gl);
326 }
327
328 /** Attach the input listener to the window */
329 public void attachInputListenerTo(final GLWindow window) {
330 if ( null == keyAction ) {
331 keyAction = new KeyAction();
332 window.addKeyListener(keyAction);
333 }
334 }
335
336 public void detachFrom(final GLWindow window) {
337 if ( null == keyAction ) {
338 return;
339 }
340 window.removeGLEventListener(this);
341 window.removeKeyListener(keyAction);
342 }
343
344 public void printScreen(final GLAutoDrawable drawable, final String dir, final String tech, final String objName, final boolean exportAlpha) throws GLException, IOException {
345 final String sw = String.format("-%03dx%03d-Z%04d-T%04d-%s", drawable.getSurfaceWidth(), drawable.getSurfaceHeight(), (int)Math.abs(zTran), 0, objName);
346
347 final String filename = dir + tech + sw +".png";
348 if(screenshot.readPixels(drawable.getGL(), false)) {
349 screenshot.write(new File(filename));
350 }
351 }
352
353 int screenshot_num = 0;
354
355 public void setIgnoreInput(final boolean v) {
356 ignoreInput = v;
357 }
358 public boolean getIgnoreInput() {
359 return ignoreInput;
360 }
361
362 public class KeyAction implements KeyListener {
363 @Override
364 public void keyPressed(final KeyEvent arg0) {
365 if(ignoreInput) {
366 return;
367 }
368
369 if(arg0.getKeyCode() == KeyEvent.VK_S){
370 if(null != autoDrawable) {
371 autoDrawable.invoke(false, new GLRunnable() {
372 @Override
373 public boolean run(final GLAutoDrawable drawable) {
374 try {
375 final String type = Region.getRenderModeString(renderModes);
376 printScreen(drawable, "./", "demo-"+type, "snap"+screenshot_num, false);
377 screenshot_num++;
378 } catch (final GLException e) {
379 e.printStackTrace();
380 } catch (final IOException e) {
381 e.printStackTrace();
382 }
383 return true;
384 }
385 });
386 }
387 }
388 }
389 @Override
390 public void keyReleased(final KeyEvent arg0) {}
391 }
392}
Abstract Outline shape representation define the method an OutlineShape(s) is bound and rendered.
Definition: Region.java:62
static String getRenderModeString(final int renderModes)
Returns a unique technical description string for renderModes as follows:
Definition: Region.java:251
static final int VBAA_RENDERING_BIT
Rendering-Mode bit for Region.
Definition: Region.java:115
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 setClipFrustum(final Frustum clipFrustum)
Set the optional clipping Frustum, which shall be pre-multiplied with the Mv-matrix or null to disabl...
final int setSampleCount(final int v)
Sets pass2 AA sample count clipped to the range [Region#MIN_AA_SAMPLE_COUNT..Region#MAX_AA_SAMPLE_COU...
static final GLCallback defaultBlendDisable
Default GL#GL_BLEND disable GLCallback, simply turning-off the GL#GL_BLEND state and turning-on depth...
final int setAAQuality(final int v)
Sets pass2 AA-quality rendering value clipped to the range [Region#MIN_AA_QUALITY....
static final GLCallback defaultBlendEnable
Default GL#GL_BLEND enable GLCallback, turning-off depth writing via GL#glDepthMask(boolean) if Rende...
final void init(final GL2ES2 gl)
Initialize shader and bindings for GPU based rendering bound to the given GL object's GLContext if no...
static RegionRenderer create()
Create a hardware accelerated RegionRenderer including its RenderState composition.
final void reshapePerspective(final float angle_rad, final int width, final int height, final float near, final float far)
Perspective projection, method also calls reshapeNotify(int, int, int, int).
final void destroy(final GL2ES2 gl)
Deletes all ShaderPrograms and nullifies its references including RenderState#destroy(GL2ES2).
GraphUI Scene.
Definition: Scene.java:102
static final float DEFAULT_Z16_EPSILON
Default Z precision on 16-bit depth buffer using DEFAULT_SCENE_DIST z-position and DEFAULT_ZNEAR.
Definition: Scene.java:112
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
final Shape move(final float dtx, final float dty, final float dtz)
Move about scaled distance.
Definition: Shape.java:557
void draw(final GL2ES2 gl, final RegionRenderer renderer)
Renders the shape.
Definition: Shape.java:798
final AABBox getBounds()
Returns the unscaled bounding AABBox for this shape, borrowing internal instance.
Definition: Shape.java:732
final boolean isVisible()
Returns true if this shape is set visible by the user, otherwise false.
Definition: Shape.java:353
final Quaternion getRotation()
Returns Quaternion for rotation.
Definition: Shape.java:595
final Shape setRotation(final Quaternion q)
Sets the rotation Quaternion.
Definition: Shape.java:604
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 rectangle GraphShape.
Definition: Rectangle.java:47
void setDimension(final float width, final float height, final float lineWidth)
Definition: Rectangle.java:124
void setPosition(final float minX, final float minY, final float zPos)
Definition: Rectangle.java:118
Basic Float math utility functions.
Definition: FloatUtil.java:83
static final float QUARTER_PI
The value PI/4, i.e.
static final float PI
The value PI, i.e.
final Quaternion rotateByEuler(final Vec3f angradXYZ)
Rotates this quaternion from the given Euler rotation array angradXYZ in radians.
3D Vector based upon three float components.
Definition: Vec3f.java:37
void setX(final float x)
Definition: Vec3f.java:158
Vec3f scale(final float s)
this = this * s, returns this.
Definition: Vec3f.java:218
void setY(final float y)
Definition: Vec3f.java:159
Simple 8-point Vec3f cube compound having z-far <= z-near @endiliteral.
Definition: Cube.java:48
Frustum updateFrustumPlanes(final Frustum frustum)
Calculate the frustum planes using this Cube.
Definition: Cube.java:194
Cube transform(final Matrix4f mat)
Affine 3f-vector transformation of all 8-points with given matrix, Matrix4f#mulVec3f(Vec3f).
Definition: Cube.java:163
Providing frustum planes derived by different inputs (P*MV, ..) used to classify objects.
Definition: Frustum.java:81
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 loadMvIdentity()
Load the modelview matrix with the values of the given Matrix4f.
final Matrix4f getMv()
Returns the modelview matrix (Mv).
final PMVMatrix4f popMv()
Pop the modelview matrix from its stack.
final PMVMatrix4f pushMv()
Push the modelview matrix to its stack, while preserving its values.
final boolean isShiftDown()
getModifiers() contains SHIFT_MASK.
final boolean isControlDown()
getModifiers() contains CTRL_MASK.
static final short VK_RIGHT
Constant for the cursor- or numerical-pad right arrow key.
Definition: KeyEvent.java:817
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
static final short VK_UP
Constant for the cursor- or numerical-pad up arrow key.
Definition: KeyEvent.java:814
static final short VK_LEFT
Constant for the cursor- or numerical-pad left arrow key.
Definition: KeyEvent.java:811
final short getKeySymbol()
Returns the virtual key symbol reflecting the current keyboard layout.
Definition: KeyEvent.java:176
static final short VK_DOWN
Constant for the cursor- or numerical pad down arrow key.
Definition: KeyEvent.java:820
static final short VK_S
See VK_A.
Definition: KeyEvent.java:631
static final short VK_Q
See VK_A.
Definition: KeyEvent.java:627
final short getKeyCode()
Returns the virtual key code using a fixed mapping to the US keyboard layout.
Definition: KeyEvent.java:195
Pointer event of type PointerType.
Definition: MouseEvent.java:74
final float[] getRotation()
Returns a 3-component float array filled with the values of the rotational axis in the following orde...
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 void addKeyListener(final KeyListener l)
Appends the given com.jogamp.newt.event.KeyListener to the end of the list.
Definition: GLWindow.java:902
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
final void removeKeyListener(final KeyListener l)
Definition: GLWindow.java:912
final void destroy()
Destroys all resources associated with this GLAutoDrawable, inclusive the GLContext.
Definition: GLWindow.java:605
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.
abstract GL setGL(GL gl)
Sets the GL pipeline object for this GLContext.
A generic exception for OpenGL errors used throughout the binding as a substitute for RuntimeExceptio...
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 void dump(final GLAutoDrawable drawable)
Definition: MSAATool.java:51
void keyReleased(final KeyEvent arg0)
A key has been released, excluding auto-repeat modifier keys.
void keyPressed(final KeyEvent arg0)
A key has been pressed, excluding auto-repeat modifier keys.
Basic UIShape Clipping demo, using manual invocation via GLEventListener w/o a Scene.
void reshape(final GLAutoDrawable drawable, final int xstart, final int ystart, final int width, final int height)
Called by the drawable during the first repaint after the component has been resized.
void init(final GLAutoDrawable drawable)
Called by the drawable immediately after the OpenGL context is initialized.
UIShapeClippingDemo00(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.
void attachInputListenerTo(final GLWindow window)
Attach the input listener to the window.
void printScreen(final GLAutoDrawable drawable, final String dir, final String tech, final String objName, final boolean exportAlpha)
void dispose(final GLAutoDrawable drawable)
Notifies the listener to perform the release of all OpenGL resources per GLContext,...
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.
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
Utility to read out the current FB to TextureData, optionally writing the data back to a texture obje...
void write(final File dest)
Write the TextureData filled by readPixels(GLAutoDrawable, boolean) to file.
boolean readPixels(final GL gl, final boolean mustFlipVertically)
Read the drawable's pixels to TextureData and Texture, if requested at construction.
Specifying NEWT's Window functionality:
Definition: Window.java:115
void addMouseListener(MouseListener l)
Appends the given MouseListener to the end of the list.
Listener for KeyEvents.
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.
GLEventListener removeGLEventListener(GLEventListener listener)
Removes the given listener from this drawable queue.
GL2ES2 getGL2ES2()
Casts this object to the GL2ES2 interface.
void setSwapInterval(int interval)
Set the swap interval of the current context and attached onscreen GLDrawable.
GLContext getContext()
Returns the GLContext associated which this GL object.
GLCapabilitiesImmutable getChosenGLCapabilities()
Fetches the GLCapabilitiesImmutable corresponding to the chosen OpenGL capabilities (pixel format / v...
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 glEnable(int cap)
Entry point to C language function: void {@native glEnable}(GLenum cap) Part of GL_ES_VERSION_2_0,...
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...
Definition: GL.java:43
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