#include #include #include #include #include #include "lowlevel.h" /* Variables local to this file */ int W; /* width of frame buffer */ int H; /* height of frame buffer */ int S; /* size of each pixel */ /*****************************************************************************/ /* Fake frame buffer - Use an array of 3 GLubytes per pixel as an imitiation frame buffer. We'll color the pixels of this array to draw a triangle */ /* pointer to faux frame buffer; a three-dimensional array */ GLubyte *fb; void colorPixel(int x, int y, GLubyte r, GLubyte g, GLubyte b) { fb[y*W*3 + x*3 + 0] = r; fb[y*W*3 + x*3 + 1] = g; fb[y*W*3 + x*3 + 2] = b; } /* Allocate storage for fake frame buffer, and fill it with all black */ void initBigPixelArray(int w, int h, int s) { int x; int y; int k; W = w; H = h; S = s; fb = (GLubyte*) malloc(W*H*3*sizeof(GLubyte)); /* set initial color to grey */ for (x=0; x