28package com.jogamp.opengl.demos.graph.ui.util;
30import com.jogamp.graph.curve.Region;
31import com.jogamp.graph.curve.opengl.GLRegion;
32import com.jogamp.graph.ui.Scene;
33import com.jogamp.graph.ui.Shape;
34import com.jogamp.graph.ui.shapes.Button;
35import com.jogamp.graph.ui.shapes.Label;
36import com.jogamp.math.geom.AABBox;
37import com.jogamp.newt.event.MouseEvent;
38import com.jogamp.opengl.GLAutoDrawable;
39import com.jogamp.opengl.GLProfile;
40import com.jogamp.opengl.util.texture.TextureSequence;
51 private final Scene scene;
52 private final int renderModes;
53 private final float sceneHeightScale;
54 private Button buttonLabel =
null;
64 this.renderModes = renderModes;
65 this.sceneHeightScale = sceneHeightScale;
74 if( !( shapeEvent.shape instanceof
Label ) ) {
79 final float l_sxy = sceneHeightScale * sceneDim.
getHeight() / textDim.getHeight();
80 buttonLabel = (
Button)
new Button(renderModes, label.
getFont(), label.
getText(), textDim.getWidth()+3, textDim.getHeight(), zEps)
81 .setPerp().
scale(l_sxy, l_sxy, 1).
move(0, 0, 10*zEps)
86 final Shape s = buttonLabel;
97 if(
null != buttonLabel ) {
98 final Shape s = buttonLabel;
void addShape(final Shape s)
Adds a Shape.
Shape removeShape(final Shape s)
Removes given shape, w/o Shape#destroy(GL2ES2, RegionRenderer).
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.
boolean invoke(final boolean wait, final GLRunnable glRunnable)
Enqueues a one-shot GLRunnable, which will be executed within the next GLAutoDrawable#display() call ...
Shape event info for propagated NEWTEvents containing reference of the intended shape as well as the ...
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 setInteractive(final boolean v)
Set whether this shape is interactive in general, i.e.
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 AABBox getBounds()
Returns the unscaled bounding AABBox for this shape, borrowing internal instance.
final Shape validate(final GL2ES2 gl)
Validates the shape's underlying GLRegion.
final Shape scale(final Vec3f s)
Multiply current scale factor by given scale.
final Shape setBorderColor(final float r, final float g, final float b, final float a)
Set border color.
final Shape setBorder(final float thickness)
Sets the thickness of the border, which is included in getBounds() and is outside of getPadding().
A GraphUI text label GraphShape.
Font getFont()
Returns the Font used to render the text.
CharSequence getText()
Returns the label text.
Axis Aligned Bounding Box.
Pointer event of type PointerType.
final Object getAttachment()
A higher-level abstraction than GLDrawable which supplies an event based mechanism (GLEventListener) ...
GL getGL()
Returns the GL pipeline object this GLAutoDrawable uses.
GL2ES2 getGL2ES2()
Casts this object to the GL2ES2 interface.