资源简介
这是一个用opengl做的非常简单的直升飞机游戏。它可以向左右转和向前飞,直升机必须落在着陆区,否则就会爆炸!

代码片段和文件信息
#include “StdAfx.h“
#include “Environment.h“
#include
using namespace std;
Environment::Environment(void){}
Environment::~Environment(void){}
void Environment::Draw(void)
{
int i=42;
float x_coy_coz_co;
int angle;
x_co=0.0f;
y_co=0.0f;
z_co=0.0f;
angle =0;
x_co=-heli.getX();
y_co=-heli.getY();
z_co=-heli.getZ();
angle=heli.getAngle();
stringstream xyza;
glTranslatef(0.0f0.01f0);
glTranslatef(x_coy_coz_co);
if(x_co<= 0){x_co=-x_co;}
if(y_co<= 0){y_co=-y_co;}
if(z_co<= 0){z_co=-z_co;}
x << “X : “ << x_co;
text(x130);
y << “Y : “ << y_co;
text(y100);
z << “Z : “ << z_co;
text(z70);
a <<“Angle : “ << angle;
text(a40);
glPushMatrix();
landingArea();
ground();
sky();
glPopMatrix();
}
void Environment::ground(void)
{
float r=40;
glPushMatrix();
glTranslatef(0.0f0.0f0.45f);
glColor3f(0.427f0.886f0.0f);
glBegin(GL_QUADS);
glVertex3f(r0r);
glVertex3f(r0-r);
glVertex3f(-r0-r);
glVertex3f(-r0r);
glEnd();
glPopMatrix();
}
void Environment::sky(void)
{
float width=40.0f;
float height=40.0f;
glPushMatrix();
glColor3f(0.0f0.5176f1.0f);
glBegin(GL_QUADS);
glVertex3f(-widthheightheight);
glVertex3f(-width-heightheight);
glVertex3f(-width-height-height);
glVertex3f(-widthheight-height);
glVertex3f(widthheightheight);
glVertex3f(width-heightheight);
glVertex3f(width-height-height);
glVertex3f(widthheight-height);
glVertex3f(widthheightheight);
glVertex3f(width-heightheight);
glVertex3f(-width-heightheight);
glVertex3f(-widthheightheight);
glVertex3f(widthheight-height);
glVertex3f(width-height-height);
glVertex3f(-width-height-height);
glVertex3f(-widthheight-height);
glVertex3f(widthheightheight);
glVertex3f(widthheight-height);
glVertex3f(-widthheight-height);
glVertex3f(-widthheightheight);
glVertex3f(width-heightheight);
glVertex3f(width-height-height);
glVertex3f(-width-height-height);
glVertex3f(-width-heightheight);
glEnd();
glPopMatrix();
}
void Environment::landingArea(void)
{
float r=3;
glPushMatrix();
glColor3f(1.0f1.0f0.0f);
glTranslatef(0.0f0.025f0.45f);
glBegin(GL_QUADS);
glVertex3f(r0r);
glVertex3f(r0-r);
glVertex3f(-r0-r);
glVertex3f(-r0r);
glEnd();
glRotated(90010);
glPushMatrix();
glColor3f(1.0f1.0f1.0f);
glTranslatef(1.0f0.0f0.0f);
glBegin(GL_QUADS);
glVertex3f(0.2502);
glVertex3f(0.250-2);
glVertex3f(-0.250-2);
glVertex3f(-0.2502);
glEnd();
glPopMatrix();
glPushMatrix();
glColor3f(1.0f1.0f1.0f);
glTranslatef(-1.0f0.0f0.0f);
glBegin(GL_QUADS);
glVertex3f(0.2502);
glVertex3f(0.250-2);
glVertex3f(-0.250-2);
glVertex3f(-0.2502);
glEnd();
glPopMatrix();
glBegin(GL_QUADS);
glVertex3f(1.0f0.0f0.25f);
glVertex3f(1.0f0-0.25f);
glVertex3f(-1.0f0-0.25f);
glV
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 8088576 2010-01-13 14:13 Project\3DOpenGLStarter.ncb
....... 895 2009-11-10 14:50 Project\3DOpenGLStarter.sln
....... 886 2007-06-07 13:43 Project\3DOpenGLStarter.sln.old
..A..H. 118272 2010-01-13 14:12 Project\3DOpenGLStarter.suo
.....H. 107520 2008-11-12 15:17 Project\3DOpenGLStarter.suo.old
....... 142848 2010-01-12 15:03 Project\debug\3DOpenGLStarter.exe
....... 762780 2010-01-12 15:03 Project\debug\3DOpenGLStarter.ilk
....... 1182720 2010-01-12 15:03 Project\debug\3DOpenGLStarter.pdb
....... 2373 2009-11-10 14:50 Project\UpgradeLog.xm
....... 663 2010-01-05 10:54 Project\win32_1\Debug\3DOpenGLStarter.exe.em
....... 728 2010-01-05 10:54 Project\win32_1\Debug\3DOpenGLStarter.exe.em
....... 621 2010-01-12 15:03 Project\win32_1\Debug\3DOpenGLStarter.exe.intermediate.manifest
....... 13107200 2010-01-05 16:16 Project\win32_1\Debug\3DOpenGLStarter.pch
....... 7556 2010-01-12 15:03 Project\win32_1\Debug\BuildLog.htm
....... 44874 2010-01-12 15:03 Project\win32_1\Debug\Environment.obj
....... 13921 2010-01-12 14:57 Project\win32_1\Debug\Game.obj
....... 86715 2010-01-12 14:51 Project\win32_1\Debug\Helicopter.obj
....... 2048 2010-01-05 16:15 Project\win32_1\Debug\HelicopterProject.exe.em
....... 566102 2010-01-05 16:15 Project\win32_1\Debug\HelicopterProject.pch
....... 20198 2010-01-12 14:57 Project\win32_1\Debug\main.obj
....... 69 2010-01-12 15:03 Project\win32_1\Debug\mt.dep
....... 15806 2010-01-12 14:57 Project\win32_1\Debug\opengl.obj
....... 400 2010-01-05 16:14 Project\win32_1\Debug\RSP00040833241004.rsp
....... 131381 2010-01-05 16:16 Project\win32_1\Debug\stdafx.obj
....... 12144 2010-01-05 16:17 Project\win32_1\Debug\Texture.obj
....... 7156 2010-01-05 16:17 Project\win32_1\Debug\Timer.obj
....... 461824 2010-01-12 15:03 Project\win32_1\Debug\vc90.idb
....... 569344 2010-01-12 15:03 Project\win32_1\Debug\vc90.pdb
....... 6045 2010-01-05 16:17 Project\win32_1\Debug\Vector.obj
....... 48216 2010-01-05 10:54 Project\win32_1\Debug\win32_1.res
............此处省略43个文件信息
- 上一篇:ORL_BMP.zip
- 下一篇:PS作业 实验报告 11
相关资源
- OpenGL参考手册
- Qt Creator opengl实现四元数鼠标控制轨迹
- OpenGL文档,api大全,可直接查询函数
- opengl轮廓字体源代码
- MFC读三维模型obj文件
- 利用OpenGL写毛笔字算法
- MFC中OpenGL面和体的绘制以及动画效果
- 基于OPENGL的光线跟踪源代码368758
- VC 实现三维旋转(源码)
- 自编用openGL实现3D分形树,分形山
- OpenGL球形贴图自旋程序
- OpenGL导入贴图的Texture类
- 计算机图形学(openGL)代码
- 用OpenGL开发的机械臂运动仿真程序(
- OpenGL-3D坦克模拟
- OPENGL实现世界上最小的3D游戏
- VS2012OpenGL配置所需要的全部libdllh文件
- 基于OpenGL的仿蝗虫机器人三维动态仿
- 图形学 - OpenGL实现3种三维茶壶显示源
- opengl程序-会跳舞的骷髅
- opengl实现三维网格光顺Laplacian算法
- opengl——爆炸
- OpenGL三维地形建模
- opengl游戏编程徐明亮版(含源码)
- opengl完美天空盒
- 3D绘图程序设计:使用Direct3D 10/9和Ope
- OpenGL绘制可运动自行车源程序.zip
- OpenGL实现飘动效果
- opengl室内场景的绘制,包括碰撞检测
- OpenGL场景漫游
评论
共有 条评论