29package com.jogamp.opengl.test.junit.graph;
31import java.util.ArrayList;
34import com.jogamp.opengl.GL;
35import com.jogamp.opengl.GL2ES2;
36import com.jogamp.opengl.GLAutoDrawable;
37import com.jogamp.opengl.GLProfile;
39import com.jogamp.graph.curve.OutlineShape;
40import com.jogamp.graph.curve.Region;
41import com.jogamp.graph.curve.opengl.GLRegion;
42import com.jogamp.graph.curve.opengl.RenderState;
43import com.jogamp.math.util.PMVMatrix4f;
44import com.jogamp.graph.curve.opengl.RegionRenderer;
51 List<OutlineShape> outlineShapes =
new ArrayList<OutlineShape>();
53 public GPURegionGLListener10 (
final int renderModes,
final int aaQuality,
final int sampleCount,
final boolean debug,
final boolean trace) {
61 private void createTestOutline(
final GLProfile glp){
63 outlineShapes.add(shape);
82 outlineShapes.add(shape);
83 final float offset = 30;
84 shape.
addVertex(offset+0.0f,-10.0f,
true);
85 shape.
addVertex(offset+17.0f,-10.0f,
true);
87 shape.
addVertex(offset+16.0f,10.0f,
true);
95 shape.
addVertex(offset+10.0f,-5.0f,
true);
106 super.init(drawable);
134 regionRenderer.
enable(gl,
true);
136 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.
Abstract Outline shape representation define the method an OutlineShape(s) is bound and rendered.
final void addOutlineShapes(final List< OutlineShape > shapes, final AffineTransform transform, final Vec4f rgbaColor)
Add the given list of OutlineShapes to this region with the given optional AffineTransform.
static final int[] countOutlineShape(final OutlineShape shape, final int[] vertIndexCount)
Count required number of vertices and indices adding to given int[2] vertIndexCount array.
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.
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 OutlineShapes into one region.
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.
GPURegionGLListener10(final int renderModes, final int aaQuality, final int sampleCount, final boolean debug, final boolean trace)
final float getAngleRad()
void setMatrix(final float xtrans, final float ytrans, final float zTran, final float angle)
final int getRenderModes()
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...