Package gov.nasa.worldwind.util
Class GLUTessellatorSupport.RecursiveCallback
- java.lang.Object
-
- com.jogamp.opengl.glu.GLUtessellatorCallbackAdapter
-
- gov.nasa.worldwind.util.GLUTessellatorSupport.RecursiveCallback
-
- All Implemented Interfaces:
com.jogamp.opengl.glu.GLUtessellatorCallback
- Enclosing class:
- GLUTessellatorSupport
public static class GLUTessellatorSupport.RecursiveCallback extends com.jogamp.opengl.glu.GLUtessellatorCallbackAdapter
Recursively forwards boundary tessellation results from one GLU tessellator to another. The GLU tessellator this callback forwards to may be configured in any way the caller chooses.RecursiveCallback must be used as the GLUtessellatorCallback for the begin, end, vertex, and combine callbacks for a GLU tessellator configured to generate line loops. A GLU tessellator can be configured generate line loops by calling gluTessProperty(GLU_TESS_BOUNDARY_ONLY, GL_TRUE). Additionally, the caller specified vertex data passed to gluTessVertex must be a double array containing three elements - the x, y and z coordinates associated with the vertex.
-
-
Field Summary
Fields Modifier and Type Field Description protected com.jogamp.opengl.glu.GLUtessellator
tess
The GLU tessellator that receives the tessellation results sent to this callback.
-
Constructor Summary
Constructors Constructor Description RecursiveCallback(com.jogamp.opengl.glu.GLUtessellator tessellator)
Creates a new RecursiveCallback with the GLU tessellator that receives boundary tessellation results.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
begin(int type)
Called by the GLU tessellator to indicate the beginning of a new line loop.void
combine(double[] coords, java.lang.Object[] vertexData, float[] weight, java.lang.Object[] outData)
Called by the GLU tessellator to indicate that up to four vertices must be merged into a new vertex.void
end()
Called by the GLU tessellator to indicate the end of the current line loop.void
error(int errno)
Called by the GLU tessellator when the tessellation algorithm encounters an error.void
vertex(java.lang.Object vertexData)
Called by the GLU tessellator to indicate the next vertex of the current contour.
-
-
-
Constructor Detail
-
RecursiveCallback
public RecursiveCallback(com.jogamp.opengl.glu.GLUtessellator tessellator)
Creates a new RecursiveCallback with the GLU tessellator that receives boundary tessellation results.- Parameters:
tessellator
- the GLU tessellator that receives the tessellation results sent to this callback. This tessellator may be configured in any way the caller chooses, but should be prepared to receive contour input from this callback.- Throws:
java.lang.IllegalArgumentException
- if the tessellator is null.
-
-
Method Detail
-
begin
public void begin(int type)
Called by the GLU tessellator to indicate the beginning of a new line loop. This recursively begins a new contour with the GLU tessellator specified during construction by calling gluTessBeginContour(tessellator).- Specified by:
begin
in interfacecom.jogamp.opengl.glu.GLUtessellatorCallback
- Overrides:
begin
in classcom.jogamp.opengl.glu.GLUtessellatorCallbackAdapter
- Parameters:
type
- the GL primitive type. Must be GL_LINE_LOOP.
-
vertex
public void vertex(java.lang.Object vertexData)
Called by the GLU tessellator to indicate the next vertex of the current contour. The vertex data must be a double array containing three elements - the x, y and z coordinates associated with the vertex. This recursively indicates the next contour vertex with the GLU tessellator specified during construction by calling gluTessVertex(tessellator, (double[]) vertexData, 0, vertexData).- Specified by:
vertex
in interfacecom.jogamp.opengl.glu.GLUtessellatorCallback
- Overrides:
vertex
in classcom.jogamp.opengl.glu.GLUtessellatorCallbackAdapter
- Parameters:
vertexData
- the caller specified vertex data. Must be a double array containing three elements - the x, y and z coordinates associated with the vertex.
-
end
public void end()
Called by the GLU tessellator to indicate the end of the current line loop. This recursively ends the current contour with the GLU tessellator specified during construction by calling gluTessEndContour(tessellator).- Specified by:
end
in interfacecom.jogamp.opengl.glu.GLUtessellatorCallback
- Overrides:
end
in classcom.jogamp.opengl.glu.GLUtessellatorCallbackAdapter
-
combine
public void combine(double[] coords, java.lang.Object[] vertexData, float[] weight, java.lang.Object[] outData)
Called by the GLU tessellator to indicate that up to four vertices must be merged into a new vertex. The new vertex is a linear combination of the original vertices. This assigns the first element of outData to coords, the coordinates of the new vertex.- Specified by:
combine
in interfacecom.jogamp.opengl.glu.GLUtessellatorCallback
- Overrides:
combine
in classcom.jogamp.opengl.glu.GLUtessellatorCallbackAdapter
- Parameters:
coords
- A three element array containing the x, y and z coordinates of the new vertex.vertexData
- The caller specified vertex data of the original vertices.weight
- The coefficients of the linear combination. These weights sum to 1.outData
- A one element array that must contain the caller specified data associated with the new vertex after this method returns.
-
error
public void error(int errno)
Called by the GLU tessellator when the tessellation algorithm encounters an error. This logs a severe message describing the error.- Specified by:
error
in interfacecom.jogamp.opengl.glu.GLUtessellatorCallback
- Overrides:
error
in classcom.jogamp.opengl.glu.GLUtessellatorCallbackAdapter
- Parameters:
errno
- a GLU enumeration indicating the error.
-
-