資源簡(jiǎn)介
OPENGL 畫地球-紋理貼圖 光照 動(dòng)畫
VS2005工程,需要gl glu glut glaux支持。
有任何問(wèn)題可留言。

代碼片段和文件信息
/************************************************************
??Copyright?(C)?2008-2010?Jbctech.?Co.?Ltd.
??FileName:?test.cpp
??Author:Jacob?Chen????????????
??Description:?旋轉(zhuǎn)地球????
??Version:?????V1.0?????
??History:?????NONE
??Date: ???2009.8.31
***********************************************************/
#?include?
#include?
#include?
#include?
#?include?
GLuint ????texture[1];
GLUquadricObj *q;
AUX_RGBImageRec?*TextureImage[1];
GLfloat xrot=0.1; //?Angle?For?The?Triangle?
/*************************************************
??Function:???????LoadBMP
??Description:????load?a?BMP?picture?from?the?disk
??Input:??????????Filename?is?the?path?of?the?file
??Return:?????????return?a?point?to?the?Bitmap?picture?if?success
??????????????????return?NUll?while?faile?to?open?the?file.
??Others:?????????none
*************************************************/
AUX_RGBImageRec?*LoadBMP(char?*Filename) //?Loads?A?Bitmap?Image
{
FILE?*File=NULL; //?File?Handle
if?(!Filename) //?Make?Sure?A?Filename?Was?Given
{
return?NULL; //?If?Not?Return?NULL
}
File=fopen(Filename“r“); //?Check?To?See?If?The?File?Exists
if?(File) //?Does?The?File?Exist?
{
fclose(File); //?Close?The?Handle
return?auxDIBImageLoad(Filename); //?Load?The?Bitmap?And?Return?A?Pointer
}
return?NULL; //?If?Load?Failed?Return?NULL
}
/*************************************************
??Function:???????init
??Description:????init?material?light?and?texture.then?enable?the?
??Input:??????????none
??Return:?????????none
??Others:?????????none
*************************************************/
void?init?(?void?)
?{
????GLfloat?mat_specular?[?]?=?{?1.0?1.0?1.0?1.0?};
????GLfloat?mat_diffuse?[?]?=?{?0.0?2.0?2.0?0.1};
????GLfloat?mat_shininess?[?]?=?{?100.0?};
???//?Light?Parameters
????GLfloat?LightAmb[]?=?{0.3f?0.3f?0.3f?1.0f}; //?Ambient?Light
????GLfloat?LightDif[]?=?{1.0f?1.0f?1.0f?1.0f}; //?Diffuse?Light
????GLfloat?light0_position?[?]?=?{?2.0?0.1?0.0?0.0?};
????GLfloat?light1_position?[?]?=?{?2.0?0.1?0.0?0.0?};
????GLfloat?light2_position?[?]?=?{?10.0?0.0?0.0?0.0?};
?
????glClearColor?(?0.0?0.0?0.0?1.0?);
????glShadeModel?(?GL_SMOOTH?);
????glLightfv?(?GL_LIGHT1?GL_AMBIENT?LightAmb); //?Set?The?Ambient?Lighting?For?Light0
????glLightfv?(?GL_LIGHT1?GL_DIFFUSE?LightDif); //?Set?The?Diffuse?Lighting?For?Light0 ?
????glLightfv?(?GL_LIGHT0?GL_POSITION?light0_position);
????glLightfv?(?GL_LIGHT1?GL_POSITION?light1_position);
/*******************use?the?quadratic?to?creat?the?object**************************************/
????q?=?gluNewQuadric(); ??//?Create?A?New?Quadratic
????gluQuadricNormals(q?GL_SMOOTH); ??//?Generate?Smooth?Normals?For?The?Quad
????gluQuadricTexture(q?GL_TRUE); ??//?Enable?Texture?Coor
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2009-09-24?13:17??debug\
?????文件???????69632??2009-09-24?13:22??debug\Rolling-earth.exe
?????文件??????649420??2009-09-24?13:22??debug\Rolling-earth.ilk
?????文件??????527360??2009-09-24?13:22??debug\Rolling-earth.pdb
?????目錄???????????0??2009-09-24?13:21??Rolling-earth\
?????文件?????7834624??2009-09-24?13:22??Rolling-earth.ncb
?????文件?????????904??2009-09-24?11:57??Rolling-earth.sln
?????目錄???????????0??2009-09-24?12:00??Rolling-earth\Data\
?????文件???????19110??2009-08-26?16:38??Rolling-earth\Data\1.jpg
?????文件???????49206??2000-04-27?21:51??Rolling-earth\Data\Ball.bmp
?????文件??????196662??2000-05-18?02:04??Rolling-earth\Data\Envroll.bmp
?????文件???????49206??2000-05-18?02:04??Rolling-earth\Data\Envwall.bmp
?????文件?????3145784??2009-08-26?17:18??Rolling-earth\Data\jbBall.bmp
?????文件??????196664??2009-08-28?15:17??Rolling-earth\Data\jbBall1.bmp
?????文件??????786488??2009-08-26?17:13??Rolling-earth\Data\jbball2.bmp
?????文件???????31232??2009-08-31?09:07??Rolling-earth\Data\Thumbs.db
?????目錄???????????0??2009-09-24?13:22??Rolling-earth\Debug\
?????文件????????7936??2009-09-24?13:22??Rolling-earth\Debug\BuildLog.htm
?????文件??????????67??2009-09-24?13:22??Rolling-earth\Debug\mt.dep
?????文件?????????403??2009-09-24?13:17??Rolling-earth\Debug\Rolling-earth.exe.em
?????文件?????????468??2009-09-24?13:17??Rolling-earth\Debug\Rolling-earth.exe.em
?????文件?????????385??2009-09-24?13:22??Rolling-earth\Debug\Rolling-earth.exe.intermediate.manifest
?????文件???????34334??2009-09-24?13:22??Rolling-earth\Debug\Rolling-earth.obj
?????文件??????306176??2009-09-24?13:22??Rolling-earth\Debug\vc80.idb
?????文件???????94208??2009-09-24?13:22??Rolling-earth\Debug\vc80.pdb
?????文件?????????986??2009-09-24?11:57??Rolling-earth\ReadMe.txt
?????文件????????7939??2009-09-24?13:21??Rolling-earth\Rolling-earth.cpp
?????文件????????4081??2009-09-24?13:16??Rolling-earth\Rolling-earth.vcproj
?????文件????????1407??2009-09-24?13:22??Rolling-earth\Rolling-earth.vcproj.CC_PC.Administrator.user
評(píng)論
共有 條評(píng)論