/* Auteur: Nicolas JANEY */ /* nicolas.janey@univ-fcomte.fr */ /* Novembre 2007 */ /* Un carre de carres */ #include #include #include /* Dessin d'un carre au moyen de plusieurs */ /* primitives de type GL_QUAD_STRIP */ /* (n quad_strips) */ void solution2(int n,float c) { float ct = c / n; c *= 0.5F; glNormal3f(0.0F,0.0F,1.0F); float yi; float yf = -c; for ( int j = 0 ; j < n ; j++ ) { yi = yf; yf += ct; glBegin(GL_QUAD_STRIP); float x = c; for ( int i = 0 ; i <= n ; i++ ) { glVertex2f(x,yi); glVertex2f(x,yf); x -= ct; } glEnd(); } }