@Override
  public void draw(GL2 gl, Object obj) {
    if (!(Force.class.isAssignableFrom(obj.getClass()))) return;

    Force force = (Force) obj;

    gl.glLineWidth(2.5f);
    gl.glColor3f(1.0f, 0f, 0f);
    gl.glBegin(GL.GL_LINES);
    gl.glVertex3d(
        force.getPointApplication().getX(),
        force.getPointApplication().getY(),
        force.getPointApplication().getZ());

    Vector3D finalPoint = force.getPointApplication().add(force.getForce());
    gl.glVertex3d(finalPoint.getX(), finalPoint.getY(), finalPoint.getZ());
    gl.glEnd();

    gl.glTranslated(
        force.getPointApplication().getX(),
        force.getPointApplication().getY(),
        force.getPointApplication().getZ());
    gl.glColor3f(1.0f, 0.0f, 0.0f);
    GLU glu = new GLU();
    GLUquadric q = glu.gluNewQuadric();
    glu.gluQuadricDrawStyle(q, GLU.GLU_FILL);
    glu.gluSphere(q, Force.originRadius, 5, 5);
    glu.gluDeleteQuadric(q);
  }
  /** ***************************************************** */
  public void draw(GL2 gl, GLU glu, Camera cam) {
    if (transform != null) transform.execute(gl);
    gl.glTranslatef(x, y, z);

    applyMaterial(gl);
    gl.glLineWidth(wfwidth);

    // Draw
    GLUquadric qobj = glu.gluNewQuadric();

    if (facestatus) {
      if (wfstatus) {
        gl.glEnable(GL2.GL_POLYGON_OFFSET_FILL);
        gl.glPolygonOffset(1.0f, 1.0f);
      }

      gl.glPolygonMode(GL2.GL_FRONT_AND_BACK, GL2.GL_FILL);
      gl.glNormal3f(norm.x, norm.y, norm.z);
      gl.glColor4f(color.r, color.g, color.b, color.a);
      glu.gluDisk(qobj, radiusInner, radiusOuter, slices, loops);

      if (wfstatus) gl.glDisable(GL2.GL_POLYGON_OFFSET_FILL);
    }
    if (wfstatus) {
      gl.glPolygonMode(GL2.GL_FRONT_AND_BACK, GL2.GL_LINE);
      gl.glNormal3f(norm.x, norm.y, norm.z);
      gl.glColor4f(wfcolor.r, wfcolor.g, wfcolor.b, wfcolor.a);
      glu.gluDisk(qobj, radiusInner, radiusOuter, slices, loops);
    }
  }
Example #3
0
 @Override
 public synchronized void drawNodes(GL2 gl, Projection projection) {
   // vykreslení pomocných čar
   GLUtils.glSetColor(gl, supportColor);
   gl.glLineWidth(1);
   GLUtils.drawSimpleLine(gl, points);
   drawSimpleNodes(gl);
 }
