2015年3月12日 星期四

week3_hw1 蔡瑩盈

1. 打網址 jsyeh.org/3dcg10
下載data,win32,glut32.dull
2. 把windows.zip解壓縮
把glut32.dll檔、data.zip壓縮好然後丟入windows資料夾

 3. try try範例 shape

 4.搜尋freeglut然後在code block做上禮拜的動作


 5.測試茶壺變顏色的程式碼
#include <GL/glut.h>///呼叫外掛#include GL/glut的功能
void display()
{
    glColor3f(1,0,1);   // 三顏色  浮點數
    glutSolidTeapot(0.5);

    glFlush();
}
int main(int argc, char **argv)
{
    glutInit(&argc,argv);///3.把glut準備好,參數照舊
    glutCreateWindow("資傳拉拉得冠軍");///建置視窗(小駱駝命名法)
    glutDisplayFunc(display);
    glutMainLoop();///glut的主要迴圈,卡住用的

}


6.測試顏色重疊效果
#include <GL/glut.h>///呼叫外掛#include GL/glut的功能
void display()
{
    glColor3f(1,0,0);
    glutSolidTeapot(0.5);

    glColor3f(0,1,0);
    glutSolidTeapot(0.4);

    glColor3f(0,0,1);
    glutSolidTeapot(0.3);

    glFlush();
}
int main(int argc, char **argv)
{
    glutInit(&argc,argv);///3.把glut準備好,參數照舊
    glutCreateWindow("資傳拉拉得冠軍");///建置視窗(小駱駝命名法)
    glutDisplayFunc(display);
    glutMainLoop();///glut的主要迴圈,卡住用的

}

7.測試
glClearColor(0,0.2,1.6,1); //用來Clear清的顏色是捨麼
    glClear(GL_COLOR_BUFFER_BIT);//Clear  buffer


 8.測試畫圖形
#include <GL/glut.h>
void display()
{
    glClearColor(0.2,0,9,3);                            ///重點3.用來Clear清的顏色是什麼
    glClear(GL_COLOR_BUFFER_BIT);    ///重點2.Clear說明你清哪一個Buffer

    glBegin(GL_POLYGON);
        glColor3f(4,6,0);                                  ///今天的重點1.有顏色的茶壺
        glVertex2f(0,0);
        glVertex2f(1,0);
        glVertex2f(0,1);
    glEnd();
    glBegin(GL_POLYGON);
        glColor3f(1,1,5);
        glVertex2f(0,0);

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

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

    glEnd();
    glFlush();
}

int main(int argc,char**argv)
{
    glutInit(&argc,argv);
    glutCreateWindow("資傳拉拉得冠軍");
    glutDisplayFunc(display);
    glutMainLoop();
}


沒有留言:

張貼留言