Class GLUTessellatorSupport


  • public class GLUTessellatorSupport
    extends java.lang.Object
    GLUTessellatorSupport is a utility class for configuring and using a 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();
    }

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected com.jogamp.opengl.glu.GLUtessellator tess  
    • Constructor Summary

      Constructors 
      Constructor Description
      GLUTessellatorSupport()
      Creates a new GLUTessellatorSupport, but otherwise does nothing.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void beginTessellation​(com.jogamp.opengl.glu.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 com.jogamp.opengl.glu.GLUtessellatorCallback createOGLDrawPrimitivesCallback​(com.jogamp.opengl.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.
      com.jogamp.opengl.glu.GLUtessellator getGLUtessellator()
      Returns this GLUTessellatorSupport's internal GLUtessellator instance.
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • tess

        protected com.jogamp.opengl.glu.GLUtessellator tess
    • Constructor Detail

      • GLUTessellatorSupport

        public GLUTessellatorSupport()
        Creates a new GLUTessellatorSupport, but otherwise does nothing.
    • Method Detail

      • beginTessellation

        public void beginTessellation​(com.jogamp.opengl.glu.GLUtessellatorCallback callback,
                                      Vec4 normal)
        Prepares this GLUTessellatorSupport's internal GLU tessellator for use. This initializes the internal GLUtessellator to a new instance by invoking GLU.gluNewTess(), and configures the tessellator with the specified callback and normal with calls to GLU.gluTessCallback(com.jogamp.opengl.glu.GLUtessellator, int, com.jogamp.opengl.glu.GLUtessellatorCallback) and GLU.gluTessNormal(com.jogamp.opengl.glu.GLUtessellator, double, double, double), respectively.
        Parameters:
        callback - the callback to configure the GLU tessellator with.
        normal - the normal to configure the GLU tessellator with.
        Throws:
        java.lang.IllegalArgumentException - if the callback or the normal is null.
      • endTessellation

        public void endTessellation()
        Frees any GLU resources used by this GLUTessellatorSupport, and invalidates this instance's internal GLU tessellator.
      • createOGLDrawPrimitivesCallback

        public static com.jogamp.opengl.glu.GLUtessellatorCallback createOGLDrawPrimitivesCallback​(com.jogamp.opengl.GL2 gl)
        Creates a new GLUtessellatorCallback that draws tessellated polygons as OpenGL primitives by calling glBegin, glEnd, and glVertex.
        Parameters:
        gl - the GL context to draw into.
        Returns:
        a new GLUtessellatorCallback for drawing tessellated polygons as OpenGL primtives.
        Throws:
        java.lang.IllegalArgumentException - if the GL is null.
      • convertGLUTessErrorToString

        public static java.lang.String convertGLUTessErrorToString​(int errno)
        Converts the specified GLU tessellator error number to a string description. This returns "unknown" if the error number is not recognized.
        Parameters:
        errno - a GLU enumeration indicating the error.
        Returns:
        a string description of the error number.