void paint(Graphics g){
  if (vert == null || nvert <= 0) {
    return;
  }
  transform();
  if (gr == null) {
    gr=new Color[16];
    for (int i=0; i < 16; i++) {
      int grey=(int)(170 * (1 - Math.pow(i / 15.0,2.3)));
      gr[i]=new Color(grey,grey,grey);
    }
  }
  int lg=0;
  int lim=ncon;
  int c[]=con;
  int v[]=tvert;
  if (lim <= 0 || nvert <= 0) {
    return;
  }
  for (int i=0; i < lim; i++) {
    int T=c[i];
    int p1=((T >> 16) & 0xFFFF) * 3;
    int p2=(T & 0xFFFF) * 3;
    int grey=v[p1 + 2] + v[p2 + 2];
    if (grey < 0) {
      grey=0;
    }
    if (grey > 15) {
      grey=15;
    }
    if (grey != lg) {
      lg=grey;
      g.setColor(gr[grey]);
    }
    g.drawLine(v[p1],v[p1 + 1],v[p2],v[p2 + 1]);
  }
}

void paint ( Graphics g ) { if ( vert == null || nvert <= 0 ) { return ; } transform ( ) ; if ( gr == null ) { gr = new Color [ 16 ] ; for ( int i = 0 ; i < 16 ; i ++ ) { int grey = ( int ) ( 170 * ( 1 - Math . pow ( i / 15.0 , 2.3 ) ) ) ; gr [ i ] = new Color ( grey , grey , grey ) ; } } int lg = 0 ; int lim = ncon ; int c [ ] = con ; int v [ ] = tvert ; if ( lim <= 0 || nvert <= 0 ) { return ; } for ( int i = 0 ; i < lim ; i ++ ) { int T = c [ i ] ; int p1 = ( ( T > > 16 ) & 0xFFFF ) * 3 ; int p2 = ( T & 0xFFFF ) * 3 ; int grey = v [ p1 + 2 ] + v [ p2 + 2 ] ; if ( grey < 0 ) { grey = 0 ; } if ( grey > 15 ) { grey = 15 ; } if ( grey != lg ) { lg = grey ; g . setColor ( gr [ grey ] ) ; } g . drawLine ( v [ p1 ] , v [ p1 + 1 ] , v [ p2 ] , v [ p2 + 1 ] ) ; } }
paint this model to a graphics context . it uses the matrix associated with this model to map from model space to screen space . the next version of the browser should have double buffering , which will make this * much * nicer
