org.lwjgl.util.glu

## Interface GLUtessellatorCallback

• All Known Implementing Classes:

`public interface GLUtessellatorCallback`
GLUtessellatorCallback interface provides methods that the user will override to define the callbacks for a tessellation object.
Author:
Eric Veach, July 1994, Java Port: Pepijn Van Eeckhoudt, July 2003, Java Port: Nathan Parker Burg, August 2003
• ### Method Summary

Methods
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)`
The vertex callback method is invoked between the `begin` and `end` callback methods.
`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.
• ### Method Detail

• #### begin

`void begin(int type)`
The begin callback method is invoked like `glBegin` to indicate the start of a (triangle) primitive. The method takes a single argument of type int. If the GLU_TESS_BOUNDARY_ONLY property is set to GL_FALSE, then the argument is set to either GL_TRIANGLE_FAN, GL_TRIANGLE_STRIP, or GL_TRIANGLES. If the GLU_TESS_BOUNDARY_ONLY property is set to GL_TRUE, then the argument will be set to GL_LINE_LOOP.
Parameters:
`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`
• #### beginData

```void beginData(int type,
java.lang.Object polygonData)```
The same as the `begin` callback method except that it takes an additional reference argument. This reference is identical to the opaque reference provided when `gluTessBeginPolygon` was called.
Parameters:
`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`
• #### edgeFlag

`void edgeFlag(boolean boundaryEdge)`
The edgeFlag callback method is similar to `glEdgeFlag`. The method takes a single boolean boundaryEdge that indicates which edges lie on the polygon boundary. If the boundaryEdge is GL_TRUE, then each vertex that follows begins an edge that lies on the polygon boundary, that is, an edge that separates an interior region from an exterior one. If the boundaryEdge is GL_FALSE, then each vertex that follows begins an edge that lies in the polygon interior. The edge flag callback (if defined) is invoked before the first vertex callback.

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.

Parameters:
`boundaryEdge` - Specifics which edges lie on the polygon boundary.
`gluTessCallback`, `edgeFlagData`
• #### edgeFlagData

```void edgeFlagData(boolean boundaryEdge,
java.lang.Object polygonData)```
The same as the `edgeFlage` callback method except that it takes an additional reference argument. This reference is identical to the opaque reference provided when `gluTessBeginPolygon` was called.
Parameters:
`boundaryEdge` - Specifics which edges lie on the polygon boundary.
`polygonData` - Specifics a reference to user-defined data.
`gluTessCallback`, `edgeFlag`
• #### vertex

`void vertex(java.lang.Object vertexData)`
The vertex callback method is invoked between the `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`).
Parameters:
`vertexData` - Specifics a reference to the vertices of the triangles created byt the tessellatin process.
`gluTessCallback`, `vertexData`
• #### 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. This reference is identical to the opaque reference provided when `gluTessBeginPolygon` was called.
Parameters:
`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`
• #### end

`void end()`
The end callback serves the same purpose as `glEnd`. It indicates the end of a primitive and it takes no arguments.
`gluTessCallback`, `begin`, `endData`
• #### endData

`void endData(java.lang.Object polygonData)`
The same as the `end` callback method except that it takes an additional reference argument. This reference is identical to the opaque reference provided when `gluTessBeginPolygon` was called.
Parameters:
`polygonData` - Specifics a reference to user-defined data.
`gluTessCallback`, `beginData`, `end`
• #### combine

```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. The method takes four arguments: an array of three elements each of type double, an array of four references, an array of four elements each of type float, and a reference to a reference.

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;
newVertex.y = coords;
newVertex.z = coords;
newVertex.r = weight*data.r +
weight*data.r +
weight*data.r +
weight*data.r;
newVertex.g = weight*data.g +
weight*data.g +
weight*data.g +
weight*data.g;
newVertex.b = weight*data.b +
weight*data.b +
weight*data.b +
weight*data.b;
newVertex.a = weight*data.a +
weight*data.a +
weight*data.a +
weight*data.a;
outData = newVertex;
}```
Parameters:
`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`
• #### combineData

```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. This reference is identical to the opaque reference provided when `gluTessBeginPolygon` was called.
Parameters:
`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`
• #### error

`void error(int errnum)`
The error callback method is called when an error is encountered. The one argument is of type int; it indicates the specific error that occurred and will be set to one of GLU_TESS_MISSING_BEGIN_POLYGON, GLU_TESS_MISSING_END_POLYGON, GLU_TESS_MISSING_BEGIN_CONTOUR, GLU_TESS_MISSING_END_CONTOUR, GLU_TESS_COORD_TOO_LARGE, GLU_TESS_NEED_COMBINE_CALLBACK or GLU_OUT_OF_MEMORY. Character strings describing these errors can be retrieved with the `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.

Parameters:
`errnum` - Specifics the error number code.
`gluTessCallback`, `errorData`
```void errorData(int errnum,
The same as the `error` callback method except that it takes an additional reference argument. This reference is identical to the opaque reference provided when `gluTessBeginPolygon` was called.
`errnum` - Specifics the error number code.
`polygonData` - Specifics a reference to user-defined data.
`gluTessCallback`, `error`
{"ft_lang_label":"__label__en","ft_lang_prob":0.64938915,"math_prob":0.6921383,"size":8497,"snap":"2020-10-2020-16","text_gpt3_token_len":2000,"char_repetition_ratio":0.16460614,"word_repetition_ratio":0.306828,"special_character_ratio":0.20336589,"punctuation_ratio":0.14276095,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9769449,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-04-06T21:49:33Z\",\"WARC-Record-ID\":\"<urn:uuid:7f5c2d40-0183-4562-8dbd-9fd69af34802>\",\"Content-Length\":\"28865\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:75b26bbe-b043-4305-9f89-dc8002ea6a80>\",\"WARC-Concurrent-To\":\"<urn:uuid:38e8334b-da5b-4a6f-a498-e2095b2f7b56>\",\"WARC-IP-Address\":\"52.216.92.18\",\"WARC-Target-URI\":\"http://legacy.lwjgl.org/javadoc/org/lwjgl/util/glu/GLUtessellatorCallback.html\",\"WARC-Payload-Digest\":\"sha1:CCHVMUCD3JAOTCW5U4DXKXYSNOUBPQML\",\"WARC-Block-Digest\":\"sha1:FWSFXBVJYH3WEAGDOYSKTEMLOC2KI6CI\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-16/CC-MAIN-2020-16_segments_1585371660550.75_warc_CC-MAIN-20200406200320-20200406230820-00086.warc.gz\"}"}