2023年2月23日 星期四

森 Week02 電腦圖學 GLUT


顯示出茶壺

首先打開Codeblocks

使用上週Glut的步驟

顯示出程式碼


自己打出

#include <GL/glut.h>
void display()
{
    glutSolidTeapot( 0.3);
    glutSwapBuffers();
}
然後從上圖複製下圖途中程式,執行他

 上面新增程式:glColor3f(1,1,0);

    glutSolidTeapot(0.5);

    glColor3f(0,1,0);

    glutSolidTeapot( 0.3);

執行就會出現下圖


2.

建立一個新專案

命名為:Week02-2_GLUT_many_vertex

新增程式

    glColor3f(0,1,0);

    glBegin(GL_POLYGON);

        glVertex2f(0,1);

        glVertex2f(-1,-1);

        glVertex2f(+1,-1);

    glEnd();

就會跑出下圖


 




沒有留言:

張貼留言