Package javax.media.opengl

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


  public void drawSegment(Vec2 p1, Vec2 p2, Color3f color) {
    GL2 gl = panel.getGL().getGL2();
    gl.glPushMatrix();
    transformViewport(gl, zero);
    gl.glBegin(GL2.GL_LINES);
    gl.glColor3f(color.x, color.y, color.z);
    gl.glVertex3f(p1.x, p1.y, 0);
    gl.glVertex3f(p2.x, p2.y, 0);
    gl.glEnd();
    gl.glPopMatrix();
  }
View Full Code Here


    getWorldToScreenToOut(xf.p, temp);
    temp2.setZero();
    float k_axisScale = 0.4f;

    gl.glBegin(GL2.GL_LINES);
    gl.glColor3f(1, 0, 0);

    temp2.x = xf.p.x + k_axisScale * xf.q.c;
    temp2.y = xf.p.y + k_axisScale * xf.q.s;
    getWorldToScreenToOut(temp2, temp2);
    gl.glVertex2f(temp.x, temp.y);
View Full Code Here

    temp2.y = xf.p.y + k_axisScale * xf.q.s;
    getWorldToScreenToOut(temp2, temp2);
    gl.glVertex2f(temp.x, temp.y);
    gl.glVertex2f(temp2.x, temp2.y);

    gl.glColor3f(0, 1, 0);
    temp2.x = xf.p.x + -k_axisScale * xf.q.s;
    temp2.y = xf.p.y + k_axisScale * xf.q.c;
    getWorldToScreenToOut(temp2, temp2);
    gl.glVertex2f(temp.x, temp.y);
    gl.glVertex2f(temp2.x, temp2.y);
View Full Code Here

        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 );

        // Y-Axis
        gl.glColor3f( 0, 1, 0 );
View Full Code Here

        gl.glColor3f( 1, 0, 0 );
        gl.glVertex3f( 0, 0, 0 );
        gl.glVertex3f( 50, 0, 0 );

        // Y-Axis
        gl.glColor3f( 0, 1, 0 );
        gl.glVertex3f( 0, 0, 0 );
        gl.glVertex3f( 0, 50, 0 );
       
        // Z-Axis
        gl.glColor3f( 0, 0, 1 );
View Full Code Here

        gl.glColor3f( 0, 1, 0 );
        gl.glVertex3f( 0, 0, 0 );
        gl.glVertex3f( 0, 50, 0 );
       
        // Z-Axis
        gl.glColor3f( 0, 0, 1 );
        gl.glVertex3f( 0, 0, 0 );
        gl.glVertex3f( 0, 0, 50 );
       
        gl.glEnd();
       
View Full Code Here

        // push the current color
        gl.glPushAttrib(GL2.GL_CURRENT_BIT);

        // 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);
View Full Code Here

        // push the current color
        gl.glPushAttrib(GL2.GL_CURRENT_BIT);

        // 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);
View Full Code Here

            return;
        final GL2 gl = (GL2) drawable.getGL();


        //Color color = circle.getColor();
        gl.glColor3f(color.getRed(), color.getGreen(), color.getBlue());

        //Making circle in 50 small triangles
        double increment = 2 * Math.PI / 50;

        float cx = circle.getCenterPoint().x;
View Full Code Here

      gl.glBegin(GL.GL_POINTS);  
      for (int y = 0; y < this.canvas.getHeight(); y++) {
        for (int x = 0; x < this.canvas.getWidth(); x++) {
          if (this.shapes[selectedShapeIndex].isInside(x, y))
            // the inside is red
            gl.glColor3f(1.0f, 0.0f, 0.0f);
          else
            // the outside is gray
            gl.glColor3f(0.0f, 0.0f, 0.0f);
          gl.glVertex2f(x, y);
        }
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.