/* Simple demo of computing textures as arrays of values and texture-mapping them onto a 2D quad. There are two textures: the classic checkerboard (which is simple but boring because it is invariant almost no matter what you do to it) and the US flag. Toggle between them using a 'u'. Scott D. Anderson Fall 2000 original Fall 2003 adapted to use TW */ #include #include bool USflag = false; // which flag to show void toggleFlag(unsigned char key, int x, int y) { USflag = !USflag; glutPostRedisplay(); } /* ================================================================ Checkerboard Texture variables. The checkerboard texture is an array of unsigned 8-bit values (GLubyte) which are interpreted as a grayscale value. We only use 0xFF and 0, namely white and black, respectively. */ const int CheckFlagWidth = 8; const int CheckFlagHeight = 8; GLubyte CheckFlagArray[CheckFlagHeight][CheckFlagWidth]; void init_check_flag() { for(int i=0; i