资源简介
自己为图形学课程写的大作业,是在vc6.0的环境下用OPENGL实现一个简易的保龄球小程序。

代码片段和文件信息
//最后修改2010-07-10
//ye020510625@126.com
#include
#include
#include
#include
#include
#include
#include
#include
#pragma comment( lib “winmm.lib“)
#pragma comment( lib “opengl32.lib“) // OpenGL32连接库
#pragma comment( lib “glu32.lib“) // GLu32连接库
#pragma comment( lib “glaux.lib“) // GLaux连接库
float x=0.0;
float distance = 2.0;
float angle = 0.0;
float speed = 2.0;
float ye=0.0fall=-0.02;
float rate =1.0;
float choose1=0.0 alpha=0.0;
int flag =0i=0status=0delay=0direction=1 flag_out=0;
int down_flag[10]={0 0 0 0 0 0 0 0 0 0};
float down_angle_dir[10] down_angle_step[10]={0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0} down_bottom_add[10];
float random[10];
struct point
{
float xz;
};
struct point bottle_position[10]={{0.0-17.14}{-0.13-17.365}{0.13-17.365}{-0.26-17.59}{0.0-17.59}{0.26-17.59}{-0.39-17.815}{-0.13-17.815}{0.13-17.815}{0.39-17.815}};
UINT g_cactus[16];
bool LoadT8(char *filename GLuint &texture)
{ AUX_RGBImageRec *pImage = NULL;
pImage = auxDIBImageLoad(filename);
if(pImage == NULL) return false;
glGenTextures(1 &texture);
glBindTexture (GL_TEXTURE_2Dtexture);
gluBuild2DMipmaps(GL_TEXTURE_2D4 pImage->sizeX
pImage->sizeYGL_RGB GL_UNSIGNED_BYTEpImage->data);
free(pImage->data);
free(pImage);
return true;
}
void my_random()
{
int ni;
srand(time(NULL));
for(i=0;i<10;i++)
{
n=rand()%2000;
random[i]=(float)(n-1000)/(float)100.0;
printf(“random n = %f \n“random[i]);
}
}
void circle(float radious)
{
float step =0.1;
float anglexy;
glBegin(GL_POLYGON);
for(angle = 0.0 ; angle <=(2.0 * 3.14159) ; angle +=step )
{
x=radious * sin(angle);
y=radious * cos(angle);
glVertex3f(xy0.0);
}
glEnd();
}
void bottle()
{
static GLfloat whiteAmbient[]={0.1 0.1 0.3 1.0};
static GLfloat redAmbient[]={1.0 0.05 0.05 1.0};
static GLfloat greenAmbient[]={0.1 0.3 0.1 1.0};
static GLfloat blueAmbient[]={0.1 0.1 0.3 1.0};
static GLfloat whiteDiffuse[]={1.0 1.0 1.0 1.0};
static GLfloat redDiffuse[]={1.0 0.0 0.0 1.0};
static GLfloat greenDiffuse[]={0.0 1.0 0.0 1.0};
static GLfloat blueDiffuse[]={0.0 0.0 1.0 1.0};
static GLfloat whiteSpecular[]={1.0 1.0 1.0 1.0};
static GLfloat redSpecular[]={1.0 0.0 0.0 1.0};
static GLfloat greenSpecular[]={0.0 1.0 0.0 1.0};
static GLfloat blueSpecular[]={0.0 0.0 1.0 1.0};
glPushMatrix();
glPushAttrib(GL_LIGHTING_BIT);
glMaterialfv(GL_FRONT_AND_BACK GL_AMBIENT whiteAmbient);
glMaterialfv(GL_FRONT_AND_BACK GL_DIFFUSE whiteDiffuse);
glMaterialfv(GL_FRONT_AND_BACK GL_SPECULAR whiteSpecular);
//auxSolidCylinder(0.06 0.1);
glRotatef(-90 1.0 0.0 0.0);//测试
circle(0.05);
glRotatef(90 1.0 0.0 0.0);//测试
glTranslatef(0.0 -0.9 0.0);
auxSolidCylinder(0.05 0
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 27852 2010-07-10 22:27 OpenGL小程序\work.cpp
文件 282738 2010-07-10 22:25 OpenGL小程序\work.exe
文件 960054 2010-06-22 22:46 OpenGL小程序\floor.bmp
文件 1880118 2010-06-23 15:58 OpenGL小程序\ceiling.bmp
文件 13 2010-07-10 22:28 OpenGL小程序\readme.txt
目录 0 2010-07-10 22:27 OpenGL小程序
----------- --------- ---------- ----- ----
3150775 6
相关资源
- C语言课程设计
- c语言电子商务系统
- 安卓c语言开发SDL2+opengles
- 交互式计算机图形学 第六版 OpenGL源代
- VC++基于OpenGL模拟的一个3维空间模型
- 宠物管理系统课程设计(源码+数据库
- c语言课程设计:客房登记系统源码
- 8位竞赛抢答器的课程设计报告.docx
- opengl绘制汽车.cpp
- VC++MFC课程设计的学生成绩管理系统
- C++实现21点游戏
- c++课程设计学生管理系统浙工大源码
- 课程设计: MFC 学生信息管理系统
- dsp课程设计——语音加密.zip
- 广东工业大学数据结构课程设计航空
- 数据结构课程设计扑克牌排序
- c++课程设计宾馆客房管理系统
- c语言课程设计-职工信息管理系统-单
- 飞机票订购系统C语言课程设计报告全
- c++ 课程设计_中国象棋
- 编译原理课程设计-C语言子集编译器
- opengl实现水流效果sph
- 操作系统课程设计(银行家算法)附
- 用c写的航空订票系统 航班信息改变
- 信息论课程设计——LZW编码
- 人员管理系统 c语言源码 课程设计专
- MFC课程设计学生管理系统
- opengl源代码,全是精华!
- vc++课程设计 让计算机来猜测用户“暗
- OpenGL迷宫山东大学图形学实验三
评论
共有 条评论