2016年3月22日 星期二

Week 05 張瑋展

課堂作業1:

到教材 jsyeh.org/3dcg10
下載 [source][data][win32][glut32.dll檔案>Transformation
去做交換Swap,寫下差別


右鍵練習不同旋轉






#include <GL/glut.h>
float rotX;
void display()
{
    glClearColor(0,0.5,0.5,0);
    glClear(GL_COLOR_BUFFER_BIT);
    glPushMatrix();
        glRotatef(rotX,0,1,0);
        glColor3f(2,2,0);
        glutSolidTeapot (0.3);
    glPopMatrix();
    glutSwapBuffers();

}
void motion (int x,int y)
{
    rotX= x;
    display();
}
int main(int argc,char**argv)
{
    glutInit(&argc,argv);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
    glutCreateWindow("hello 3D");

    glutDisplayFunc(display);
    glutMotionFunc(motion);
    ///glutMouseFun(mouse);
    glutMainLoop();
}

課堂作業2:



2 則留言: