首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ Builder >

用OPENGL绘制图形,该如何解决

2012-03-05 
用OPENGL绘制图形大家能帮忙一下,怎么用向量绘制正方体,并有光线的真实感。[解决办法]OPENGL?帮楼主顶起[解

用OPENGL绘制图形
大家能帮忙一下,怎么用向量绘制正方体,并有光线的真实感。

[解决办法]
OPENGL?帮楼主顶起
[解决办法]

Delphi(Pascal) code
 glBegin(GL_POLYGON);      //前表面     glColor3f(1.0,1.0,1.0);     glVertex3f(5,5,5);     glColor3f(1.0,1.0,0);     glVertex3f(5,-5,5);     glColor3f(1.0,0,0);     glVertex3f(-5,-5,5);     glColor3f(1.0,0,1.0);     glVertex3f(-5,5,5);   glEnd;   glBegin(GL_POLYGON);      //后表面     glColor3f(0,1.0,1.0);     glVertex3f(5,5,-5);     glColor3f(0,1.0,0);     glVertex3f(5,-5,-5);     glColor3f(0.0,0,0);     glVertex3f(-5,-5,-5);     glColor3f(0,0,1.0);     glVertex3f(-5,5,-5);   glEnd;   glBegin(GL_POLYGON);      //上表面     glColor3f(0,1.0,1.0);     glVertex3f(5,5,-5);     glColor3f(1.0,1.0,1);     glVertex3f(5,5,5);     glColor3f(1.0,0,1);     glVertex3f(-5,5,5);     glColor3f(0,0,1.0);     glVertex3f(-5,5,-5);   glEnd;      glBegin(GL_POLYGON);      //下表面     glColor3f(0,1.0,0);     glVertex3f(5,-5,-5);     glColor3f(1.0,1.0,0);     glVertex3f(5,-5,5);     glColor3f(1.0,0,0);     glVertex3f(-5,-5,5);     glColor3f(0,0,0.0);     glVertex3f(-5,-5,-5);   glEnd;   glBegin(GL_POLYGON);      //左表面     glColor3f(1,1.0,1.0);     glVertex3f(5,5,5);     glColor3f(0.0,1.0,1);     glVertex3f(5,5,-5);     glColor3f(0.0,1,0);     glVertex3f(5,-5,-5);     glColor3f(1,1,0.0);     glVertex3f(5,-5,5);   glEnd;   glBegin(GL_POLYGON);      //右表面     glColor3f(1,0.0,1.0);     glVertex3f(-5,5,5);     glColor3f(0.0,0.0,1);     glVertex3f(-5,5,-5);     glColor3f(0.0,0,0);     glVertex3f(-5,-5,-5);     glColor3f(1,0,0.0);     glVertex3f(-5,-5,5);   glEnd; 

热点排行