/**
  * Frees any GLU resources used by this GLUTessellatorSupport, and invalidates this instance's internal GLU
  * tessellator.
  */
 public void endTessellation()
 {
     GLU.gluTessCallback(this.tess, GLU.GLU_TESS_BEGIN, null);
     GLU.gluTessCallback(this.tess, GLU.GLU_TESS_VERTEX, null);
     GLU.gluTessCallback(this.tess, GLU.GLU_TESS_END, null);
     GLU.gluTessCallback(this.tess, GLU.GLU_TESS_COMBINE, null);
     this.tess = null;
 }
 public void attach(GLUtessellator tessellator)
 {
     GLU.gluTessCallback(tessellator, GLU.GLU_TESS_BEGIN, this);
     GLU.gluTessCallback(tessellator, GLU.GLU_TESS_END, this);
     GLU.gluTessCallback(tessellator, GLU.GLU_TESS_VERTEX, this);
     GLU.gluTessCallback(tessellator, GLU.GLU_TESS_EDGE_FLAG, this);
     GLU.gluTessCallback(tessellator, GLU.GLU_TESS_ERROR, this);
 }
            /**
             * Creates a new RecursiveCallback with the GLU tessellator that receives boundary tessellation results.
             *
             * @param 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.ArgumentException if the tessellator is null.
             */
            public RecursiveCallback(GLUtessellator tessellator)
            {
                if (tessellator == null)
                {
                    String msg = Logging.getMessage("nullValue.TessellatorIsNull");
                    Logging.logger().severe(msg);
                    throw new ArgumentException(msg);
                }

                this.tess = tessellator;
            }
Example #4
0
        public PolygonTessellator()
        {
            this.tess = GLU.gluNewTess();
            TessCallbackAdapter callback = new TessCallbackAdapter();

            GLU.gluTessCallback(this.tess, GLU.GLU_TESS_BEGIN_DATA, callback);
            GLU.gluTessCallback(this.tess, GLU.GLU_TESS_EDGE_FLAG_DATA, callback);
            GLU.gluTessCallback(this.tess, GLU.GLU_TESS_VERTEX_DATA, callback);
            GLU.gluTessCallback(this.tess, GLU.GLU_TESS_END_DATA, callback);
            GLU.gluTessCallback(this.tess, GLU.GLU_TESS_COMBINE_DATA, callback);

            this.interiorIndices = IntBuffer.allocate(10);
            this.boundaryIndices = IntBuffer.allocate(10);
        }
        /**
         * Prepares this GLUTessellatorSupport's internal GLU tessellator for use. This initializes the internal
         * GLUtessellator to a new instance by invoking {@link javax.media.opengl.glu.GLU#gluNewTess()}, and configures the
         * tessellator with the specified callback and normal with calls to {@link javax.media.opengl.glu.GLU#gluTessCallback(javax.media.opengl.glu.GLUtessellator,
         * int, javax.media.opengl.glu.GLUtessellatorCallback)} and {@link javax.media.opengl.glu.GLU#gluTessNormal(javax.media.opengl.glu.GLUtessellator,
         * double, double, double)}, respectively.
         *
         * @param callback the callback to configure the GLU tessellator with.
         * @param normal   the normal to configure the GLU tessellator with.
         *
         * @throws ArgumentException if the callback or the normal is null.
         */
        public void beginTessellation(GLUtessellatorCallback callback, Vec4 normal)
        {
            if (callback == null)
            {
                String message = Logging.getMessage("nullValue.CallbackIsNull");
                Logging.logger().severe(message);
                throw new ArgumentException(message);
            }

            if (normal == null)
            {
                String message = Logging.getMessage("nullValue.NormalIsNull");
                Logging.logger().severe(message);
                throw new ArgumentException(message);
            }

            this.tess = GLU.gluNewTess();
            GLU.gluTessNormal(this.tess, normal.x, normal.y, normal.z);
            GLU.gluTessCallback(this.tess, GLU.GLU_TESS_BEGIN, callback);
            GLU.gluTessCallback(this.tess, GLU.GLU_TESS_VERTEX, callback);
            GLU.gluTessCallback(this.tess, GLU.GLU_TESS_END, callback);
            GLU.gluTessCallback(this.tess, GLU.GLU_TESS_COMBINE, callback);
        }
Example #6
0
        /**
         * Creates a new combine context with the specified globe, resolution, and the default region of interest.
         *
         * @param globe      the globe to associate with this context. Shape geometry defined relative to a globe must use
         *                   this globe to compute that geometry.
         * @param resolution the minimum resolution, in radians. Used to filter shape detail and compute geometry for
         *                   resolution independent shapes.
         *
         * @throws java.lang.ArgumentException if the globe is null.
         */
        public CombineContext(Globe globe, double resolution)
        {
            if (globe == null)
            {
                String msg = Logging.getMessage("nullValue.GlobeIsNull");
                Logging.logger().severe(msg);
                throw new ArgumentException(msg);
            }

            GLUtessellatorCallback cb   = new TessCallbackAdapter(this); // forward GLU tessellator callbacks to tess* methods
            GLUtessellator         tess = GLU.gluNewTess();

            GLU.gluTessCallback(tess, GLU.GLU_TESS_BEGIN, cb);
            GLU.gluTessCallback(tess, GLU.GLU_TESS_VERTEX, cb);
            GLU.gluTessCallback(tess, GLU.GLU_TESS_END, cb);
            GLU.gluTessCallback(tess, GLU.GLU_TESS_COMBINE, cb);
            GLU.gluTessCallback(tess, GLU.GLU_TESS_ERROR, cb);
            GLU.gluTessProperty(tess, GLU.GLU_TESS_BOUNDARY_ONLY, GL.GL_TRUE);
            GLU.gluTessNormal(tess, 0, 0, 1);

            this.globe      = globe;
            this.resolution = resolution;
            this.tess       = tess;
        }
Example #7
0
 public void dispose()
 {
     GLU.gluDeleteTess(this.tess);
     this.tess = null;
 }