/* Objets graphiques                            */
/*                                              */
/* Auteur: Nicolas JANEY                        */
/* nicolas.janey@univ-fcomte.fr                 */
/* Fevrier 2014                                 */

#include <stdlib.h>
#include <stdio.h>

#include <GL/glut.h>
#include <GL/gl.h>
#include <GL/glu.h>

static const GLfloat grisFonce[4] = { 0.25F,0.25F,0.25F,1.0F }; 
static const GLfloat grisClair[4] = { 0.75F,0.75F,0.75F,1.0F }; 

/* Objets graphiques                            */

/* Un damier                                    */

void damier(void) {
  glPushMatrix();
  glTranslatef(0.0F,-0.5F,0.0F);
  for ( int i = 0 ; i < 40 ; i++ )
    for ( int j = 0 ; j < 40 ; j++ ) {
      glPushMatrix();
      glTranslatef(-19.5F+i,0.0F,-19.5F+j);
      glMaterialfv(GL_FRONT,GL_DIFFUSE,( (i+j)%2 == 0 ) ? grisClair : grisFonce);
      glutSolidCube(1.0);
      glPopMatrix(); }
  glPopMatrix();
}
