2019年4月25日 星期四

06161091蔡萓芹,week10

1.期中考:OpenGL必備10行函式
2.複習:移動 旋轉 縮放
(1)到http://www.cmlab.csie.ntu.edu.tw/~jsyeh/3dcg10/下載:data、win32、glut32.dll
(2)將windows解壓縮後,把data、glut32.dll放到windows資料夾裡面
(3)打開Transformation.exe打開試玩看看

3.主題:T-R-T旋轉(改變旋轉軸)
(1)下載Freeglut3.0.0解壓縮
(2)freeglut---lib(如圖)
    複製freeglut資料夾網址

(3)Create New Project:Glut
    貼上資料途徑,打開程式碼(如圖)
(4)#include <GL/glut.h>
float angle=0; void display() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glPushMatrix(); glTranslatef(0,0.5,0);/// 這是往上移動的茶壺 glutSolidTeapot(0.3); ///茶壺 glPopMatrix(); glPushMatrix(); glPopMatrix(); glPushMatrix(); glRotatef(angle,0,0,1); glTranslatef(0.6,0,0); glRotatef(-90,0,1,0); ///轉動90度的cone glutSolidCone(0.2,0.6,30,30); ///直直的cone glPopMatrix(); glutSwapBuffers(); } void motion(int x,int y) { angle = x; display(); } int main(int argc, char**argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE|GLUT_DEPTH); glutCreateWindow("week10 TRT"); glutDisplayFunc(display); glutMotionFunc(motion); glutMainLoop(); }

沒有留言:

張貼留言