2016年3月7日 星期一

week03

week3主要是 點、線、面、顏色

點>>glVertex2f (x,y);
        glVertex2f (x,y);
色彩>>glColor3f (r,g,b);

作業1:

到http://www.cmlab.csie.ntu.edu.tw/~jsyeh/3dcg10/下載教材


作業2:

上網http://www.transmissionzero.co.uk/software/freeglut-devel/下載

下載完把freeglut資料夾移至桌面
打開lib並且複製新增一個libglut32.a

接著就可以打開codeblock
新增一個GLUT project



打入
#include <GL/glut.h>
void display()
{
    ///glutSolidTeapot(0.3);
    glBegin(GL_POLYGON);
    glColor3f(1,1,0);
    glVertex2f(1,1);
    glVertex2f(1,0);
    glVertex2f(0,0);
    glEnd();
    glutSwapBuffers();
}
int main(int argc, char**argv)
{
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
    glutCreateWindow("hello 3D");

    glutDisplayFunc(display);

    glutMainLoop();
}
就會出現


沒有留言:

張貼留言