Package javax.media.opengl

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


    }
   
    private void renderAxes(GLAutoDrawable drawable) {
        final GL2 gl = drawable.getGL().getGL2();
       
        gl.glBegin(GL_LINES);
       
        // X-Axis
        gl.glColor3f( 1, 0, 0 );
        gl.glVertex3f( 0, 0, 0 );
        gl.glVertex3f( 50, 0, 0 );
View Full Code Here


        byte []color;
        color = VisualizerUtils.getVertexColor(VisualizerUtils.Color.YELLOW);
        int verts = 0;
        int colors = 0;
       
        gl.glBegin(GL_LINES);
       
            gl.glColor3ub(color[0], color[1], color[2]);
            gl.glVertex3d(this.workCoord.x, this.workCoord.y, this.workCoord.z);
            gl.glColor3ub(color[0], color[1], color[2]);
            gl.glVertex3d(this.workCoord.x, this.workCoord.y, this.workCoord.z+(1.0/this.scaleFactor));
View Full Code Here

        // Traditional OpenGL
        else {
            // TODO: By using a GL_LINE_STRIP I can easily use half the number of
            //       verticies. May lose some control over line colors though.
            //gl.glEnable(GL2.GL_LINE_SMOOTH);
            gl.glBegin(GL_LINES);
            gl.glLineWidth(1.0f);

            int verts = 0;
            int colors = 0;
            for(LineSegment ls : gcodeLineList)
View Full Code Here

        gl.glStencilFunc(GL.GL_NEVER, 0, 1);
        gl.glStencilOp(GL.GL_INVERT, GL.GL_INVERT, GL.GL_INVERT);

        // 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_TRIANGLE_FAN); /* For best performance here */

 
View Full Code Here

        else if (polygon.vertices().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 : 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

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.