Example #4
0
  /**
   * Render the arrow as a line and a _head.
   *
   * @param gl OpenGL Context
   */
  public void render(GL2 gl) {
    // save Light Attributes and remove lighting to get "full" RGB colors
    // gl.glPushAttrib( GL2.GL_LIGHTING_BIT );
    gl.glPushAttrib(GL2.GL_ENABLE_BIT);
    gl.glDisable(GL2.GL_LIGHTING);

    if (_fg_verb) {
      System.out.println(
          "Arrow pos="
              + _pos.toString()
              + "  angZ1="
              + _angZ1
              + "  angY2="
              + _angY2
              + "  length="
              + _length);
      _fg_verb = false;
    }

    // save transformation matrix, then translate and scale.
    gl.glPushMatrix();
    gl.glTranslatef(_pos.x, _pos.y, _pos.z);
    gl.glRotatef(Matrix.rad2Deg(_angZ1), 0, 0, 1); // rotation around 0z
    gl.glRotatef(Matrix.rad2Deg(_angY2), 0, 1, 0); // rotation around 0y

    // draw line
    gl.glColor4f(_color_fg.x, _color_fg.y, _color_fg.z, _color_fg.w);
    gl.glLineWidth(1.0f);
    gl.glBegin(GL.GL_LINES);
    {
      gl.glVertex3f(0, 0, 0);
      gl.glVertex3f(_length, 0, 0);
    }
    gl.glEnd();

    // draw head
    gl.glPolygonMode(GL.GL_FRONT_AND_BACK, GL2GL3.GL_FILL);
    gl.glTranslatef(_length, 0, 0);
    gl.glBegin(GL.GL_TRIANGLES);
    {
      for (float[] face : _head_faces) {
        gl.glVertex3f(face[0], face[1], face[2]);
        gl.glVertex3f(face[3], face[4], face[5]);
        gl.glVertex3f(face[6], face[7], face[8]);
      }
    }
    gl.glEnd();

    // restore transformation matrix
    gl.glPopMatrix();
    // restore attributes
    gl.glPopAttrib();
  }
  protected void drawToolTipOutline(
      DrawContext dc, double width, double height, ToolTipAttributes attributes) {
    GL2 gl = dc.getGL();

    this.applyColor(dc, attributes.getOutlineColor(), attributes.getOutlineOpacity());
    gl.glLineWidth((float) getOutlineWidth());

    // Draw a line loop around the background rectangle. Inset the lines slightly to compensate for
    // OpenGL's line
    // rasterization algorithm. We want the line to straddle the rectangle pixels.
    double inset = 0.5;
    gl.glBegin(GL2.GL_LINE_LOOP);
    gl.glVertex2d(inset, inset);
    gl.glVertex2d(width - inset, inset);
    gl.glVertex2d(width - inset, height - inset);
    gl.glVertex2d(inset, height - inset);
    gl.glEnd();
  }
  @Override
  public void draw(IBNAView view, ICoordinateMapper cm, GL2 gl, Rectangle clip, IResources r) {
    if (Boolean.TRUE.equals(t.get(IHasSelected.SELECTED_KEY))) {
      List<Point> localPoints = BNAUtils.worldToLocal(cm, t.getPoints());

      gl.glLineWidth(1f);

      gl.glColor3f(1f, 1f, 1f);
      gl.glBegin(GL2.GL_LINE_STRIP);
      for (Point p : localPoints) {
        gl.glVertex2f(p.x + 0.5f, p.y + 0.5f);
      }
      gl.glEnd();

      gl.glColor3f(0f, 0f, 0f);
      gl.glLineStipple(1, (short) (0x0f0f0f0f >> t.getRotatingOffset() % 8));
      gl.glBegin(GL2.GL_LINE_STRIP);
      for (Point p : localPoints) {
        gl.glVertex2f(p.x + 0.5f, p.y + 0.5f);
      }
      gl.glEnd();
    }
  }
