public class GLUtessellatorCallbackAdapter extends java.lang.Object implements GLUtessellatorCallback
GLUtessellatorCallback
with empty callback methods. This class can be extended to provide user
defined callback methods.Constructor and Description |
---|
GLUtessellatorCallbackAdapter() |
Modifier and Type | Method and Description |
---|---|
void |
begin(int type)
The begin callback method is invoked like
glBegin to indicate the start of a
(triangle) primitive.
|
void |
beginData(int type,
java.lang.Object polygonData)
The same as the
begin callback method except that
it takes an additional reference argument. |
void |
combine(double[] coords,
java.lang.Object[] data,
float[] weight,
java.lang.Object[] outData)
The combine callback method is called to create a new vertex when
the tessellation detects an intersection, or wishes to merge features.
|
void |
combineData(double[] coords,
java.lang.Object[] data,
float[] weight,
java.lang.Object[] outData,
java.lang.Object polygonData)
The same as the
combine callback method except
that it takes an additional reference argument. |
void |
edgeFlag(boolean boundaryEdge)
The edgeFlag callback method is similar to
glEdgeFlag.
|
void |
edgeFlagData(boolean boundaryEdge,
java.lang.Object polygonData)
The same as the
edgeFlage callback method
except that it takes an additional reference argument. |
void |
end()
The end callback serves the same purpose as
glEnd.
|
void |
endData(java.lang.Object polygonData)
The same as the
end callback method except that it
takes an additional reference argument. |
void |
error(int errnum)
The error callback method is called when an error is encountered.
|
void |
errorData(int errnum,
java.lang.Object polygonData)
The same as the
error callback method except that
it takes an additional reference argument. |
void |
vertex(java.lang.Object vertexData)
|
void |
vertexData(java.lang.Object vertexData,
java.lang.Object polygonData)
The same as the
vertex callback method except
that it takes an additional reference argument. |
public void begin(int type)
GLUtessellatorCallback
begin
in interface GLUtessellatorCallback
type
- Specifics the type of begin/end pair being defined. The following
values are valid: GL_TRIANGLE_FAN, GL_TRIANGLE_STRIP,
GL_TRIANGLES or GL_LINE_LOOP.gluTessCallback
,
end
,
begin
public void edgeFlag(boolean boundaryEdge)
GLUtessellatorCallback
Since triangle fans and triangle strips do not support edge flags, the begin callback is not called with GL_TRIANGLE_FAN or GL_TRIANGLE_STRIP if a non-null edge flag callback is provided. (If the callback is initialized to null, there is no impact on performance). Instead, the fans and strips are converted to independent triangles.
edgeFlag
in interface GLUtessellatorCallback
boundaryEdge
- Specifics which edges lie on the polygon boundary.gluTessCallback
,
edgeFlagData
public void vertex(java.lang.Object vertexData)
GLUtessellatorCallback
begin
and end
callback methods. It is
similar to glVertex3f,
and it defines the vertices of the triangles created by the
tessellation process. The method takes a reference as its only
argument. This reference is identical to the opaque reference
provided by the user when the vertex was described (see gluTessVertex
).vertex
in interface GLUtessellatorCallback
vertexData
- Specifics a reference to the vertices of the triangles created
byt the tessellatin process.gluTessCallback
,
vertexData
public void end()
GLUtessellatorCallback
end
in interface GLUtessellatorCallback
gluTessCallback
,
begin
,
endData
public void error(int errnum)
GLUtessellatorCallback
gluErrorString
call.The GLU library will recover from the first four errors by inserting the missing call(s). GLU_TESS_COORD_TOO_LARGE indicates that some vertex coordinate exceeded the predefined constant GLU_TESS_MAX_COORD in absolute value, and that the value has been clamped. (Coordinate values must be small enough so that two can be multiplied together without overflow.) GLU_TESS_NEED_COMBINE_CALLBACK indicates that the tessellation detected an intersection between two edges in the input data, and the GLU_TESS_COMBINE or GLU_TESS_COMBINE_DATA callback was not provided. No output is generated. GLU_OUT_OF_MEMORY indicates that there is not enough memory so no output is generated.
error
in interface GLUtessellatorCallback
errnum
- Specifics the error number code.gluTessCallback
,
errorData
public void combine(double[] coords, java.lang.Object[] data, float[] weight, java.lang.Object[] outData)
GLUtessellatorCallback
The vertex is defined as a linear combination of up to four existing vertices, stored in data. The coefficients of the linear combination are given by weight; these weights always add up to 1. All vertex pointers are valid even when some of the weights are 0. coords gives the location of the new vertex.
The user must allocate another vertex, interpolate parameters using
data and weight, and return the new vertex pointer in
outData. This handle is supplied during rendering callbacks. The
user is responsible for freeing the memory some time after
gluTessEndPolygon
is
called.
For example, if the polygon lies in an arbitrary plane in 3-space, and a color is associated with each vertex, the GLU_TESS_COMBINE callback might look like this:
void myCombine(double[] coords, Object[] data, float[] weight, Object[] outData) { MyVertex newVertex = new MyVertex(); newVertex.x = coords[0]; newVertex.y = coords[1]; newVertex.z = coords[2]; newVertex.r = weight[0]*data[0].r + weight[1]*data[1].r + weight[2]*data[2].r + weight[3]*data[3].r; newVertex.g = weight[0]*data[0].g + weight[1]*data[1].g + weight[2]*data[2].g + weight[3]*data[3].g; newVertex.b = weight[0]*data[0].b + weight[1]*data[1].b + weight[2]*data[2].b + weight[3]*data[3].b; newVertex.a = weight[0]*data[0].a + weight[1]*data[1].a + weight[2]*data[2].a + weight[3]*data[3].a; outData = newVertex; }
combine
in interface GLUtessellatorCallback
coords
- Specifics the location of the new vertex.data
- Specifics the vertices used to create the new vertex.weight
- Specifics the weights used to create the new vertex.outData
- Reference user the put the coodinates of the new vertex.gluTessCallback
,
combineData
public void beginData(int type, java.lang.Object polygonData)
GLUtessellatorCallback
begin
callback method except that
it takes an additional reference argument. This reference is
identical to the opaque reference provided when gluTessBeginPolygon
was called.beginData
in interface GLUtessellatorCallback
type
- Specifics the type of begin/end pair being defined. The following
values are valid: GL_TRIANGLE_FAN, GL_TRIANGLE_STRIP,
GL_TRIANGLES or GL_LINE_LOOP.polygonData
- Specifics a reference to user-defined data.gluTessCallback
,
endData
,
begin
public void edgeFlagData(boolean boundaryEdge, java.lang.Object polygonData)
GLUtessellatorCallback
edgeFlage
callback method
except that it takes an additional reference argument. This
reference is identical to the opaque reference provided when
gluTessBeginPolygon
was called.edgeFlagData
in interface GLUtessellatorCallback
boundaryEdge
- Specifics which edges lie on the polygon boundary.polygonData
- Specifics a reference to user-defined data.gluTessCallback
,
edgeFlag
public void vertexData(java.lang.Object vertexData, java.lang.Object polygonData)
GLUtessellatorCallback
vertex
callback method except
that it takes an additional reference argument. This reference is
identical to the opaque reference provided when gluTessBeginPolygon
was called.vertexData
in interface GLUtessellatorCallback
vertexData
- Specifics a reference to the vertices of the triangles created
byt the tessellatin process.polygonData
- Specifics a reference to user-defined data.gluTessCallback
,
vertex
public void endData(java.lang.Object polygonData)
GLUtessellatorCallback
end
callback method except that it
takes an additional reference argument. This reference is
identical to the opaque reference provided when gluTessBeginPolygon
was called.endData
in interface GLUtessellatorCallback
polygonData
- Specifics a reference to user-defined data.gluTessCallback
,
beginData
,
end
public void errorData(int errnum, java.lang.Object polygonData)
GLUtessellatorCallback
error
callback method except that
it takes an additional reference argument. This reference is
identical to the opaque reference provided when gluTessBeginPolygon
was called.errorData
in interface GLUtessellatorCallback
errnum
- Specifics the error number code.polygonData
- Specifics a reference to user-defined data.gluTessCallback
,
error
public void combineData(double[] coords, java.lang.Object[] data, float[] weight, java.lang.Object[] outData, java.lang.Object polygonData)
GLUtessellatorCallback
combine
callback method except
that it takes an additional reference argument. This reference is
identical to the opaque reference provided when gluTessBeginPolygon
was called.combineData
in interface GLUtessellatorCallback
coords
- Specifics the location of the new vertex.data
- Specifics the vertices used to create the new vertex.weight
- Specifics the weights used to create the new vertex.outData
- Reference user the put the coodinates of the new vertex.polygonData
- Specifics a reference to user-defined data.gluTessCallback
,
combine