资源简介
OpenGL课的作业 实现了飞机动态射击

代码片段和文件信息
#include
#include
#include
#include
#include
#define GLUT_DISABLE_ATEXIT_HACK
#include
#include
#include
#define _CRT_SECURE_NO_WARNINGS
#pragma comment (lib“glaux.lib“)
#pragma comment(lib“winmm.lib“)
#pragma comment(lib“OpenGL32.lib“)
#pragma comment(lib“glu32.lib“)
#pragma comment(lib“glAux.lib“)
#pragma comment(lib“gdi32.lib“)
#pragma comment(lib“kernel32.lib“)
#pragma comment(lib“user32.lib“)
#pragma comment(lib“Advapi32.lib“)
static float x =0 y =0 z = 0moving_x = 0;
void init(void)
{
glClearColor(0.00.00.00.0);
glClearDepth(1.0f);
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glShadeModel(GL_SMOOTH);
}
void display(void)
{
glPushMatrix();
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glTranslatef(00-4);
glRotatef(-900.01.00.0);
glRotatef(z0.00.01.0);
//螺旋桨
glPushMatrix();
glRotatef(z*80.00.01.0);
glColor3f(101);
auxSolidBox(1.60.30.05);
glColor3f(0.50.50);
glTranslatef(00-0.5);
auxSolidSphere(0.5);
glPopMatrix();
//机身
glColor3f(1.00.50);
glPushMatrix();
glTranslatef(00-2);
glRotatef(90100);
auxSolidCylinder(0.42.0);
glPopMatrix();
//机翼
glColor3f(0.51.00);
glPushMatrix();
glTranslatef(00-2);
auxSolidBox(80.050.7);
glColor3ub(250250210);
glTranslatef(20moving_x);
auxSolidBox(0.050.051);
glTranslatef(-40moving_x);
auxSolidBox(0.050.051);
glPopMatrix();
//机尾
glColor3f(0.51.00.5);
glPushMatrix();
glRotatef(-180100);
glTranslatef(003);
auxSolidCone(0.42);
glPopMatrix();
//尾翼
glColor3f(0.50.50);
glPushMatrix();
glTranslatef(00.4-4.5);
auxSolidBox(20.030.3);
auxSolidBox(0.030.50.2);
glPopMatrix();
glPopMatrix();
glutSwapBuffers();
z = z + 0.15;
if(moving_x >= 10)
{
moving_x = 0;
}
moving_x = moving_x + 0.1;
}
void reshape(int w int h)
{
glViewport(0 0 (GLsizei)w (GLsizei)h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(65.0 (GLfloat)w/(GLfloat)h 1.0 20.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0 0.0 -5.0);
}
int main(int argc char** argv)
{
glutInit(&argcargv);
glutInitDisplayMode(GLUT_RGB|GLUT_DOUBLE|GLUT_DEPTH);
glutInitWindowSize(1000 500);
glutInitWindowPosition(100 100);
glutCreateWindow(argv [0]);
init();
glutDisplayFunc(display);
glutIdleFunc(display);
glutReshapeFunc(reshape);
// glutKeyboardFunc(keyboard);
glutMainLoop();
return 0;
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2014-12-07 11:51 planmodel\
目录 0 2014-12-07 11:16 planmodel\Debug\
文件 64000 2014-12-07 11:51 planmodel\Debug\planmodel.exe
文件 688988 2014-12-07 11:51 planmodel\Debug\planmodel.ilk
文件 658432 2014-12-07 11:51 planmodel\Debug\planmodel.pdb
目录 0 2014-12-07 11:51 planmodel\planmodel\
文件 8072192 2014-12-07 11:51 planmodel\planmodel.ncb
文件 893 2014-12-07 10:21 planmodel\planmodel.sln
文件 8192 2014-12-07 11:51 planmodel\planmodel.suo
目录 0 2014-12-07 11:51 planmodel\planmodel\Debug\
文件 6856 2014-12-07 11:51 planmodel\planmodel\Debug\BuildLog.htm
文件 35933 2014-12-07 11:51 planmodel\planmodel\Debug\main.obj
文件 65 2014-12-07 11:51 planmodel\planmodel\Debug\mt.dep
文件 663 2014-12-07 10:32 planmodel\planmodel\Debug\planmodel.exe.em
文件 728 2014-12-07 10:32 planmodel\planmodel\Debug\planmodel.exe.em
文件 621 2014-12-07 11:51 planmodel\planmodel\Debug\planmodel.exe.intermediate.manifest
文件 355328 2014-12-07 11:51 planmodel\planmodel\Debug\vc90.idb
文件 110592 2014-12-07 11:51 planmodel\planmodel\Debug\vc90.pdb
文件 2682 2014-12-07 11:51 planmodel\planmodel\main.cpp
文件 4104 2014-12-07 10:29 planmodel\planmodel\planmodel.vcproj
文件 1411 2014-12-07 11:51 planmodel\planmodel\planmodel.vcproj.FOUR-PC.FOUR.user
文件 676 2014-12-07 09:57 planmodel\绘制飞机模型.txt
相关资源
- 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游戏
- Scratch 射击游戏.sb2
- VS2012OpenGL配置所需要的全部libdllh文件
- 基于OpenGL的仿蝗虫机器人三维动态仿
- 图形学 - OpenGL实现3种三维茶壶显示源
- opengl程序-会跳舞的骷髅
- opengl实现三维网格光顺Laplacian算法
- 微机课程设计_移动靶射击
- opengl——爆炸
- OpenGL三维地形建模
- opengl游戏编程徐明亮版(含源码)
- 用OPENGL画的一个简单的直升飞机
- opengl完美天空盒
- 3D绘图程序设计:使用Direct3D 10/9和Ope
- OpenGL绘制可运动自行车源程序.zip
评论
共有 条评论