2020年3月10日 星期二

<冠宏 這禮拜的標題 柏仁>

開啟project 打程式碼
#include <GL/glut.h>
void display()
{
    glutSolidTeapot(0.2);
    glutSwapBuffers();
}
int main(int argc,  char**argv)
{
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
    glutCreateWindow("week02 Yes!!!");

    glutDisplayFunc(display);
    glutMainLoop();
}

打完以後run
會跑出茶壺

glColor3ub(0,0,0);
    glutSolidTeapot(0.3);
    glutSwapBuffers();
這是我的茶壺 他是黑的
glBegin(GL_POLYGON);
        glColor3f(1,0,0);glVertex2f(0,1);
        glColor3f(0,1,0);glVertex2f(1,-0.5);
        glColor3f(0,0,1);glVertex2f(-1,-0.5);
    glEnd();
前面Color給顏色 後面Vertex給座標
記得加end

沒有留言:

張貼留言