private static void drawShape(GL2 gl,Shape s){
  PathIterator it=s.getPathIterator(new AffineTransform(),shapeFlatness);
  float[] lastMoveTo=new float[6];
  float[] f=new float[6];
  while (!it.isDone()) {
    int res=it.currentSegment(f);
switch (res) {
case PathIterator.SEG_CLOSE:
      GLPanel.V(gl,lastMoveTo[0],lastMoveTo[1]);
    break;
case PathIterator.SEG_MOVETO:
  GLPanel.V(gl,f[0],f[1]);
System.arraycopy(f,0,lastMoveTo,0,6);
break;
case PathIterator.SEG_LINETO:
GLPanel.V(gl,f[0],f[1]);
break;
case PathIterator.SEG_CUBICTO:
CubicCurve2D c=new CubicCurve2D.Float(lastMoveTo[0],lastMoveTo[1],f[0],f[1],f[2],f[3],f[4],f[5]);
drawShape(gl,c);
break;
default :
throw new Error("Error while drawing AWT shape. " + "Path iterator setment not handled:" + res);
}
it.next();
}
}

private static void drawShape ( GL2 gl , Shape s ) { PathIterator it = s . getPathIterator ( new AffineTransform ( ) , shapeFlatness ) ; float [ ] lastMoveTo = new float [ 6 ] ; float [ ] f = new float [ 6 ] ; while ( ! it . isDone ( ) ) { int res = it . currentSegment ( f ) ; switch ( res ) { case PathIterator . SEG_CLOSE : GLPanel . V ( gl , lastMoveTo [ 0 ] , lastMoveTo [ 1 ] ) ; break ; case PathIterator . SEG_MOVETO : GLPanel . V ( gl , f [ 0 ] , f [ 1 ] ) ; System . arraycopy ( f , 0 , lastMoveTo , 0 , 6 ) ; break ; case PathIterator . SEG_LINETO : GLPanel . V ( gl , f [ 0 ] , f [ 1 ] ) ; break ; case PathIterator . SEG_CUBICTO : CubicCurve2D c = new CubicCurve2D . Float ( lastMoveTo [ 0 ] , lastMoveTo [ 1 ] , f [ 0 ] , f [ 1 ] , f [ 2 ] , f [ 3 ] , f [ 4 ] , f [ 5 ] ) ; drawShape ( gl , c ) ; break ; default : throw new Error ( "Error while drawing AWT shape. " + "Path iterator setment not handled:" + res ) ; } it . next ( ) ; } }
draw the given shape on the given opengl object .
