话不多说,看图和代码注释
#include <stdlib.h>
#define GLUT_DISABLE_ATEXIT_HACK
#include <GL/glut.h>
GLfloat *currentCoeff;
GLenum currentPlane;
GLint currentGenMode;
float roangles = 45.0;
#define stripeImageWidth 32
GLubyte stripeImage[4 * stripeImageWidth];
//自定义初始化opengl函数
void makeStripeImage(void) { //生成纹理
for (int j = 0; j < stripeImageWidth; j++) {
stripeImage[4 * j + 0] = (GLubyte)((j <= 4) ? 255 : 0);
stripeImage[4 * j + 1] = (GLubyte)((j > 4) ? 255 : 0);
stripeImage[4 * j + 2] = (GLubyte)0;
stripeImage[4 * j + 3] = (GLubyte)255;
}
}
void init(void)
{
GLfloat xequalzero[] = { 1.0, 1.0, 1.0, 1.0 };
GLfloat slanted[]