资源简介
99273910opengl-3d-car.zip

代码片段和文件信息
#include “Bitmap24.h“
#include “Car.h“
#include
using namespace std;
Bitmap24 *pBitmap24 (0);
Car *pCar (0);
const GLfloat X = 1690.0f;
const GLfloat Z = 1280.0f;
const GLfloat Y = -31.6f;
void Init()
{
glShadeModel( GL_SMOOTH );
glClearColor( 0.0 0.0 0.0 0.0);
glClearDepth( 1.0 );
GLfloat Ambient[4] = { 1.0 1.0 1.0 1.0 };
GLfloat Diffuse[4] = { 0.7 0.7 0.7 1.0 };
GLfloat Position[4] = { 0.0 0.0 -1.0 0.0 };
GLfloat GlobalLight[4] = { 0.1 0.1 0.1 1.0 };
GLfloat shininess[] = {100.0f};
glLightfv( GL_LIGHT0 GL_AMBIENT Ambient );
glLightfv( GL_LIGHT0 GL_DIFFUSE Diffuse );
glLightfv( GL_LIGHT0 GL_POSITION Position );
glLightfv( GL_LIGHT0 GL_SHININESS shininess );
glLightModelfv( GL_LIGHT_MODEL_AMBIENT GlobalLight );
glColorMaterial( GL_FRONT GL_AMBIENT_AND_DIFFUSE);
glBlendFunc( GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA );
glEnable( GL_LIGHTING );
glEnable( GL_LIGHT0 );
glEnable( GL_COLOR_MATERIAL );
glEnable( GL_DEPTH_TEST );
glEnable( GL_CULL_FACE );
}
void redisplay()
{
pCar->redisplay();
glutPostRedisplay();
}
void Display()
{
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glPushMatrix();
gluLookAt(pCar->getDisplacementX()+600 500 pCar->getDisplacementY()-100
pCar->getDisplacementX() 0 pCar->getDisplacementY()
0 1.0 0);
glPushMatrix();
glEnable(GL_TEXTURE_2D);
glTexEnvf(GL_TEXTURE_ENV GL_TEXTURE_ENV_MODE GL_DECAL);
glBindTexture(GL_TEXTURE_2D pBitmap24->getTexture());
glBegin(GL_QUADS);
glTexCoord2f(0.0 0.0); glVertex3f(X Y -Z);
glTexCoord2f(1.0 0.0); glVertex3f(-X Y -Z);
glTexCoord2f(1.0 1.0); glVertex3f(-X Y Z);
glTexCoord2f(0.0 1.0); glVertex3f(X Y Z);
glEnd();
glDisable(GL_TEXTURE_2D);
glPopMatrix();
pCar->draw();
glPopMatrix();
glFlush();
glutSwapBuffers();
}
void Reshape( int width int high )
{
if ( high == 0 )high = 1;
glViewport( 0 0 static_cast< GLsizei >( width ) static_cast< GLsizei >( high ) );
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
gluPerspective( 45.0 static_cast< GLdouble >( width ) / static_cast< GLdouble >( high ) 0.1 10000.0 );
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
//gluLookAt(0 1800 -1200 0 0 0 0 1.0 0);
}
void keyboard(const unsigned char key const int x const int y)
{
switch(key)
{
case ‘W‘:case ‘w‘:
pCar->accelerate(0.1f);
break;
case ‘S‘:case ‘s‘:
pCar->decelerate(0.1f);
break;
case ‘D‘:case ‘d‘:
pCar->turnRight(30.0f);
break;
case ‘A‘:case ‘a‘:
pCar->turnLeft(30.0f);
break;
case ‘ ‘:
pCar->brake();
break;
default:
return;
}
glutPostRedisplay();
}
int main( int argc char* argv[] )
try
{
pCar = new Car(“Car.3DS“);
pBitmap24 = new Bitmap24(“paodao1.bmp“);
glutInit( &argc argv );
glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH );
glutInitWindowSize( 800 600 );
glutInitWindowPosition( 10
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2012-07-17 12:44 opengl-3d car\
目录 0 2012-07-17 12:44 opengl-3d car\JustDoIt1\
目录 0 2012-07-17 12:45 opengl-3d car\JustDoIt1\JustDoIt\
文件 864 2009-08-02 11:42 opengl-3d car\JustDoIt1\JustDoIt\3dsId.h
文件 1890 2009-08-04 17:30 opengl-3d car\JustDoIt1\JustDoIt\Bitmap1.h
文件 2038 2009-08-04 17:37 opengl-3d car\JustDoIt1\JustDoIt\Bitmap24.h
文件 1394703 2009-07-30 20:03 opengl-3d car\JustDoIt1\JustDoIt\Car.3DS
文件 4026 2009-08-16 19:55 opengl-3d car\JustDoIt1\JustDoIt\Car.h
目录 0 2012-07-17 12:44 opengl-3d car\JustDoIt1\JustDoIt\Debug\
文件 5408 2009-10-19 11:10 opengl-3d car\JustDoIt1\JustDoIt\Debug\BuildLog.htm
文件 1394703 2009-07-30 20:03 opengl-3d car\JustDoIt1\JustDoIt\Debug\Car.3DS
文件 145 2009-10-19 11:10 opengl-3d car\JustDoIt1\JustDoIt\Debug\JustDoIt.exe.intermediate.manifest
文件 289973 2009-08-03 21:23 opengl-3d car\JustDoIt1\JustDoIt\Debug\MyLoader.obj
文件 268682 2009-10-19 11:10 opengl-3d car\JustDoIt1\JustDoIt\Debug\main.obj
文件 67 2009-10-19 11:10 opengl-3d car\JustDoIt1\JustDoIt\Debug\mt.dep
文件 175104 2009-10-19 11:10 opengl-3d car\JustDoIt1\JustDoIt\Debug\vc80.idb
文件 453 2009-08-01 11:22 opengl-3d car\JustDoIt1\JustDoIt\DrawModel.h
文件 303104 2009-10-19 11:10 opengl-3d car\JustDoIt1\JustDoIt\JustDoIt.exe
文件 43520 2009-07-30 17:58 opengl-3d car\JustDoIt1\JustDoIt\JustDoIt.opt
文件 3528 2009-08-04 17:39 opengl-3d car\JustDoIt1\JustDoIt\JustDoIt.vcproj
文件 1427 2009-08-02 15:55 opengl-3d car\JustDoIt1\JustDoIt\JustDoIt.vcproj.WWW-46D0B3DC880.Administrator.user
文件 1427 2009-08-16 19:57 opengl-3d car\JustDoIt1\JustDoIt\JustDoIt.vcproj.WWW-71F7C097B45.Administrator.user
文件 1427 2009-11-11 20:17 opengl-3d car\JustDoIt1\JustDoIt\JustDoIt.vcproj.WWW-8F6AC3560E8.Administrator.user
文件 9343 2009-08-03 19:21 opengl-3d car\JustDoIt1\JustDoIt\MyLoader.cpp
文件 1467 2009-08-02 11:05 opengl-3d car\JustDoIt1\JustDoIt\MyLoader.h
文件 866 2009-08-03 19:13 opengl-3d car\JustDoIt1\JustDoIt\MyModel.h
文件 237568 2001-11-08 02:27 opengl-3d car\JustDoIt1\JustDoIt\glut32.dll
文件 3399 2009-08-16 19:57 opengl-3d car\JustDoIt1\JustDoIt\main.cpp
文件 60062 2009-08-04 17:09 opengl-3d car\JustDoIt1\JustDoIt\paodao.bmp
文件 1440054 2009-08-04 17:38 opengl-3d car\JustDoIt1\JustDoIt\paodao1.bmp
文件 1887232 2009-11-11 20:17 opengl-3d car\JustDoIt1\JustDoIt.ncb
............此处省略8个文件信息
- 上一篇:文艺青年搜索引擎V2.zip
- 下一篇:同步专家网吧版破解.rar
相关资源
- vspd7.2.308.zip
- 价值2k的H漫画小说系统
- Pythonamp;课堂amp;笔记(高淇amp;400;集第
- ddos压力测试工具99657
- UML建模大全
- 开源1A锂电池充电板TP4056原理图+PCB
- m1卡 ic卡可选择扇区初始化加密软件
- TSCC.exe
- FTP课程设计(服务端+客户端)
- 计算机图形学 边填充算法实现代码
- 电力系统潮流计算程序集合
- oracle数据迁移项目实施方案
- Web Api 通过文件流 文件到本地
- Visio图标-最新最全的网络通信图标库
- Spire API文档
- OpenGL参考手册
- Python中Numpy库最新教程
- SPD博士V5.3.exe
- 直流无刷电机方波驱动 stm32 例程代码
- layui后台管理模板
- 仿知乎界面小程序源代码
- 云平台-阿里云详细介绍
- photoshop经典1000例
- scratch垃圾分类源码(最终版本).sb
- IAR ARM 7.8破解
- TI CCS V5.4 安装步骤及破解文件
- 松下plc FP-XH的驱动
- 局域网硬件信息收集工具
- 加快Windows XP操作系统开机速度
- 联想启天M4350 BIOS升级文件
评论
共有 条评论