29package com.jogamp.opengl.demos.graph;
31import com.jogamp.opengl.GL;
32import com.jogamp.opengl.GL2ES2;
33import com.jogamp.opengl.GLAutoDrawable;
34import com.jogamp.opengl.GLProfile;
35import com.jogamp.graph.curve.OutlineShape;
36import com.jogamp.graph.curve.Region;
37import com.jogamp.graph.curve.opengl.GLRegion;
38import com.jogamp.graph.curve.opengl.RenderState;
39import com.jogamp.math.Vec4f;
40import com.jogamp.math.util.PMVMatrix4f;
41import com.jogamp.graph.curve.opengl.RegionRenderer;
53 public GPURegionGLListener00 (
final int renderModes,
final int aaQuality,
final int sampleCount,
final boolean debug,
final boolean trace) {
61 private void createTestOutline(
final GLProfile glp){
63 outlineShape.
addVertex(0.0f,-10.0f,
true);
64 outlineShape.
addVertex(15.0f,-10.0f,
true);
65 outlineShape.
addVertex(10.0f,5.0f,
false);
66 outlineShape.
addVertex(15.0f,10.0f,
true);
67 outlineShape.
addVertex(6.0f,15.0f,
false);
73 outlineShape.
addVertex(10.0f,-5.0f,
false);
79 final float offset = 30;
81 outlineShape.
addVertex(offset+0.0f,-10.0f,
true);
82 outlineShape.
addVertex(offset+17.0f,-10.0f,
true);
83 outlineShape.
addVertex(offset+11.0f,5.0f,
true);
84 outlineShape.
addVertex(offset+16.0f,10.0f,
true);
85 outlineShape.
addVertex(offset+7.0f,15.0f,
true);
86 outlineShape.
addVertex(offset+6.0f,8.0f,
true);
87 outlineShape.
addVertex(offset+0.0f,10.0f,
true);
90 outlineShape.
addVertex(offset+5.0f,0.0f,
true);
91 outlineShape.
addVertex(offset+5.0f,-5.0f,
true);
92 outlineShape.
addVertex(offset+10.0f,-5.0f,
true);
93 outlineShape.
addVertex(offset+10.0f,0.0f,
true);
102 super.init(drawable);
129 regionRenderer.
enable(gl,
true);
131 regionRenderer.
enable(gl,
false);
A Generic shape objects which is defined by a list of Outlines.
final void addVertex(final Vertex v)
Adds a vertex to the last open outline to the shape's tail.
final void closeLastOutline(final boolean closeTail)
Closes the last outline in the shape.
final void addEmptyOutline()
Add a new empty Outline to the end of this shape's outline list.
final void addOutlineShape(final OutlineShape shape, final AffineTransform t, final Vec4f rgbaColor)
Add the given OutlineShape to this region with the given optional AffineTransform.
static boolean hasColorChannel(final int renderModes)
Returns true if render mode has a color channel, i.e.
A GLRegion is the OGL binding of one or more OutlineShapes Defined by its vertices and generated tria...
final void draw(final GL2ES2 gl, final RegionRenderer renderer)
Renders the associated OGL objects specifying current width/hight of window for optional multi pass r...
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.
final void enable(final GL2ES2 gl, final boolean enable)
Enabling or disabling the RenderState's current shader program.
final void setColorStatic(final Vec4f rgbaColor)
final PMVMatrix4f getMatrix()
Borrow the current PMVMatrix4f.
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...
static RegionRenderer create()
Create a hardware accelerated RegionRenderer including its RenderState composition.
final void setWeight(final float v)
final void setHintBits(final int mask)
The RenderState is owned by RegionRenderer.
static final int BITHINT_GLOBAL_DEPTH_TEST_ENABLED
Bitfield hint, if set stating globally enabled GL#GL_DEPTH_TEST, otherwise disabled.
4D Vector based upon four float components.
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 rotateMv(final float ang_rad, final float x, final float y, final float z)
Rotate the modelview matrix by the given axis and angle in radians.
final PMVMatrix4f loadMvIdentity()
Load the modelview matrix with the values of the given Matrix4f.
Specifies the the OpenGL profile.
Demonstrate the rendering of multiple outlines into one region/OutlineShape These Outlines are not ne...
void init(final GLAutoDrawable drawable)
Called by the drawable immediately after the OpenGL context is initialized.
GPURegionGLListener00(final int renderModes, final int aaQuality, final int sampleCount, final boolean debug, final boolean trace)
void display(final GLAutoDrawable drawable)
Called by the drawable to initiate OpenGL rendering by the client.
final float getAngleRad()
final int getRenderModes()
void setMatrix(final float xtrans, final float ytrans, final float zTran, final float angle)
final RegionRenderer getRenderer()
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.
GLProfile getGLProfile()
Returns the GLProfile associated with this GL object.
void setSwapInterval(int interval)
Set the swap interval of the current context and attached onscreen GLDrawable.
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,...
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...
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...