起初我有一个像这样的简单的白色矩形棱镜:
这是代码:
glBegin(GL_QUADS);
glColor3f(255,255,255);
glVertex3f( 0.3, 0, 2.5);//sisi bawah
glVertex3f(0.5, 0, 2.5);
glVertex3f(0.5, 0, 2.6);
glVertex3f( 0.3, 0, 2.6);
glVertex3f(0.5, 0, 2.6);//sisi kiri
glVertex3f( 0.3, 0, 2.6);
glVertex3f( 0.3, 1.5, 2.6);
glVertex3f(0.5, 1.5, 2.6);
glVertex3f(0.5, 0, 2.5);//sisi depan
glVertex3f(0.5, 0, 2.6);
glVertex3f(0.5, 1.5, 2.6);
glVertex3f(0.5, 1.5, 2.5);
glVertex3f( 0.3, 0, 2.5);//sisi belakang
glVertex3f( 0.3, 0, 2.6);
glVertex3f( 0.3, 1.5, 2.6);
glVertex3f( 0.3, 1.5, 2.5);
glVertex3f( 0.3, 1.5, 2.5);//sisi atas
glVertex3f(0.5, 1.5, 2.5);
glVertex3f(0.5, 1.5, 2.6);
glVertex3f( 0.3, 1.5, 2.6);
glVertex3f(0.5, 0, 2.5);//sisi kanan
glVertex3f( 0.3, 0, 2.5);
glVertex3f( 0.3, 1.5, 2.5);
glVertex3f(0.5, 1.5, 2.5);
glEnd();
然后,我想画另一个像这样的矩形棱柱:
我可以只使用重绘另一个棱镜,glTranslate
这样我就不必手动插入数字了吗?