2016年3月8日 星期二

Week 3 課堂作業

課堂 1

Triangle_Fan

Lines

Line_Loop

Points

Polygon

QUADS

QUAD_Strip

Line_Strip

Triangle_Strip

Triangles

課堂2 &3

課堂4



Source code

#include<GL/glut.h>
#include<stdio.h>

void mouse(int button, int state, int x, int y)
{   if(state==GLUT_DOWN)
        printf("%d, %d\n", x, y);
}

void display()
{
    glClearColor(0.2,0.2,1,1);
    glClear(GL_COLOR_BUFFER_BIT);
    glBegin(GL_POLYGON);
        glColor3ub(120,150,100); glVertex3f(-1.0,0,0);
        glColor3ub(50,125,180); glVertex3f(1.0,-1.0,0);
        glColor3ub(255,250,240); glVertex3f(1.0,1.0,0);
    glEnd();
    glutSwapBuffers();
}

int main(int argc, char **argv)
{
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
    glutCreateWindow("PIGUDADA");
    glutDisplayFunc(display);
    glutMouseFunc(mouse);

    glutMainLoop();
}

沒有留言:

張貼留言