资源简介
从.gl中读取信息,在OpenGL中绘制自行车的三维模型,并实现了自行车的运动和改变方向 放大缩小等

代码片段和文件信息
#include “stdafx.h“
#include
#include
#include
#include
#include
#include
#include “bicycle.h“
static int flag;
int angle = 0;
int pan = 0;
void init(){
GLfloat mat_specular[] = {1.01.01.01.0};
GLfloat mat_shininess[] = {50.0};
GLfloat light_position[] = {2.02.02.00.0};
GLfloat withe_ligth[] = {1.01.01.01.0};
GLfloat lmode_ambient[] = {0.10.10.11.0};
glClearColor(0.00.00.00.0);
glShadeModel(GL_SMOOTH);
// glMaterialfv(GL_FRONTGL_SPECULARmat_specular);
// glMaterialfv(GL_FRONTGL_SHININESSmat_shininess);
glLightfv(GL_LIGHT0GL_POSITIONlight_position);
glLightfv(GL_LIGHT0GL_DIFFUSEwithe_ligth);
glLightfv(GL_LIGHT0GL_SPECULARwithe_ligth);
glLightModelfv(GL_LIGHT_MODEL_AMBIENTlmode_ambient);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glEnable(GL_DEPTH_TEST);
flag = GL3DS_initialize_bicycle();
}
void dispaly(){
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
/*glutSolidSphere(1.03016);*/
glPushMatrix();
glScalef(0.10.10.1);
glCallList(flag);
glPopMatrix();
glFlush();
}
void reshape(int wint h){
// if (w>h)
// glViewport(00(GLsizei)h(GLsizei)h);
// else
// glViewport(00(GLsizei)w(GLsizei)w);
glViewport(00(GLsizei)w(GLsizei)h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
if (w<=h)
{
glOrtho(-1.51.5-1.5*(GLfloat)h/(GLfloat)w1.5*(GLfloat)h/(GLfloat)w-10.010.0);
}
else
glOrtho(-1.5*(GLfloat)h/(GLfloat)w1.5*(GLfloat)h/(GLfloat)w-1.51.5-10.010.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
//空闲处理函数
void myIdle()
{
angle =+ 20;
if (angle>=360)
angle = angle-360;
pan =+ 5;
glutPostRedisplay();
}
//处理键盘事件
void keyboard(unsigned char keyint x int y)
{
switch(key){
case ‘s‘:
glutIdleFunc(myIdle);
break;
case 27:
exit(0);
default:
break;
}
}
int main(int argcchar**argv)
{
glutInit(&argcargv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(900900);
glutInitWindowPosition(100100);
glutCreateWindow(argv[0]);
init();
glutDisplayFunc(dispaly);
glutKeyboardFunc(keyboard);
glutReshapeFunc(reshape);
//glutIdleFunc(myIdle);
glutMainLoop();
return 0;
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 2321 2012-11-10 11:31 opengl编写的自行车\code\bicycle\bicycle\3Dcar.cpp
文件 12413 2012-11-23 10:30 opengl编写的自行车\code\bicycle\bicycle\bicycle.cpp
文件 87296 2012-11-06 13:30 opengl编写的自行车\code\bicycle\bicycle\bicycle.gl
文件 73767 2012-11-23 10:30 opengl编写的自行车\code\bicycle\bicycle\bicycle.h
文件 4559 2012-11-10 14:17 opengl编写的自行车\code\bicycle\bicycle\bicycle.vcproj
文件 1409 2012-11-19 22:48 opengl编写的自行车\code\bicycle\bicycle\bicycle.vcproj.RAO-PC.liu.user
文件 5833 2012-11-23 10:13 opengl编写的自行车\code\bicycle\bicycle\bicycle.vcxproj
文件 1387 2012-11-23 10:13 opengl编写的自行车\code\bicycle\bicycle\bicycle.vcxproj.filters
文件 143 2012-11-23 10:13 opengl编写的自行车\code\bicycle\bicycle\bicycle.vcxproj.user
文件 1 2006-11-20 16:11 opengl编写的自行车\code\bicycle\bicycle\ClassDiagram1.cd
文件 663 2012-11-10 11:38 opengl编写的自行车\code\bicycle\bicycle\Debug\bicycle.exe.em
文件 728 2012-11-23 10:30 opengl编写的自行车\code\bicycle\bicycle\Debug\bicycle.exe.em
文件 381 2012-11-23 10:30 opengl编写的自行车\code\bicycle\bicycle\Debug\bicycle.exe.intermediate.manifest
文件 57 2012-11-23 10:30 opengl编写的自行车\code\bicycle\bicycle\Debug\bicycle.lastbuildstate
文件 2940 2012-11-23 10:30 opengl编写的自行车\code\bicycle\bicycle\Debug\bicycle.log
文件 135821 2012-11-23 10:30 opengl编写的自行车\code\bicycle\bicycle\Debug\bicycle.obj
文件 1179648 2012-11-23 10:30 opengl编写的自行车\code\bicycle\bicycle\Debug\bicycle.pch
文件 0 2012-11-23 10:30 opengl编写的自行车\code\bicycle\bicycle\Debug\bicycle.unsuccessfulbuild
文件 204 2012-11-23 10:30 opengl编写的自行车\code\bicycle\bicycle\Debug\bicycle_manifest.rc
文件 7034 2012-11-19 22:47 opengl编写的自行车\code\bicycle\bicycle\Debug\BuildLog.htm
文件 1442 2012-11-23 10:30 opengl编写的自行车\code\bicycle\bicycle\Debug\cl.command.1.tlog
文件 21258 2012-11-23 10:30 opengl编写的自行车\code\bicycle\bicycle\Debug\CL.read.1.tlog
文件 768 2012-11-23 10:30 opengl编写的自行车\code\bicycle\bicycle\Debug\CL.write.1.tlog
文件 2 2012-11-23 10:30 opengl编写的自行车\code\bicycle\bicycle\Debug\li
文件 2 2012-11-23 10:30 opengl编写的自行车\code\bicycle\bicycle\Debug\li
文件 2 2012-11-23 10:30 opengl编写的自行车\code\bicycle\bicycle\Debug\li
文件 2 2012-11-23 10:30 opengl编写的自行车\code\bicycle\bicycle\Debug\li
文件 2 2012-11-23 10:30 opengl编写的自行车\code\bicycle\bicycle\Debug\li
文件 65 2012-11-19 22:47 opengl编写的自行车\code\bicycle\bicycle\Debug\mt.dep
文件 516 2012-11-23 10:30 opengl编写的自行车\code\bicycle\bicycle\Debug\rc.command.1.tlog
............此处省略65个文件信息
相关资源
- OpenGL参考手册
- 51单片机多功能自行车测速仪
- 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画的一个简单的直升飞机
- opengl完美天空盒
- 3D绘图程序设计:使用Direct3D 10/9和Ope
- OpenGL绘制可运动自行车源程序.zip
- OpenGL实现飘动效果
评论
共有 条评论