Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
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;
        }