Example #7
0
  public void display(GLAutoDrawable drawable) {
    update();

    GL2 gl = drawable.getGL().getGL2();
    // Clear Color Buffer, Depth Buffer
    gl.glClear(GL2.GL_COLOR_BUFFER_BIT | GL2.GL_DEPTH_BUFFER_BIT);

    Matrix TmpMatrix = new Matrix(); // Temporary MATRIX Structure ( NEW )
    Vector TmpVector = new Vector(), TmpNormal = new Vector(); // Temporary
    // VECTOR
    // Structures
    // ( NEW )

    gl.glLoadIdentity(); // Reset The Matrix

    if (outlineSmooth) { // Check To See If We Want Anti-Aliased Lines ( NEW
      // )
      gl.glHint(GL2.GL_LINE_SMOOTH_HINT, GL2.GL_NICEST); // Use The Good
      // Calculations
      // ( NEW )
      gl.glEnable(GL2.GL_LINE_SMOOTH); // Enable Anti-Aliasing ( NEW )
    } else
      // We Don't Want Smooth Lines ( NEW )
      gl.glDisable(GL2.GL_LINE_SMOOTH); // Disable Anti-Aliasing ( NEW )

    gl.glTranslatef(0.0f, 0.0f, -2.0f); // Move 2 Units Away From The Screen
    // ( NEW )
    gl.glRotatef(modelAngle, 0.0f, 1.0f, 0.0f); // Rotate The Model On It's
    // Y-Axis ( NEW )

    gl.glGetFloatv(GLMatrixFunc.GL_MODELVIEW_MATRIX, TmpMatrix.Data, 0); // Get
    // The
    // Generated
    // Matrix
    // (
    // NEW
    // )

    // Cel-Shading Code //
    gl.glEnable(GL2.GL_TEXTURE_1D); // Enable 1D Texturing ( NEW )
    gl.glBindTexture(GL2.GL_TEXTURE_1D, shaderTexture[0]); // Bind Our
    // Texture ( NEW
    // )
    gl.glColor3f(1.0f, 1.0f, 1.0f); // Set The Color Of The Model ( NEW )

    gl.glBegin(GL2.GL_TRIANGLES); // Tell OpenGL That We're Drawing
    // Triangles
    // Loop Through Each Polygon
    for (int i = 0; i < polyNum; i++)
      // Loop Through Each Vertex
      for (int j = 0; j < 3; j++) {

        // Fill Up The TmpNormal Structure With
        TmpNormal.X = polyData[i].Verts[j].Nor.X;
        // The Current Vertices' Normal Values
        TmpNormal.Y = polyData[i].Verts[j].Nor.Y;
        TmpNormal.Z = polyData[i].Verts[j].Nor.Z;
        // Rotate This By The Matrix
        TmpMatrix.rotateVector(TmpNormal, TmpVector);
        // Normalize The New Normal
        TmpVector.normalize();

        // Calculate The Shade Value
        float TmpShade = Vector.dotProduct(TmpVector, lightAngle);

        // Clamp The Value to 0 If Negative ( NEW )
        if (TmpShade < 0.0f) {
          TmpShade = 0.0f;
        }
        // Set The Texture Co-ordinate As The Shade Value
        gl.glTexCoord1f(TmpShade);
        // Send The Vertex Position
        gl.glVertex3f(
            polyData[i].Verts[j].Pos.X, polyData[i].Verts[j].Pos.Y, polyData[i].Verts[j].Pos.Z);
      }

    gl.glEnd(); // Tell OpenGL To Finish Drawing
    gl.glDisable(GL2.GL_TEXTURE_1D); // Disable 1D Textures ( NEW )

    // Outline Code
    // Check To See If We Want To Draw The Outline
    if (outlineDraw) {
      // Enable Blending
      gl.glEnable(GL2.GL_BLEND);
      // Set The Blend Mode
      gl.glBlendFunc(GL2.GL_SRC_ALPHA, GL2.GL_ONE_MINUS_SRC_ALPHA);

      // Draw Backfacing Polygons As Wireframes
      gl.glPolygonMode(GL2.GL_BACK, GL2.GL_LINE);
      // Set The Line Width
      gl.glLineWidth(outlineWidth);
      // Don't Draw Any Front-Facing Polygons
      gl.glCullFace(GL2.GL_FRONT);

      // Change The Depth Mode
      gl.glDepthFunc(GL2.GL_LEQUAL);
      // Set The Outline Color
      gl.glColor3fv(outlineColor, 0);

      // Tell OpenGL What We Want To Draw
      gl.glBegin(GL2.GL_TRIANGLES);

      // Loop Through Each Polygon
      for (int i = 0; i < polyNum; i++) {

        // Loop Through Each Vertex
        for (int j = 0; j < 3; j++) {

          // Send The Vertex Position
          gl.glVertex3f(
              polyData[i].Verts[j].Pos.X, polyData[i].Verts[j].Pos.Y, polyData[i].Verts[j].Pos.Z);
        }
      }
      gl.glEnd(); // Tell OpenGL We've Finished
      // Reset The Depth-Testing Mode
      gl.glDepthFunc(GL2.GL_LESS);
      // Reset The Face To Be Culled
      gl.glCullFace(GL2.GL_BACK);
      // Reset Back-Facing Polygon Drawing Mode
      gl.glPolygonMode(GL2.GL_BACK, GL2.GL_FILL);

      // Disable Blending
      gl.glDisable(GL2.GL_BLEND);
    }

    // Check To See If Rotation Is Enabled
    if (modelRotate) {
      // Update Angle Based On The Clock
      modelAngle += .2f;
    }
  }
