2016年3月7日 星期一

week03 - 彩色三角形

課堂作業1 :

進入教材 jsyeh.org/3dcg10
並下載 win32 data glut32.dll


建立一個glut檔


google"freeglut"下載freeglut3.0.0


最後打上三角形頂點程式碼 還可以改顏色


也可以加頂點





#include <GL/glut.h>
void display()
{
    glBegin(GL_POLYGON);

    glColor3f(1,1,0); glVertex2f(0.5,0.5);
    glColor3f(1,0,0); glVertex2f(0.5,-0.5);
    glColor3f(0,0,1); glVertex2f(0,0);
    glColor3f(1,0,1); glVertex2f(0.2,-1);
    glEnd();
     glutSwapBuffers();
}
int main(int argc, char**argv)

{

    glutInit(&argc,argv);


    glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);

    glutCreateWindow("hello ");

    glutDisplayFunc(display);

    glutMainLoop();
}

沒有留言:

張貼留言