2015年3月18日 星期三

Week04 課堂作業, 許志遙

課本範例:

 練習:
#include <GL/glut.h>

float angle=0;
void display(){
    glPushMatrix();     //備份
        glTranslatef(-0.04,0,0);
        glRotatef(angle, 1,1,0);

        glColor3f(1,0,0);
        glutWireTorus(0.2,0.7,100,50);      //甜甜圈
        glColor3f(0,0,1);
        glutSolidTeapot(0.3);
    glPopMatrix();      //還原

    glFlush();
    angle+=0.1;                         //轉角度
    glClear(GL_COLOR_BUFFER_BIT);       //清畫面
}

int main(int argc, char**argv){
    glutInit(&argc,argv);
    glutCreateWindow("資傳拉拉拉拉拉");
    glutReshapeWindow(1000,1000);
    glutDisplayFunc(display);
    glutIdleFunc(display);          //沒事時執行
    glutMainLoop();
}

沒有留言:

張貼留言