2015年3月12日 星期四

week03_周冠羽

step1.  去 jsyeh.org/3dcg10
step2. 把windows.zip解壓縮 之後 再把glut32.dll檔、data.zip壓縮好的 都 丟入
 step3. 試試範例 shape
step4.
step5.
測試
變顏色程式碼
#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的主要迴圈,卡住用的

}


#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的主要迴圈,卡住用的

}
重疊效果測試
step6
測試
glClearColor(0,0.3,0.6,1); //用來Clear清的顏色是捨麼
    glClear(GL_COLOR_BUFFER_BIT);//Clear  buffer

#include <GL/glut.h>///呼叫外掛#include GL/glut的功能
void display()
{
    glClearColor(0,0.3,0.6,1); //用來Clear清的顏色是捨麼
    glClear(GL_COLOR_BUFFER_BIT);//Clear  buffer

    glColor3f(1,0,0);
    glutSolidTeapot(0.5);
    //glClear(GL_COLOR_BUFFER_BIT);

    glColor3f(0,1,0);
    glutSolidTeapot(0.4);
    //glClear(GL_COLOR_BUFFER_BIT);

    glColor3f(0,0,1);
    glutSolidTeapot(0.3);
    //glClear(GL_COLOR_BUFFER_BIT);
    glFlush();
}
int main(int argc, char **argv)
{
    glutInit(&argc,argv);///3.把glut準備好,參數照舊
    glutCreateWindow("跟你拚了");///建置視窗(小駱駝命名法)
    glutDisplayFunc(display);
    glutMainLoop();///glut的主要迴圈,卡住用的

}
step7. 測試畫三角形  座標
glBegin(GL_POLYGON);//POLYGON----->多邊形
        glColor3f(1,1,0);
        glVertex2f(0,0);//Vertex------->三角形的頂點
        glVertex2f(1,0);
        glVertex2f(0,1);
    glEnd();


沒有留言:

張貼留言