Example #8
0
  public void draw(GL2 gl, GLU glu, GLDrawState ds) {
    final Color4f highColor = new Color4f(0.0f, 1.0f, 0.0f, 1.0f);
    final Color4f lowColor = new Color4f(1.0f, 1.0f, 1.0f, 1.0f);

    Color4f[][] trueCols = new Color4f[mapHeight][mapWidth];
    //		InternalTerrainTile tiles[][] = ds.getGameMap().getTerrainMatrix();
    // Update colors

    for (int j = 0; j < mapHeight; j++) {
      for (int i = 0; i < mapWidth; i++) {

        // float fluxAmount = getMapHeight(i, j)/64.f;
        //	System.out.println(flux[j/DENSITY][i/DENSITY] + " " + fluxAmount);

        // float fluxAmount = (float)tiles[i/DENSITY][j/DENSITY].getFlux();

        Color4f tintColor = new Color4f();
        Color4f trueColor = new Color4f();

        tintColor.interpolate(lowColor, highColor, 0);
        // System.out.println(actualHeight/maxHeight);

        trueColor.interpolate(cols[j][i], tintColor, 1.0f);
        trueColor.w = cols[j][i].w;
        trueCols[j][i] = trueColor;

        // If void, see through to the background.
        /*if(tiles[i/DENSITY][j/DENSITY] == TerrainType.VOID){
        trueCols[j][i].w = 0.0f;
        }*/

      }
    }
    // System.out.println(map.getTerrainMatrix()[0][0].getFlux() + " " + MAX_FLUX_PER_TILE + " " +
    // trueCols[0][0].x);

    int k = 0;
    for (int j = 0; j < mapHeight; j++) {
      for (int i = 0; i < mapWidth; i++) {
        colors[k] = trueCols[j][i].x;
        colors[k + 1] = trueCols[j][i].y;
        colors[k + 2] = trueCols[j][i].z;
        colors[k + 3] = trueCols[j][i].w;

        float norm =
            (float)
                Math.sqrt(
                    trueCols[j][i].x * trueCols[j][i].x
                        + trueCols[j][i].y * trueCols[j][i].y
                        + trueCols[j][i].z * trueCols[j][i].z);
        float val = (norm < 0.3f) ? 0.0f : 0.9f;
        colorNorm[k] = val;
        colorNorm[k + 1] = val;
        colorNorm[k + 2] = val;
        colorNorm[k + 3] = 1.0f;
        k += 4;
      }
    }

    if (tex == null && texturePath != null) {
      tex = GLGameRenderer.textureCache.getResource(texturePath, texturePath).tex;
      texturePath = null;
    }
    gl.glPushMatrix();
    //	gl.glTranslatef(1.5f, 0.0f, 1.5f);
    if (tex != null) {
      System.out.println("Using texture");
      gl.glEnable(GL2.GL_TEXTURE_2D);
      tex.bind(gl);
      gl.glBegin(GL2.GL_TRIANGLE_STRIP);
      for (int i = 0; i < indices.length; i++) {
        gl.glTexCoord2f(texCoords[indices[i] * 2], texCoords[indices[i] * 2 + 1]);
        gl.glColor4f(
            colorNorm[indices[i] * 4],
            colorNorm[indices[i] * 4 + 1],
            colorNorm[indices[i] * 4 + 2],
            colorNorm[indices[i] * 4 + 3]);
        gl.glNormal3f(
            normals[indices[i] * 3], normals[indices[i] * 3 + 1], normals[indices[i] * 3 + 2]);
        gl.glVertex3f(
            vertices[indices[i] * 3], vertices[indices[i] * 3 + 1], vertices[indices[i] * 3 + 2]);
      }
      gl.glEnd();
    } else {
      gl.glEnable(gl.GL_BLEND);
      gl.glBegin(GL2.GL_TRIANGLE_STRIP);
      for (int i = 0; i < indices.length; i++) {
        gl.glColor4f(
            colors[indices[i] * 4],
            colors[indices[i] * 4 + 1],
            colors[indices[i] * 4 + 2],
            colors[indices[i] * 4 + 3]);
        gl.glNormal3f(
            normals[indices[i] * 3], normals[indices[i] * 3 + 1], normals[indices[i] * 3 + 2]);
        gl.glVertex3f(
            vertices[indices[i] * 3], vertices[indices[i] * 3 + 1], vertices[indices[i] * 3 + 2]);
      }
      gl.glEnd();
      gl.glDisable(gl.GL_BLEND);
    }
    gl.glPopMatrix();

    boolean showGrid = RenderConfiguration.showGridlines();
    if (showGrid) {
      gl.glColor4f(0.5f, 0.5f, 0.5f, 1.0f);
      gl.glNormal3f(0.0f, 1.0f, 0.0f);
      gl.glLineWidth(1.0f);

      // do the horizontal gridlines
      /*
      gl.glBegin(GL2.GL_LINES);
      for (int j = 1; j < map.getHeight(); ++j) {
      	gl.glVertex3f(0.0f, 0.0f, j);
      	gl.glVertex3f(map.getWidth(), 0.0f, j);
      }
      gl.glEnd();
      */
      gl.glBegin(GL2.GL_LINE_STRIP);
      for (int j = 0; j < mapHeight; j++) {
        if ((j + 1) % DENSITY != 0) {
          continue;
        }
        if ((j + 1) % (DENSITY * 2) == 0) {
          for (int i = 0; i < mapWidth; i++) {
            Vector3f p;
            Vector3f pOne;
            Vector3f pTwo;

            pOne = points[j][i];
            p = new Vector3f(0.0f, 0.0f, 0.0f);
            p.add(pOne);
            if (j < mapHeight - 1 && i > 0) {
              pTwo = points[j + 1][i - 1];
              p.add(pTwo);
              p.scale(.5f);
            }

            gl.glVertex3f(p.x, p.y + 0.01f, p.z);

            pOne = points[j][i];
            p = new Vector3f(0.0f, 0.0f, 0.0f);
            p.add(pOne);
            if (j < mapHeight - 1) {
              pTwo = points[j + 1][i];
              p.add(pTwo);
              p.scale(.5f);
            }

            gl.glVertex3f(p.x, p.y + 0.01f, p.z);
          }
        } else {
          for (int i = mapWidth - 1; i >= 0; i--) {
            Vector3f p;
            Vector3f pOne;
            Vector3f pTwo;

            pOne = points[j][i];
            p = new Vector3f(0.0f, 0.0f, 0.0f);
            p.add(pOne);
            if (j < mapHeight - 1) {
              pTwo = points[j + 1][i];
              p.add(pTwo);
              p.scale(.5f);
            }

            gl.glVertex3f(p.x, p.y + 0.01f, p.z);
            pOne = points[j][i];
            p = new Vector3f(0.0f, 0.0f, 0.0f);
            p.add(pOne);
            if (j < mapHeight - 1 && i > 0) {

              pTwo = points[j + 1][i - 1];
              p.add(pTwo);
              p.scale(.5f);
            }

            gl.glVertex3f(p.x, p.y + 0.01f, p.z);
          }
        }
      }
      gl.glEnd();

      // do the vertical gridlines
      /*
      gl.glBegin(GL2.GL_LINES);
      for (int j = 1; j < map.getWidth(); ++j) {
      	gl.glVertex3f(j, 0.0f, 0.0f);
      	gl.glVertex3f(j, 0.0f, map.getHeight());
      }
      gl.glEnd();
      */
      gl.glBegin(GL2.GL_LINE_STRIP);
      for (int i = 0; i < mapWidth; i++) {
        if ((i + 1) % DENSITY != 0) {
          continue;
        }
        if ((i + 1) % (DENSITY * 2) == 0) {
          for (int j = 0; j < mapHeight; j++) {
            Vector3f p;
            Vector3f pOne;
            Vector3f pTwo;

            pOne = points[j][i];
            p = new Vector3f(0.0f, 0.0f, 0.0f);
            p.add(pOne);
            if (j > 0 && i < mapWidth - 1) {
              pTwo = points[j - 1][i + 1];
              p.add(pTwo);
              p.scale(.5f);
            }

            gl.glVertex3f(p.x, p.y + 0.01f, p.z);

            pOne = points[j][i];
            p = new Vector3f(0.0f, 0.0f, 0.0f);
            p.add(pOne);
            if (i < mapWidth - 1) {
              pTwo = points[j][i + 1];
              p.add(pTwo);
              p.scale(.5f);
            }

            gl.glVertex3f(p.x, p.y + 0.01f, p.z);
          }
        } else {
          for (int j = mapHeight - 1; j >= 0; j--) {
            Vector3f p;
            Vector3f pOne;
            Vector3f pTwo;

            pOne = points[j][i];
            p = new Vector3f(0.0f, 0.0f, 0.0f);
            p.add(pOne);
            if (i < mapWidth - 1) {
              pTwo = points[j][i + 1];
              p.add(pTwo);
              p.scale(.5f);
            }

            gl.glVertex3f(p.x, p.y + 0.01f, p.z);

            pOne = points[j][i];
            p = new Vector3f(0.0f, 0.0f, 0.0f);
            p.add(pOne);
            if (j > 0 && i < mapWidth - 1) {
              pTwo = points[j - 1][i + 1];
              p.add(pTwo);
              p.scale(.5f);
            }

            gl.glVertex3f(p.x, p.y + 0.01f, p.z);
          }
        }
      }
      gl.glEnd();
    }
  }
