glut/lib/gle/ex_cut_round.c
/* ============================================================ */
/* 
 * This subroutine draws a flat cap, to close off the cut ends 
 * of the cut-style join.  Because OpenGL doe not natively handle 
 * concave polygons, this will cause some artifacts to appear on the
 * screen.
 */
This subroutine draws a flat cap, to close off the cut ends
of the cut-style join.  Because OpenGL doe not natively handle
concave polygons, this will cause some artifacts to appear on the
screen.
This subroutine draws a flat cap to close off the cut ends of the cut - style join . Because OpenGL doe not natively handle concave polygons this will cause some artifacts to appear on the screen .
void draw_cut_style_cap_callback (int iloop,
                                  double cap[][3], 
                                  float face_color[3],
                                  gleDouble cut_vector[3],
                                  gleDouble bisect_vector[3],
                                  double norms[][3], 
                                  int frontwards)
{
   int i;
   if (face_color != NULL) C3F (face_color);
   if (frontwards) {
      if (cut_vector != NULL) {
         if (cut_vector[2] < 0.0) { 
            VEC_SCALE (cut_vector, -1.0, cut_vector); 
         }
         N3F_D (cut_vector);
      }
      BGNPOLYGON();
      for (i=0; i<iloop; i++) {
         V3F_D (cap[i], i, FRONT_CAP);
      }
      ENDPOLYGON();
   } else {
      if (cut_vector != NULL) {
         if (cut_vector[2] > 0.0) 
           { VEC_SCALE (cut_vector, -1.0, cut_vector); }
         N3F_D (cut_vector);
      }
      BGNPOLYGON();
      for (i=iloop-1; i>-1; i--) {
         V3F_D (cap[i], i, BACK_CAP);
      }
      ENDPOLYGON();
   }
}
void draw_cut_style_cap_callback ( int iloop , double cap [ ] [ 3 ] , float face_color [ 3 ] , gleDouble cut_vector [ 3 ] , gleDouble bisect_vector [ 3 ] , double norms [ ] [ 3 ] , int frontwards ) { int i ; if ( face_color != NULL ) C3F ( face_color ) ; if ( frontwards ) { if ( cut_vector != NULL ) { if ( cut_vector [ 2 ] < 0.0 ) { VEC_SCALE ( cut_vector , -1.0 , cut_vector ) ; } N3F_D ( cut_vector ) ; } BGNPOLYGON ( ) ; for ( i = 0 ; i < iloop ; i ++ ) { V3F_D ( cap [ i ] , i , FRONT_CAP ) ; } ENDPOLYGON ( ) ; } else { if ( cut_vector != NULL ) { if ( cut_vector [ 2 ] > 0.0 ) { VEC_SCALE ( cut_vector , -1.0 , cut_vector ) ; } N3F_D ( cut_vector ) ; } BGNPOLYGON ( ) ; for ( i = iloop - 1 ; i > -1 ; i -- ) { V3F_D ( cap [ i ] , i , BACK_CAP ) ; } ENDPOLYGON ( ) ; } }
This subroutine draws a flat cap, to close off the cut ends
 of the cut-style join.
This subroutine draws a flat cap to close off the cut ends of the cut - style join .
/* if lighting is on, specify the endcap normal */ /* if normal pointing in wrong direction, flip it. */ /* if lighting is on, specify the endcap normal */ /* if normal pointing in wrong direction, flip it. */ /* the sense of the loop is reversed for backfacing culling */