资源简介
这是一个用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完美天空盒
- 3D绘图程序设计:使用Direct3D 10/9和Ope
- OpenGL绘制可运动自行车源程序.zip
- OpenGL实现飘动效果
- opengl室内场景的绘制,包括碰撞检测
- OpenGL场景漫游
- 用opengl实现的太阳系模型
- OpenGL 3D贪吃蛇程序,很小
- OpenGL爆炸碎片化效果 源码
- OpenGL三茶壶三光源光源绕着茶壶旋转
- 10个OpenGL的源码
- vc写的一个游戏里面三维场景漫游
- OpenGL实现的简单游戏引擎
- OpenGL游戏程序设计源码
- glew最新版本glew1.11.0
- OpenGL 火箭
- 天空盒和地面
- 三维场景漫游.zip
- openGL实现的正方体六面贴图
- opengl简易翻牌游戏
- Qt Openglwidget 显示图片纹理贴图
- OpenGL实现三维物体旋转,缩放
- MD5GPU.rar
- OpenGL立方体在世界坐标系中缩放_旋转
- OpenGL ES 2.0 编程指南 中文版.pdf
- openGL实现三维点云显示
- opengl写的趣味3D骰子
- 计算机图形学实验 opengl实现太阳系运
- opengl实现地球围绕太阳转动
- opnegl 太阳 月亮 地球 天体旋转
评论
共有 条评论