Package javax.media.opengl

Examples of javax.media.opengl.GL2.glBegin()


        // use the current polygon's color
        gl.glColor3f(color.getRed(), color.getGreen(), color.getBlue());

        // if only 1 vertex, draw a point
        if (polygon.vertices().size() == 1)
            gl.glBegin(GL.GL_POINTS);

        // if only 2 vertices, draw a line
        else if (polygon.vertices().size() == 2)
            gl.glBegin(GL.GL_LINES);
View Full Code Here


        if (polygon.vertices().size() == 1)
            gl.glBegin(GL.GL_POINTS);

        // if only 2 vertices, draw a line
        else if (polygon.vertices().size() == 2)
            gl.glBegin(GL.GL_LINES);

        // otherwise draw a polygon
        else
            gl.glBegin(GL2.GL_POLYGON);
View Full Code Here

        else if (polygon.vertices().size() == 2)
            gl.glBegin(GL.GL_LINES);

        // otherwise draw a polygon
        else
            gl.glBegin(GL2.GL_POLYGON);

        for (final Point vertex : polygon.vertices())
            gl.glVertex2f(vertex.x, vertex.y);

        gl.glEnd();
View Full Code Here

        /* Now draw each indidual hole */
        for (ArrayList<Point> hole : polygon.holes())
        {
            // if only 1 vertex, draw a point
            if (hole.size() == 1)
                gl.glBegin(GL.GL_POINTS);

            // if only 2 vertices, draw a line
            else if (hole.size() == 2)
                gl.glBegin(GL.GL_LINES);

View Full Code Here

            if (hole.size() == 1)
                gl.glBegin(GL.GL_POINTS);

            // if only 2 vertices, draw a line
            else if (hole.size() == 2)
                gl.glBegin(GL.GL_LINES);

            // otherwise draw a polygon
            else
                gl.glBegin(GL2.GL_TRIANGLE_FAN); /* For best performance here */

 
View Full Code Here

            else if (hole.size() == 2)
                gl.glBegin(GL.GL_LINES);

            // otherwise draw a polygon
            else
                gl.glBegin(GL2.GL_TRIANGLE_FAN); /* For best performance here */

            for (final Point vertex : hole)
                gl.glVertex2f(vertex.x, vertex.y);

            gl.glEnd();
View Full Code Here

            //Defining radius of circle equal to 70 pixels
            double radius = circleHole.getRadius();

            //Starting loop for drawing triangles

            gl.glBegin(GL2.GL_POLYGON);
            for (double angle = 0; angle < 2 * Math.PI; angle += increment)
            {
                gl.glVertex2d(cx + Math.cos(angle) * radius, cy + Math.sin(angle) * radius);
                gl.glVertex2d(cx + Math.cos(angle + increment) * radius, cy + Math.sin(angle + increment) * radius);
            }
View Full Code Here

        // use the current polygon's color
        gl.glColor3f(color.getRed(), color.getGreen(), color.getBlue());

        // if only 1 vertex, draw a point
        if (polygon.vertices().size() == 1)
            gl.glBegin(GL.GL_POINTS);

        // if only 2 vertices, draw a line
        else if (polygon.vertices().size() == 2)
            gl.glBegin(GL.GL_LINES);
View Full Code Here

        if (polygon.vertices().size() == 1)
            gl.glBegin(GL.GL_POINTS);

        // if only 2 vertices, draw a line
        else if (polygon.vertices().size() == 2)
            gl.glBegin(GL.GL_LINES);

        // otherwise draw a polygon
        else
            gl.glBegin(GL2.GL_POLYGON);
View Full Code Here

        else if (polygon.vertices().size() == 2)
            gl.glBegin(GL.GL_LINES);

        // otherwise draw a polygon
        else
            gl.glBegin(GL2.GL_POLYGON);

        for (final Point vertex : polygon.vertices())
            gl.glVertex2f(vertex.x, vertex.y);

        gl.glEnd();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.