The following generates a 64x64 checker texture, in which we alternate between black and white at 8 pixel intervals.
# define texWidth 64 # define texHeight 64 GLubyte checkerTex[texWidth][texHeight][3]; void makeCheckerTex( void ) { int i, j, r, c; for (i=0; i< checkWidth; i++){ for (j=0; i< texHeight; j++){ c = (((i&0x8)==0)^((j&0x8))==0)*255; checkerTex[i][j][0] = (GLubyte) c; checkerTex[i][j][1] = (GLubyte) c; checkerTex[i][j][2] = (GLubyte) c; } } }