(2)加上了一些程式 做變化

(3)一黑一白,圍繞中央旋轉
(4)在面上著色,掛彩帶上去
glBegin(GL_QUAD_STRIP);
glVertex3f( 0.2, 0.2,0.3);
glVertex3f( 0.2, 0.2,-0.3);
glVertex3f( 0.2, -0.2,0.3);
glVertex3f( 0.2, -0.2,-0.3);
glVertex3f( -0.2, -0.2,0.3);
glVertex3f( -0.2, -0.2,-0.3);
glVertex3f( -0.2, 0.2,-0.3);
glVertex3f( -0.2, 0.2,0.3);
(5)後面開始畫線
glBegin(GL_LINE_LOOP);///後面畫線
glVertex3f( 0.2, 0.2,0.3);
glVertex3f( 0.2, -0.2,0.3);
glVertex3f( -0.2, -0.2,0.3);
glVertex3f( -0.2, 0.2,0.3);
glEnd();
glBegin(GL_LINE_LOOP);
glVertex3f( 0.2, 0.2,-0.3);
glVertex3f( 0.2, -0.2,-0.3);
glVertex3f( -0.2, -0.2,-0.3);
glVertex3f( -0.2, 0.2,-0.3);
glEnd();
glBegin(GL_LINES);
glVertex3f( 0.2, 0.2,0.3);
glVertex3f( 0.2, 0.2,-0.3);
glVertex3f( 0.2, -0.2,0.3);
glVertex3f( 0.2, -0.2,-0.3);
glVertex3f( -0.2, -0.2,0.3);
glVertex3f( -0.2, -0.2,-0.3);
glVertex3f( -0.2, 0.2,0.3);
glVertex3f( -0.2, 0.2,-0.3);
glEnd();
glPopMatrix();
glFlush();
angle+=0.1;
(6)加上
void motion (int x,int y)
{
printf("%d %d\n", x, y);
angle =x;
angle2=y;
}
(7)
glEnable(GL_DEPTH_TEST);///進的會擋到遠的,遠的不會被禁的擋到
glutInitDisplayMode(GLUT_DEPTH);///讓顯示的window有3d深度的功能
沒有留言:
張貼留言