2017年3月21日 星期二

Week 5 - 文郁上課誌

2017電腦圖學

2017 / 3/ 14
1. 作業互評、評分
2. 主題 : Mause互動
3. 主題 : 縮放Scale
4. 實作 : PushMatrix PopMatrix




TODO : (1) 登入TRS.zuvio.com.tw 回答上周問題。


TODO : (2) 下載 jsyeh.org/3dcg10

data.zip -> 桌面 \ window
window.zip -> 桌面 \ window
glut32.dll -> 桌面 \ window





TODO : (3) 開啟Transformation.exe檔案





 TODO : (4) 讓茶壺變到上方



 TODO : (5) 茶壺可以自由移動




TODO : (6) 茶壺可以旋轉

#include <GL/glut.h>
float mouseX=0, mouseY=0 , rotX=0 ;
void display()
{
    glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
    glPushMatrix();
        glRotatef(rotX,0, 0,1) ;
        glutSolidTeapot(0.3);
    glPopMatrix();
    glutSwapBuffers();
}
void motion(int x, int y)
{
    mouseX= (x-150)/150.0;
    mouseY= -(y-150)/150.0;
    rotX=x;
    glutPostRedisplay();
}
int main( int argc,char **argv )
{
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_RGB|GLUT_DOUBLE|GLUT_DEPTH);
    glutCreateWindow("04160125 translate rotate scale");

    glutDisplayFunc(display);
    glutMotionFunc(motion);
    glutMainLoop();

}



沒有留言:

張貼留言