2018年3月30日 星期五

week05 李昱佑

1.http://www.cmlab.csie.ntu.edu.tw/~jsyeh/3dcg10/  下載 data.zip, windows.zip, glut32.dll
2.將data.zip,data.zip放入windows.zip
3.打開Transformation
4.
glTranslatef  (  左右,上下,前後  )
glRotatef  (  中心固定轉動  )
glScalef  (  寬,高,長  )
glBegin  (  改變物體  )



1.GLUT專案

#include <GL/glut.h>
float angle=0;///Now: 讓茶壼自動轉動的角度
void display()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();///Now:備份矩陣
glRotatef(angle, 0,0,1);///Now:轉動
glutSolidTeapot(0.3);
glPopMatrix();///Now:還原矩陣
glutSwapBuffers();
}
void motion(int x, int y)
{
angle=x;///Now: 改變角度
glutPostRedisplay();///Now: 請 重畫畫面
}
int main(int argc, char**argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE|GLUT_DEPTH);
glutCreateWindow("Week05 TRT");
glutDisplayFunc(display);
glutMotionFunc(motion);///Now:
glutMainLoop();
}


沒有留言:

張貼留言