20 December 2011

Spot the Stupidity: Give me a sign


Spot the stupidity!

for (unsigned x = 0; x < GridSizeX; ++x) {
for (unsigned y = 0; y < GridSizeY; ++y) {
if ((unsigned)abs(x+y) % 2 == 1) {//modulo 2
glColor4f(1.0f,1.0f,1.0f, alpha); //white
} else {
glColor4f(0.0f,0.0f,0.0f, alpha); //black
}

glNormal3f(                  0,                  0, 1);
glVertex3f(    x*SizeX + world.minX,    y*SizeY + world.minY, 0);
glVertex3f((x+1)*SizeX + world.minX,    y*SizeY + world.minY, 0);
glVertex3f((x+1)*SizeX + world.minX,(y+1)*SizeY + world.minY, 0);
glVertex3f(    x*SizeX + world.minX,(y+1)*SizeY + world.minY, 0);

}
}


And this, ladies and gentlemen, is why you should not code at 3am.

No comments:

Post a Comment