PART ONE
实验一
codes.cpp
#include <iostream>
#include <GL/freeglut.h>
using namespace std;
#define width 150
#define height 150
GLubyte green[height][width][4];
void initGreen()
{
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
green[y][x][0] = 0;
green[y][x][1] = 255;
green[y][x][2] = 0;
green[y][x][3] = 255;
}
}
}
GLubyte blue[height][width][4];
void initBlue()
{
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
blue[y][x][0] = 0;
blue[y][x][1] = 0;
blue[y][x][2] = 255;
blue[y][x][3] = 255;
}
}
}
void grab(GLint w, GLint h)
{
GLubyte* image;
GLint dataLength = w * 4 * h; //四通道
image = (GLubyte*)m