资源简介
opengl 20面体#include
#define X .525731112119133606
#define Z .850650808352039932
static GLfloat vdata[12][3] = {//各顶点坐标
{-X,0.0,Z},{X,0.0,Z},{-X,0.0,-Z},{X,0.0,-Z},
{0.0,Z,X},{0.0,Z,-X},{0.0,-Z,X},{0.0,-Z,-X},
{Z,X,0.0},{-Z,X,0.0},{Z,-X,0.0},{-Z,-X,0.0},
};
static GLuint tindices[20][3] = {//构成各面(三角形)的顶点索引
{1,4,0},{4,9,0},{4,5,9},{8,5,4},{1,8,4},
{1,10,8},{10,3,8},{8,3,5},{3,2,5},{3,7,2},
{3,10,7},{10,6,7},{6,11,7},{6,0,11},{6,1,0},
{10,1,6},{11,0,9},{2,11,9},{5,2,9},{11,2,7},
};
void display()
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_TRIANGLES);
for(int i = 0;i < 20;++i)
{
glColor3f(1.0,1.0,i * 1.0 / 20);//颜色设置
glVertex3fv(&vdata;[tindices[i][0]][0]);
glVertex3fv(&vdata;[tindices[i][1]][0]);
glVertex3fv(&vdata;[tindices[i][2]][0]);
}
glEnd();
glFlush();
}
void init()
{
glClearColor(0.0,0.0,0.0,0.0);
}
int main(int argc,char** argv)
{
glutInit(&argc;,argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(250,250);
glutInitWindowPosition(100,100);
glutCreateWindow("Polygon");
init();
glutDisplayFunc(display);
glutMainLoop();
return 0;
}
代码片段和文件信息
#include
#define X .525731112119133606
#define Z .850650808352039932
static GLfloat vdata[12][3] = {//各顶点坐标
{-X0.0Z}{X0.0Z}{-X0.0-Z}{X0.0-Z}
{0.0ZX}{0.0Z-X}{0.0-ZX}{0.0-Z-X}
{ZX0.0}{-ZX0.0}{Z-X0.0}{-Z-X0.0}
};
static GLuint tindices[20][3] = {//构成各面(三角形)的顶点索引
{140}{490}{459}{854}{184}
{1108}{1038}{835}{325}{372}
{3107}{1067}{6117}{6011}{610}
{1016}{1109}{2119}{529}{1127}
};
void display()
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_TRIANGLES);
for(int i = 0;i < 20;++i)
{
glColor3f(1.01.0i * 1.0 / 20);//颜色设置
glVertex3fv(&vdata[tindices[i][0]][0]);
glVertex3fv(&vdata[tindices[i][1]][0]);
glVertex3fv(&vdata[tindices[i][2]][0]);
}
glEnd();
glFlush();
}
void init()
{
glClearColor(0.00.00.00.0);
}
int main(int argcchar** argv)
{
glutInit(&argcargv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(250250);
glutInitWindowPosition(100100);
glutCreateWindow(“Polygon“);
init();
glutDisplayFunc(display);
glutMainLoop();
return 0;
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1173 2012-03-27 01:40 opengl20faces.cpp
----------- --------- ---------- ----- ----
1173 1
- 上一篇:ESXI6.0.txt
- 下一篇:labview Prcess Monitor.vi
相关资源
- opengl纹理贴图
- GLTools-Freeglut.zipopengl超级宝典V5
- VIEW3DS.exe
- freeimage库的一个小
- OpenGL动态小车
- vc OpenGL制作动态三维的雷达扫描效果
- error C1083: 无法打开包括文件: “glau
- OpenGLWindow.zip
- GLUT库下载69016
- OpenGL实现下雪的效果
- openGL兔子模型
- GLaux (OpenGL辅助库)
- qt_opengl_obj.zip
- glaux库包含glaux.h和glaux.lib
- opengl通过键盘对3d图像进行颜色,光照
- GLM动态库、静态库和头文件OpenGL
- opengl函数大全,所有可用函数都在这
- QT-opengl窗体,实现了 1.绘制立方体,
- 计算机图形学机器人绘制opengl
- 使用opengl画桌子+球+地板
- OpenGL 的 GL.h
- SOILX64版本
- 3D图形绘制及显示OpenGL
- 光线跟踪算法源码
- opengl的glut最全包
- glad.h库OpenGL开发用
- OpenGL+IMU显示姿态
- OpenGL编程指南第七版(原书+目录+文本
- glut工具包,解决编译问题: 无法打
- OPENGL视频教程从入门基础到精通
评论
共有 条评论