资源简介
本人用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开发工具
相关资源
- E4A无障碍跨程序操作类库(带源码、
- 设备管理系统源码
- 安卓wifi直连app源码
- 我的世界源码(易语言版)
- labview编程软件滤波器以及编写程序设
- 我的界面(visual foxpro)源码
- 易语言:一键cf基址源码
- OpenGL参考手册
- The Secret Path 3D 3D魔方迷宫[源码][scra
- scratch垃圾分类源码(最终版本).sb
- 安卓QQ6.71协议源码易语言,qq协议源码
- 编译原理实验工具及参考源码(lex&
- E盾偷后台工具源码
- UNIX/LINUX编程实践教程的源码
- 十以内加减法练习 powerbuilder源码
- 农场开发项目
- OCR源码
- PLC上位机编程软件
- 用foobar2000听google音乐[更新一下]
- 学生信息管理系统源码
- 用VC 编写的仿QQ聊天室程序源代码
- 毕业论文之温度传感器DS18B20(源码
- 可自定义导航网站源码
- 栅栏填充算法源码(VC)
- msp430F149操作红外接收模块源码
- [免费]图像识别c 源码
- 周易排盘源码
- RSA算法源码
- Qt Creator opengl实现四元数鼠标控制轨迹
- 一个人脸识别程序源码
评论
共有 条评论