private void drawRect(int i, int j) { double x1, y1, x2, y2, x3, y3, x4, y4; float heightVal = (float)(grid.GetCellByIdx(i, j)); if (heightVal >= .1) { grid.GetReals(i, j, out x1, out y1); grid.GetReals(i + 1, j, out x2, out y2); grid.GetReals(i, j + 1, out x3, out y3); grid.GetReals(i + 1, j + 1, out x4, out y4); //pen = new GLPen(ColorFromHeight(heightVal), 1f); //pen.GLApplyPen(); //Gl.glVertex3f((float)x, (float)y, heightVal); //Gl.glVertex3f((float)x, (float)y, 0); GLUtility.Draw3DRectangle(new GLPen(ColorFromHeight(heightVal), 1f), new Vector3(x1, y1, heightVal), new Vector3(x2, y2, grid.GetCellByIdx(i + 1, j)), new Vector3(x3, y3, grid.GetCellByIdx(i, j + 1)), new Vector3(x4, y4, grid.GetCellByIdx(i + 1, j + 1))); } }