2015年3月12日 星期四

week03_蔡妤安

3/12 電腦圖學 學習目標

1.點,縣,面,顏色
2.5行程式碼
3.glut範例
4.電腦圖學之父
----------
網址輸入 → jsyeh.org/3dcg10



下載 data.zip、windows.zip、glut32.dll

1. windows.zip→桌面\window\範例.exe
2. glut32.dll     →桌面\windoe\glut32.dll
3. date.zip       →桌面\window\data\(3D模型)

※再試shape.exe之外的範例
----------
●●●如何改變顏色?  (今日重點一)

glColor3f(red,green,blue);
           ↑ 參數*3 float

●●●畫出紅色茶壺程式

#include <GL/glut.h>

void display()
{
    glutSolidTeapot(0.3);
    glColor3f(1,0,0);
    glFlush();
}
main(int argc, char **argv)
{
    glutInit(&argc, argv);
    glutCreateWindow("01160360蔡妤安");
    glutDisplayFunc(display);
    glutMainLoop();
    return 0;

}




----------
●●● 今日重點二

glClear(GL_COLOR_BUTTER_BIT);
clear而且要說明你清哪一個butter
----------
●●●今日重點三

glClearColor(__,__,__,__);
用來clear清的顏色是甚麼
----------

















----------
●●●畫漸層顏色、與三角形

#include <GL/glut.h>

void display()
{
    glClearColor(0.7, 0.5, 0.6, 1);///今日重點3:用來clear清的顏色是甚麼
    glClear(GL_COLOR_BUFFER_BIT);///今日重點2:clear而且要說明你清哪一個butter

    glBegin(GL_POLYGON);
        glColor3f(1,1,0); 
        glVertex2f(0,0);
        glVertex2f(1,0);
        glVertex2f(0,1);
    glEnd();

    glBegin(GL_POLYGON);
        glColor3f(0,1,0);
        glVertex2f(0,0);

        glColor3f(0,0,1);
        glVertex2f(-1,0);

        glColor3f(1,0,0);
        glVertex2f(0,-1);
    glEnd();

    glFlush();
}
main(int argc, char **argv)
{
    glutInit(&argc, argv);
    glutCreateWindow("01160360蔡妤安");
    glutDisplayFunc(display);
    glutMainLoop();
    return 0;

}














沒有留言:

張貼留言