public class GLUTessellatorSupport
extends java.lang.Object
GLUtessellator
to
tessellate complex polygons into triangles.
The standard pattern for using GLUTessellatorSupport to prepare a GLUtessellator is as follows:
GLUTessellatorSupport glts = new GLUTessellatorSupport();
GLUtessellatorCallback cb = ...; // Reference to an
implementation of GLUtessellatorCallback.
Vec4 normal = new Vec4(0, 0, 1); // The polygon's normal. This example
shows an appropriate normal for tessellating x-y coordinates.
glts.beginTessellation(cb, new Vec4(0,
0, 1));
try
{
GLUtessellator tess = glts.getGLUtessellator();
}
finally
{
glts.endTessellation();
}
Modifier and Type | Class and Description |
---|---|
static class |
GLUTessellatorSupport.CollectIndexListsCallback
Provides the callback class used to capture the shapes determined by the tessellator.
|
static class |
GLUTessellatorSupport.CollectPrimitivesCallback
Provides the callback class used to capture triangle and line primitive indices determined by the tessellator.
|
protected static class |
GLUTessellatorSupport.OGLDrawPrimitivesCallback |
static class |
GLUTessellatorSupport.RecursiveCallback
Recursively forwards boundary tessellation results from one GLU tessellator to another.
|
static class |
GLUTessellatorSupport.VertexData
Provides a container for associating a tessellator's vertex with its index and application-specified edge flag.
|
Modifier and Type | Field and Description |
---|---|
protected GLUtessellator |
tess |
Constructor and Description |
---|
GLUTessellatorSupport()
Creates a new GLUTessellatorSupport, but otherwise does nothing.
|
Modifier and Type | Method and Description |
---|---|
void |
beginTessellation(GLUtessellatorCallback callback,
Vec4 normal)
Prepares this GLUTessellatorSupport's internal GLU tessellator for use.
|
static java.lang.String |
convertGLUTessErrorToString(int errno)
Converts the specified GLU tessellator error number to a string description.
|
static GLUtessellatorCallback |
createOGLDrawPrimitivesCallback(GL2 gl)
Creates a new
GLUtessellatorCallback that draws tessellated polygons as OpenGL
primitives by calling glBegin, glEnd, and glVertex. |
void |
endTessellation()
Frees any GLU resources used by this GLUTessellatorSupport, and invalidates this instance's internal GLU
tessellator.
|
GLUtessellator |
getGLUtessellator()
Returns this GLUTessellatorSupport's internal
GLUtessellator instance. |
protected GLUtessellator tess
public GLUTessellatorSupport()
public void beginTessellation(GLUtessellatorCallback callback, Vec4 normal)
GLU.gluNewTess()
, and configures the
tessellator with the specified callback and normal with calls to GLU.gluTessCallback(javax.media.opengl.glu.GLUtessellator,
int, javax.media.opengl.glu.GLUtessellatorCallback)
and GLU.gluTessNormal(javax.media.opengl.glu.GLUtessellator,
double, double, double)
, respectively.callback
- the callback to configure the GLU tessellator with.normal
- the normal to configure the GLU tessellator with.java.lang.IllegalArgumentException
- if the callback or the normal is null.public static java.lang.String convertGLUTessErrorToString(int errno)
errno
- a GLU enumeration indicating the error.public static GLUtessellatorCallback createOGLDrawPrimitivesCallback(GL2 gl)
GLUtessellatorCallback
that draws tessellated polygons as OpenGL
primitives by calling glBegin, glEnd, and glVertex.gl
- the GL context to draw into.java.lang.IllegalArgumentException
- if the GL is null.public void endTessellation()
public GLUtessellator getGLUtessellator()
GLUtessellator
instance. This
returns a valid GLUtessellator instance if called between beginTessellation(javax.media.opengl.glu.GLUtessellatorCallback,
gov.nasa.worldwind.geom.Vec4)
and endTessellation()
. This returns null if called from outside a
beginTessellation/endTessellation block.