2015年3月18日 星期三

02160464_張開為_WEEK04





                          今天的是3D旋轉圖示~
有點難~"~

#include <GL/glut.h>
float angle=0;
void display()
{
    glClear(GL_COLOR_BUFFER_BIT);
    glPushMatrix();
        glTranslatef(0, 0.04, -0.03);(旋轉角度0
        glRotatef(angle,1,0,1);
        glColor3f(0,1,0);(顏色~~)

        glutWireTorus(0.3,0.7,50,50);
        glColor3f(1,0,1);(顏色~~~)
        glutSolidTeapot(0.2);(沒什麼用的茶壺)
    glPopMatrix();
    glFlush();
    angle+=0.02;


}
int main(int argc,char *argv[])
{
    glutInit(&argc,argv);
    glutCreateWindow("02160464");
    glutReshapeWindow(700,600);(視窗的大小~
    glutDisplayFunc(display);
    glutIdleFunc(display);
    glutMainLoop();
}

沒有留言:

張貼留言