I am to alternative box color for each polygon.
void display(void){
glClear(GL_COLOR_BUFFER_BIT);
int evenoddcheck = 0;
int height = 50;
int width = 100;
glBegin(GL_POLYGON);
for( int a=0 ; a <= 1000 ; a=a+100 )
{
for( int b=0 ; b <= 500 ; b=b+50 )
{
if( evenoddcheck % 2 == 0 )
{
glColor3f(0.0f,0.0f,0.0f);
}
else {
glColor3f(1.0f,1.0f,1.0f);
}
glVertex2i(b,a);
glVertex2i(b,width+a);
glVertex2i(height+b,width+a);
glVertex2i(height+b,a);
evenoddcheck++;
}
}
glEnd();
glFlush();
}
work fine with single color, but when i render code it shows http://s11.postimage.org/3ms3mmc4j/box.png