4、);//启用灯源glEnable(GL_LIGHT0);//启用0号灯glShadeModel(GL_SMOOTH);//设置光滑着色模式glEnable(GL_DEPTH_TEST);//启用深度测试glEnable(GL_NORMALIZE);//启用法向量glClearColor(1.0f,1.0f,1.0f,0.0f);//为色彩缓冲区指定用于清除的值//设置表面材料的属性GLfloatmat_ambient[]={0.6f,0.6f,0.6f,1.0f};GLfloatmat_diffuse[]={0.5f,0.5f
5、,0.5f,1.0f};GLfloatmat_specular[]={1.0f,1.0f,1.0f,1.0f,};GLfloatmat_shininess[]={40.0f};glMaterialfv(GL_FRONT,GL_AMBIENT,mat_ambient);//指定环境泛光的强度glMaterialfv(GL_FRONT,GL_DIFFUSE,mat_diffuse);//漫反射的强度glMaterialfv(GL_FRONT,GL_SPECULAR,mat_specular);//镜面反射的强度glMaterial
6、fv(GL_FRONT,GL_SHININESS,mat_shininess);//镜面反射光的会聚强度//纹理makeCheckImage();//绘制地面纹理图案glPixelStorei(GL_UNPACK_ALIGNMENT,1);//控制像素存储模式glGenTextures(1,&texName);//用来生成纹理的数量为1glBindTexture(GL_TEXTURE_2D,texName);//绑定纹理//纹理滤波,图象从纹理图象空间映射到帧缓冲图象空间glTexParameteri(GL_TEXTURE_2
7、D,GL_TEXTURE_WRAP_S,GL_REPEAT);glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT);glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA,checkImageW
8、idth,checkImageHeight,0,GL_RGBA,GL_UNSIGNED_BYTE,checkImage);}//函数功能:绘制墙壁voidDrawWall(void){glPushMatrix();//矩阵堆栈压入..glTranslated(1.2,0.01