资源简介
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版).课后答案
相关资源
- OpenGL高级编程与可视化系统开发-系统
- opengl读取.obj三维模型,arcball实现鼠标
- 后台开发核心技术与应用实践高清P
-
AutoCAD ob
jectARX(VC)开发基础与教程 - OpenGL超级宝典 第5版 中文版 完整书签
- [免费PDF高清]2018年最新编程珠玑(第
- Linux多线程服务端编程 - 陈硕高清完整
- Computer Graphics with OpenGL 4th edition 高清
- vs2010串口发送接收程序
- OpenGL 4.0 Shading Language Cookbook及完整源
- Boost程序库探秘.pdf
- Computer_Graphics_with_OpenGL_4th_ed.pdf
- [免费]GB28181信令交互代码.rar
- opengl读入obj文件并实现平移旋转贴图
- 火狐NP插件开发
- vc运行库修复工具
- opencv4.0.1+contrib+vs2017编译x64x86完全版本
- OGL模型加载
- 推箱子及其地图编辑器
- 精通Windows API-函数、接口、编程(源
- OPENGL 经典案例 整套
- 获取屏幕上任意一点的RGB值
- 李建忠_设计模式源码和课件.rar
- opengl包含16个鼠标控制点的Bezier曲面
- qt下opengl的三维视角转换算法
- Linux窗口程序设计-Qt4精彩分析 part02
- 蓝桥杯历年试题附完整测试数据和题
- 双目标定后的三维重建
- OpenGL鱼眼镜头特效的视频播放器 基于
- opengl实现bezier曲面的纹理贴图、鼠标
评论
共有 条评论