void display() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); glTranslatef(0, -2, -50); glRotatef(rotation, 1, 0, 0); int i; for(i=0; i < size*size; i++) { //printf("%d", i); int temp = maze[i]; if((temp&1) == 1) { //wall in da north //printf("n"); glBegin(GL_QUADS); glColor3f(0, 0.3, 0); glVertex3f(1, 0, -1); glVertex3f(1, 2, -1); glVertex3f(-1, 2, -1); glVertex3f(-1, 0, -1); glEnd(); } if((temp&4) == 4) { //wall in da east //printf("o"); glBegin(GL_QUADS); glColor3f(0, 0.1, 0); glVertex3f(1, 0, -1); glVertex3f(1, 2, -1); glVertex3f(1, 2, 1); glVertex3f(1, 0, 1); glEnd(); } if((temp&2) == 2) { //wall in da south //printf("s"); glBegin(GL_QUADS); glColor3f(0, 1, 0); glVertex3f(-1, 0, 1); glVertex3f(-1, 2, 1); glVertex3f(1, 2, 1); glVertex3f(1, 0, 1); glEnd(); } if((temp&8) == 8) { //wall ind da west //printf("w"); glBegin(GL_QUADS); glColor3f(0, 0.8, 0); glVertex3f(-1, 0, 1); glVertex3f(-1, 2, 1); glVertex3f(-1, 2, -1); glVertex3f(-1, 0, -1); glEnd(); } //printf("%d", (i%size)); //printf("\n"); if((i)%size == 2) { glTranslatef(-((size*2)-2), 0, 2); } else { glTranslatef(2, 0, 0); } } glutSwapBuffers(); }