public void paint(GeometryViewer viewer, GL gl, GLU glu) { float knots[] = {0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, 1.0f}; float flatControlPoints[]; int i, j, k, flatCounter = 0; flatControlPoints = new float[4 * 4 * 3]; for (i = 0; i < 4; i++) for (j = 0; j < 4; j++) for (k = 0; k < 3; k++) flatControlPoints[flatCounter++] = controlPoints[i][j][k]; gl.pushMatrix(); gl.rotate(330.0f, 1.f, 0.f, 0.f); gl.scale(0.5f, 0.5f, -0.5f); surface.beginSurface(); surface.nurbsSurface(knots, knots, 4 * 3, 3, flatControlPoints, 4, 4, MAP2_VERTEX_3); surface.endSurface(); if (showPoints == true) { gl.pointSize(5.0f); gl.disable(LIGHTING); gl.color(1.0f, 1.0f, 0.0f); gl.begin(POINTS); for (i = 0; i < 4; i++) { for (j = 0; j < 4; j++) { gl.vertex(controlPoints[i][j][0], controlPoints[i][j][1], controlPoints[i][j][2]); } } gl.end(); gl.enable(LIGHTING); } gl.popMatrix(); }