Example #9
0
  @Override
  public synchronized void drawObject(GL2 gl) {
    if (state == ObjectState.notCounted) {
      int pointsCount = points.size(); // pocet bodu
      if (pointsCount > getDegree()) // existuje pouze když stupeň křivky je menší než počet bodů
      {
        setState(ObjectState.OK);
        setStateMessage(null);
      } else // nedostatek bodů
      {
        setStateMessage(
            "Nedostatek bodů pro vykreslení. Přidejte bodů: " + (degree - pointsCount + 1));
        setState(ObjectState.inputError);
      }
    }

    // vykresleni
    if (getState() == ObjectState.OK) {
      // nastavení vlastností čáry
      gl.glLineWidth(lineWidth);
      gl.glColor3fv(color.getColorComponents(null), 0);

      // určení počtu kroků
      int loopSteps = getSteps();
      if (loopSteps == 0) {
        loopSteps = 20 * points.size();
        loopSteps = loopSteps > MAX_STEPS ? MAX_STEPS : loopSteps;
        // steps = (int)scale*40*points.size();
      }

      /*
       * Výpočet pomocí grafické karty
       */
      /*if (useHWAcceleration)
      {
      //body uložím do obyčejného pole
      float[] pointArray = new float[points.size() * 4];
      int i = 0;
      for (IPoint3f p : points)
      {
      pointArray[i] = p.getX();
      pointArray[i + 1] = p.getY();
      pointArray[i + 2] = p.getZ();
      pointArray[i + 3] = ((IPoint4f) p).getW();
      i += 4;
      }
      //uložím knot do pole
      float[] knotArray = new float[knot.size()];
      i = 0;
      for (Float p : knot)
      {
      knotArray[i] = p.floatValue();
      i++;
      }

      //vlastní vykreslení
      try
      {
      GLU glu=new GLU();
      GLUnurbs nurbs = glu.gluNewNurbsRenderer();
      //glu.gluNurbsProperty(nurbs,glu.GLU_U_STEP,steps);//nepodporavane v JOGLu
      glu.gluBeginCurve(nurbs);
      glu.gluNurbsCurve(nurbs,
      knotArray.length, knotArray,
      4,
      pointArray,
      getDegree()+1,
      gl.GL_MAP1_VERTEX_4);
      glu.gluEndCurve(nurbs);
      } catch (GLException ex)
      {
      setUseHWAcceleration(false);//zakažu HW akceleraci
      }
      }*/
      /*
       * Výpočet pomocí CPU
       */
      if (!useHWAcceleration) {
        double step = 1. / (double) loopSteps;

        // uložím knot do pole+transformace do intervalu <0,1>
        float[] knotArray = knot.getTransformedValues();

        double sumx1, sumy1, sumz1;
        double sumx2, sumy2, sumz2;
        int k = getDegree() + 1;
        int n = points.size() - 1;
        int i;
        double[] N = new double[points.size()];
        IPoint4f p;

        gl.glBegin(gl.GL_LINE_STRIP);
        for (double t = knotArray[getDegree()] - step, tMax = knotArray[knotArray.length - k];
            t < tMax; ) {
          t += step;
          if (t > tMax) {
            t = tMax;
          }

          for (i = 0; i <= n; i++) {
            N[i] = MathUtils.bsplineBaseFunction(i, k, t, knotArray);
          }

          sumx1 = sumy1 = sumz1 = sumx2 = sumy2 = sumz2 = 0;
          for (i = 0; i <= n; i++) {
            p = (IPoint4f) points.get(i);
            sumx1 += p.getW() * p.getX() * N[i];
            sumy1 += p.getW() * p.getY() * N[i];
            sumz1 += p.getW() * p.getZ() * N[i];
            sumx2 += p.getW() * N[i];
            sumy2 += p.getW() * N[i];
            sumz2 += p.getW() * N[i];
          }
          gl.glVertex3d(sumx1 / sumx2, sumy1 / sumy2, sumz1 / sumz2);
        }
        gl.glEnd();
      }
    }
  }