資源簡介
OpenGL開發的三維教室場景,繪制了多個模型,有桌子,黑板,空調,墻面,電腦,場景實現了碰撞檢測,可以漫游,模型可以移動和旋轉,縮放
代碼片段和文件信息
/* This?code?has?been?created?by?Banu?Cosmin?aka?Choko?-?20?may?2000
?* and?uses?NeHe?tutorials?as?a?starting?point?(window?initialization
?* texture?loading?GL?initialization?and?code?for?keypresses)?-?very?good
?* tutorials?Jeff.?If?anyone?is?interested?about?the?presented?algorithm
?* please?e-mail?me?at?boct@romwest.ro
?*
?* Code?Commmenting?And?Clean?Up?By?Jeff?Molofee?(?NeHe?)
?* NeHe?Productions ... http://nehe.gamedev.net
?*/
#include?
#include? //?Header?File?For?Windows
#include? //?Header?File?For?The?OpenGL32?Library
#include? //?Header?File?For?The?GLu32?Library
#include? //?Header?File?For?The?Glaux?Library
#include? //?Header?File?For?Standard?Input?/?Output
HDC hDC=NULL; //?Private?GDI?Device?Context
HGLRC hRC=NULL; //?Permanent?Rendering?Context
HWND hWnd=NULL; //?Holds?Our?Window?Handle
HINSTANCE hInstance?=?NULL; //?Holds?The?Instance?Of?The?Application
bool keys[256]; //?Array?Used?For?The?Keyboard?Routine
bool active=TRUE; //?Window?Active?Flag?Set?To?TRUE?By?Default
bool fullscreen=TRUE; //?Fullscreen?Flag?Set?To?Fullscreen?Mode?By?Default
//?Light?Parameters
static?GLfloat?LightAmb[]?=?{0.7f?0.7f?0.7f?1.0f}; //?Ambient?Light
static?GLfloat?LightDif[]?=?{1.0f?1.0f?1.0f?1.0f}; //?Diffuse?Light
static?GLfloat?LightPos[]?=?{4.0f?4.0f?6.0f?1.0f}; //?Light?Position
GLUquadricObj *q; //?Quadratic?For?Drawing?A?Sphere
GLfloat xrot =??0.0f; //?X?Rotation
GLfloat yrot =??0.0f; //?Y?Rotation
GLfloat xrotspeed =??0.0f; //?X?Rotation?Speed
GLfloat yrotspeed =??0.0f; //?Y?Rotation?Speed
GLfloat zoom =?-7.0f; //?Depth?Into?The?Screen
GLfloat height =??2.0f; //?Height?Of?Ball?From?Floor
GLuint texture[3]; //?3?Textures
LRESULT CALLBACK?WndProc(HWND?UINT?WPARAM?LPARAM); //?Declaration?For?WndProc
GLvoid?ReSizeGLScene(GLsizei?width?GLsizei?height) //?Resize?And?Initialize?The?GL?Window
{
if?(height==0) //?Prevent?A?Divide?By?Zero?By
{
height=1; //?Making?Height?Equal?One
}
glViewport(00widthheight); //?Reset?The?Current?Viewport
glMatrixMode(GL_PROJECTION); //?Select?The?Projection?Matrix
glLoadIdentity(); //?Reset?The?Projection?Matrix
//?Calculate?The?Aspect?Ratio?Of?The?Window
gluPerspective(45.0f(GLfloat)width/(GLfloat)height0.1f100.0f);
glMatrixMode(GL_MODELVIEW); //?Select?The?Modelview?Matrix
glLoadIdentity(); //?Reset?The?Modelview?Matrix
}
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) //?
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????24129??2018-12-18?19:49??test110\adsf.cpp
?????文件?????196664??2013-12-19?20:07??test110\Data\air-sides.bmp
?????文件?????196664??2013-12-19?20:04??test110\Data\air.bmp
?????文件??????49206??2000-04-27?21:51??test110\Data\Ball.bmp
?????文件?????196664??2013-12-19?21:48??test110\Data\blackboard-sides.bmp
?????文件?????196664??2013-12-19?21:42??test110\Data\blackboard.bmp
?????文件?????196664??2013-12-18?15:49??test110\Data\ceiling.bmp
?????文件?????195896??2013-12-18?16:26??test110\Data\desk.bmp
?????文件?????196664??2013-12-18?16:00??test110\Data\door.bmp
?????文件?????196662??2000-05-18?02:04??test110\Data\Envroll.bmp
?????文件??????49206??2000-05-18?02:04??test110\Data\Envwall.bmp
?????文件?????196664??2013-12-16?15:44??test110\Data\floor.bmp
?????文件?????196664??2013-12-19?20:29??test110\Data\laptop-sides.bmp
?????文件?????196664??2013-12-19?20:29??test110\Data\laptop.bmp
?????文件?????196664??2013-12-20?16:10??test110\Data\lblackboard.bmp
?????文件?????196664??2013-12-20?15:19??test110\Data\projector-sides.bmp
?????文件??????21224??2013-12-20?15:21??test110\Data\projector.bmp
?????文件?????196664??2013-12-20?16:10??test110\Data\rblackboard.bmp
????..A.SH.??????5632??2006-08-04?03:24??test110\Data\Thumbs.db
?????文件?????196664??2013-12-19?21:06??test110\Data\voice?box.bmp
?????文件?????196664??2013-12-16?13:21??test110\Data\wall.bmp
?????文件?????196664??2013-12-16?15:54??test110\Data\window.bmp
?????文件???????1592??2013-12-18?14:07??test110\Data\World.txt
?????文件?????196664??2013-12-20?15:12??test110\Data\zhuzi.bmp
?????文件??????59136??2018-12-18?19:49??test110\Debug\adsf.obj
?????文件????????644??2018-12-18?19:49??test110\Debug\cl.command.1.tlog
?????文件??????14462??2018-12-18?19:49??test110\Debug\CL.read.1.tlog
?????文件????????270??2018-12-18?19:49??test110\Debug\CL.write.1.tlog
?????文件?????196664??2013-12-19?20:07??test110\Debug\Data\air-sides.bmp
?????文件?????196664??2013-12-19?20:04??test110\Debug\Data\air.bmp
............此處省略90個文件信息
- 上一篇:cmake-3.1.2
- 下一篇:軟件工程(第3版).課后答案
評論
共有 條評論