2020年3月10日 星期二

Week02

複習上週OpenGL project

今日練習=>茶壺

筆記部份:
glColor3ub(255,0,255); //透過byte來更改顏色
glColor3f(0.0 , 1.0, 0.0); //透過浮點數來更改顏色

今日練習=>三菱鏡

筆記部份:
程式碼:
#include <GL/glut.h>
void display()
{
    glBegin(GL_POLYGON);
        glColor3f(1,0,0);glVertex2f(1,0);
        glColor3f(0,1,0);glVertex2f(-1,1);
        glColor3f(0,0,1);glVertex2f(-1,-1);
    glEnd();
    glutSwapBuffers();
}
int main(int argc,  char**argv)
{
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
    glutCreateWindow("week02 Yes!!!");

    glutDisplayFunc(display);
    glutMainLoop();
}

沒有留言:

張貼留言