#include <windows.h>
#include <GL/glut.h>
#include <GL/glaux.h>
#include <stdio.h>
#pragma comment( lib, "opengl32.lib" )// 链接时使用OpenGL32.lib
#pragma comment( lib, "glu32.lib" )// 链接时使用GLu32.lib
#pragma comment( lib, "glaux.lib" ) // 链接时使用GLaux.lib
HWND hWnd;
HDC hDC;
HGLRC hRC=NULL;//定义渲染环境
HINSTANCE hInstance;//得到程序的例子
RECT rect;
int sw = 600;
int sh = 600;
GLfloat aspect;
GLfloat x1=0.0;
GLfloat y1=0.0;
GLfloat xrot;// X轴旋转
GLfloat yrot;// Y轴旋转
GLfloat z=8.0;// 移入屏幕的深度
GLfloat x=0.0;
GLfloat y=0.0;
int LastXPos;
int LastYPos;
bool IsLBDown;
bool light;//光源-开/关
bool lp;//L键是否按下?
GLfloat LightAmbient[]= { 0.5f, 0.5f, 0.5f, 1.0 }; //环境光的值
GLfloat LightDiffuse[]= { 1.0, 1.0, 1.0, 1.0 }; //散射光的值
GLfloat LightPosition[]={ 0.0, 0.0, 2.0, 1.0 }; //光照位置
GLubyte Pixel;
GLuint texture[8];//纹理的存储空间
AUX_RGBImageRec *TextureImage[8];//为纹理创建存储空间
int LoadGLTextures(int i,char *FileName)//调用Bitmap并转换成纹理
{
unsigned char *m_ucpData;
unsigned int x,y,width,height;
unsigned char tempRGB;
unsigned char *buffer;
FILE *fp;
int Status=FALSE;//状态确定
//-------------------------------读取位图,检查错误。如果位图不存在则退出
if(TextureImage[i]=auxDIBImageLoad(FileName))
{
width=TextureImage[i]->sizeX;
height=TextureImage[i]->sizeY;
Status=TRUE;//将Status设为TRUE
fp=fopen(FileName,"a+b");
if(!fp){
fclose(fp);
#include <GL/glut.h>
#include <GL/glaux.h>
#include <stdio.h>
#pragma comment( lib, "opengl32.lib" )// 链接时使用OpenGL32.lib
#pragma comment( lib, "glu32.lib" )// 链接时使用GLu32.lib
#pragma comment( lib, "glaux.lib" ) // 链接时使用GLaux.lib
HWND hWnd;
HDC hDC;
HGLRC hRC=NULL;//定义渲染环境
HINSTANCE hInstance;//得到程序的例子
RECT rect;
int sw = 600;
int sh = 600;
GLfloat aspect;
GLfloat x1=0.0;
GLfloat y1=0.0;
GLfloat xrot;// X轴旋转
GLfloat yrot;// Y轴旋转
GLfloat z=8.0;// 移入屏幕的深度
GLfloat x=0.0;
GLfloat y=0.0;
int LastXPos;
int LastYPos;
bool IsLBDown;
bool light;//光源-开/关
bool lp;//L键是否按下?
GLfloat LightAmbient[]= { 0.5f, 0.5f, 0.5f, 1.0 }; //环境光的值
GLfloat LightDiffuse[]= { 1.0, 1.0, 1.0, 1.0 }; //散射光的值
GLfloat LightPosition[]={ 0.0, 0.0, 2.0, 1.0 }; //光照位置
GLubyte Pixel;
GLuint texture[8];//纹理的存储空间
AUX_RGBImageRec *TextureImage[8];//为纹理创建存储空间
int LoadGLTextures(int i,char *FileName)//调用Bitmap并转换成纹理
{
unsigned char *m_ucpData;
unsigned int x,y,width,height;
unsigned char tempRGB;
unsigned char *buffer;
FILE *fp;
int Status=FALSE;//状态确定
//-------------------------------读取位图,检查错误。如果位图不存在则退出
if(TextureImage[i]=auxDIBImageLoad(FileName))
{
width=TextureImage[i]->sizeX;
height=TextureImage[i]->sizeY;
Status=TRUE;//将Status设为TRUE
fp=fopen(FileName,"a+b");
if(!fp){
fclose(fp);