OpenGL开发的三维教室场景,绘制了多个模型,有桌子,黑板,空调,墙面,电脑,场景实现了碰撞检测,可以漫游,模型可以移动和旋转,缩放
代码片段和文件信息
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 24129 2018-12-18 19:49 test110adsf.cpp
文件 196664 2013-12-19 20:07 test110Dataair-sides.bmp
文件 196664 2013-12-19 20:04 test110Dataair.bmp
文件 49206 2000-04-27 21:51 test110DataBall.bmp
文件 196664 2013-12-19 21:48 test110Datalackboard-sides.bmp
文件 196664 2013-12-19 21:42 test110Datalackboard.bmp
文件 196664 2013-12-18 15:49 test110Dataceiling.bmp
文件 195896 2013-12-18 16:26 test110Datadesk.bmp
文件 196664 2013-12-18 16:00 test110Datadoor.bmp
文件 196662 2000-05-18 02:04 test110DataEnvroll.bmp
文件 49206 2000-05-18 02:04 test110DataEnvwall.bmp
文件 196664 2013-12-16 15:44 test110Datafloor.bmp
文件 196664 2013-12-19 20:29 test110Datalaptop-sides.bmp
文件 196664 2013-12-19 20:29 test110Datalaptop.bmp
文件 196664 2013-12-20 16:10 test110Datalblackboard.bmp
文件 196664 2013-12-20 15:19 test110Dataprojector-sides.bmp
文件 21224 2013-12-20 15:21 test110Dataprojector.bmp
文件 196664 2013-12-20 16:10 test110Data
blackboard.bmp
..A.SH. 5632 2006-08-04 03:24 test110DataThumbs.db
文件 196664 2013-12-19 21:06 test110Datavoice box.bmp
文件 196664 2013-12-16 13:21 test110Datawall.bmp
文件 196664 2013-12-16 15:54 test110Datawindow.bmp
文件 1592 2013-12-18 14:07 test110DataWorld.txt
文件 196664 2013-12-20 15:12 test110Datazhuzi.bmp
文件 59136 2018-12-18 19:49 test110Debugadsf.obj
文件 644 2018-12-18 19:49 test110Debugcl.command.1.tlog
文件 14462 2018-12-18 19:49 test110DebugCL.read.1.tlog
文件 270 2018-12-18 19:49 test110DebugCL.write.1.tlog
文件 196664 2013-12-19 20:07 test110DebugDataair-sides.bmp
文件 196664 2013-12-19 20:04 test110DebugDataair.bmp
............此处省略90个文件信息
/* 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 test110adsf.cpp
文件 196664 2013-12-19 20:07 test110Dataair-sides.bmp
文件 196664 2013-12-19 20:04 test110Dataair.bmp
文件 49206 2000-04-27 21:51 test110DataBall.bmp
文件 196664 2013-12-19 21:48 test110Datalackboard-sides.bmp
文件 196664 2013-12-19 21:42 test110Datalackboard.bmp
文件 196664 2013-12-18 15:49 test110Dataceiling.bmp
文件 195896 2013-12-18 16:26 test110Datadesk.bmp
文件 196664 2013-12-18 16:00 test110Datadoor.bmp
文件 196662 2000-05-18 02:04 test110DataEnvroll.bmp
文件 49206 2000-05-18 02:04 test110DataEnvwall.bmp
文件 196664 2013-12-16 15:44 test110Datafloor.bmp
文件 196664 2013-12-19 20:29 test110Datalaptop-sides.bmp
文件 196664 2013-12-19 20:29 test110Datalaptop.bmp
文件 196664 2013-12-20 16:10 test110Datalblackboard.bmp
文件 196664 2013-12-20 15:19 test110Dataprojector-sides.bmp
文件 21224 2013-12-20 15:21 test110Dataprojector.bmp
文件 196664 2013-12-20 16:10 test110Data
blackboard.bmp
..A.SH. 5632 2006-08-04 03:24 test110DataThumbs.db
文件 196664 2013-12-19 21:06 test110Datavoice box.bmp
文件 196664 2013-12-16 13:21 test110Datawall.bmp
文件 196664 2013-12-16 15:54 test110Datawindow.bmp
文件 1592 2013-12-18 14:07 test110DataWorld.txt
文件 196664 2013-12-20 15:12 test110Datazhuzi.bmp
文件 59136 2018-12-18 19:49 test110Debugadsf.obj
文件 644 2018-12-18 19:49 test110Debugcl.command.1.tlog
文件 14462 2018-12-18 19:49 test110DebugCL.read.1.tlog
文件 270 2018-12-18 19:49 test110DebugCL.write.1.tlog
文件 196664 2013-12-19 20:07 test110DebugDataair-sides.bmp
文件 196664 2013-12-19 20:04 test110DebugDataair.bmp
............此处省略90个文件信息
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。
评论列表(条)