/* Example 4.5.image.c: write an image into the framebuffer */ // by Jim X. Chen; June, 2001 #include #include #include #include #include #define ESC 27 #define SPACE 32 int Height=600, Width=600; int cnt=1, moonView=0; float O, A, B, C; float alpha=-30, beta=-30, gama=60, aalpha=1, abeta=1, agama=-2; int depth=2; static float vdata[6][3] = { {1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {-1.0, 0.0, 0.0}, {0.0, -1.0, 0.0}, {0.0, 0.0, 1.0}, {0.0, 0.0, -1.0} }; float white[] = { 1., 1., 1., 1.}; float whitish[] = { .6, .6, .6, 1.}; float black[] = { 0., 0., 0., 1.}; float blackish[] = { .2, .2, .2, 1.}; float red[] = { 1., 0., 0., 1.}; float redish[] = { .3, .0, .0, 1.}; float green[] = { 0., 1., 0., 1.}; float greenish[] = { .0, .3, .0, 1.}; float blue[] = { 0., 0., 1., 1.}; float blueish[] = { 0., 0., .3, 1.}; float cyan[] = { 0.0, 1.0, 1.0, 1.}; float magenta[] = { 1.0, 0.0, 1.0, 1.}; float yellow[] = { 1.0, 1.0, 0.0, 1.}; #define stars_pixels 512 static GLubyte stars_image[stars_pixels][stars_pixels]; void read_stars_image() { int i,j; FILE *stars_file; if((stars_file=fopen("images/stars.bmp","rb"))==NULL) { printf("File stars.bmp could not be opened, errno=%d\n",errno); for(i=0;i