资源简介
本人用opengl画的摩天轮源码,很菜。希望能有帮助。用VC2008编译的。库文件用的是前边上传的那个。
按键有pagedown,pageup,z,x,c,空格和方向键。
代码片段和文件信息
/*
* This Code Was Created By Jeff Molofee 2000
* A HUGE Thanks To Fredric Echols For Cleaning Up
* And Optimizing This Code Making It More Flexible!
* If You‘ve Found This Code Useful Please Let Me Know.
* Visit My Site At nehe.gamedev.net
*/
#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
#include
#include
//
#define PI 3.1415926529//1.雾效出不来2.光照不明显
//
HDC hDC=NULL; // Private GDI Device Context
HGLRC hRC=NULL; // Permanent Rendering Context
HWND hWnd=NULL; // Holds Our Window Handle
HINSTANCE hInstance; // 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
//视角
GLfloat xrotyrotzrot;
GLfloat zdir;
GLuint part1part2;
//end视角
//纹理
GLuint texture[1]; // Storage For One Texture ( NEW )
static GLfloat boxcolor[3][4]=
{
{1.0f0.0f1.0f0.5f}{0.0f1.0f0.0f0.5f}{0.0f1.0f1.0f0.5f}
};
//end纹理
//光照
GLfloat LightAmbient[]= { 0.5f 0.5f 0.5f 1.0f }; // 环境光参数
GLfloat LightDiffuse[]= { 1.0f 1.0f 1.0f 1.0f }; // 漫射光参数
GLfloat LightPosition[]= { 0.0f 0.0f 2.0f 1.0f }; // 光源位置
//end光照
//雾效
//GLuint fogMode[]= { GL_EXP GL_EXP2 GL_LINEAR }; // 雾气的模式
//GLfloat fogColor[4]= {0.5f 0.5f 0.5f 1.0f}; // 雾的颜色设为白色
//end雾效
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) // 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
}
int LoadGLTextures() //
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 65536 2009-04-30 19:31 Ferris Wheel2\Debug\Ferris Wheel.exe
文件 683164 2009-04-30 19:31 Ferris Wheel2\Debug\Ferris Wheel.ilk
文件 551936 2009-04-30 19:31 Ferris Wheel2\Debug\Ferris Wheel.pdb
文件 196664 2000-03-06 02:10 Ferris Wheel2\Ferris Wheel\Data\NeHe.bmp
文件 66616 1999-12-05 00:12 Ferris Wheel2\Ferris Wheel\Data\Tim.bmp
文件 4804 2009-05-08 19:42 Ferris Wheel2\Ferris Wheel\Debug\BuildLog.htm
文件 621 2009-04-30 19:31 Ferris Wheel2\Ferris Wheel\Debug\Ferris Wheel.exe.intermediate.manifest
文件 68639 2009-04-30 19:31 Ferris Wheel2\Ferris Wheel\Debug\Ferris Wheel.obj
文件 25600 2009-05-06 18:55 Ferris Wheel2\Ferris Wheel\Debug\Ferris Wheel.pdb
文件 65 2009-04-30 19:31 Ferris Wheel2\Ferris Wheel\Debug\mt.dep
文件 379904 2009-04-30 19:31 Ferris Wheel2\Ferris Wheel\Debug\vc90.idb
文件 126976 2009-04-30 19:31 Ferris Wheel2\Ferris Wheel\Debug\vc90.pdb
文件 23704 2009-04-30 19:31 Ferris Wheel2\Ferris Wheel\Ferris Wheel.cpp
文件 3475 2009-05-06 18:55 Ferris Wheel2\Ferris Wheel\Ferris Wheel.dsp
文件 549 2009-05-06 18:56 Ferris Wheel2\Ferris Wheel\Ferris Wheel.dsw
文件 3320832 2009-05-08 19:42 Ferris Wheel2\Ferris Wheel\Ferris Wheel.ncb
文件 48640 2009-05-06 18:56 Ferris Wheel2\Ferris Wheel\Ferris Wheel.opt
文件 5074 2009-05-06 18:55 Ferris Wheel2\Ferris Wheel\Ferris Wheel.plg
文件 894 2009-05-08 19:39 Ferris Wheel2\Ferris Wheel\Ferris Wheel.sln
..A..H. 8192 2009-05-08 19:42 Ferris Wheel2\Ferris Wheel\Ferris Wheel.suo
文件 3762 2009-04-21 16:06 Ferris Wheel2\Ferris Wheel\Ferris Wheel.vcproj
文件 1411 2009-05-18 22:22 Ferris Wheel2\Ferris Wheel\Ferris Wheel.vcproj.Ivan-PC.Ivan.user
文件 1936384 2009-05-18 22:23 Ferris Wheel2\Ferris Wheel.ncb
文件 907 2009-04-21 16:02 Ferris Wheel2\Ferris Wheel.sln
..A..H. 15872 2009-05-18 22:23 Ferris Wheel2\Ferris Wheel.suo
目录 0 2010-08-22 22:43 Ferris Wheel2\Ferris Wheel\Data
目录 0 2010-08-22 22:43 Ferris Wheel2\Ferris Wheel\Debug
目录 0 2010-08-22 22:43 Ferris Wheel2\Debug
目录 0 2010-08-22 22:43 Ferris Wheel2\Ferris Wheel
目录 0 2010-08-22 22:43 Ferris Wheel2
............此处省略3个文件信息
- 上一篇:超详细MIT线性代数公开课笔记(上中下)
- 下一篇:德卡D8开发工具
相关资源
- APS学生选课系统完整源码
- openlava-4.0.tar.gz 源码安装包
- 最新仿icloud官方源码苹果官网源码带
- 阮一峰es6教程文档源码
- 网吧管理系统源码+论文
- OpenGL3.3官方文档
- 防qusf发布站整套源码
- Struts logic标签及增删改查
- HP加易语言数据库,全源码制作的网络
- coap源码CSharp
- directx 3D 坦克大战 源码
- openswan的Pluto源码分析以及linux的IPse
- s_des8位加密解密算法实现源码+详细注
- 10分钟临时邮箱源码-bccto
- 详细且最新的Grep源码程序
- iOS版CHM阅读器源码
- PCA图像融合源码
- 碰撞检测毕业论文
- 瑞萨RL78G13_嵌入式系统原理及应用实验
- 安卓蓝牙串口源码
- 新树洞表白源码
- 泰坦尼克号.zip
- vrml车模型
- JXLS 2.4.0 官方源码
- 官方 uCOS-III 源码
- 学生机房上机管理源码.rar
- 车辆调度管理系统源码.rar
- OpenGL库文件完整版
- 从贝叶斯方法谈到贝叶斯网络
- source code for Computer Graphics: Programming
评论
共有 条评论