2015年6月3日 星期三

Week15 徐詩涵課堂



#include <GL/glut.h>
#include <stdio.h>
float x1=-0.4, y1=0, x2=0.4, y2=0;
void display()
{
    glEnable(GL_DEPTH_TEST);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glPushMatrix();
       glTranslatef(x1, y1,0);
       glColor3f(1,1,0);
       glutSolidTeapot(0.2);
    glPopMatrix();
    glPushMatrix();
       glTranslatef(x2,y2,0);
       glColor3f(1,0,0);
       glutSolidTeapot(0.2);
    glPopMatrix();
    glFlush();
}

int main(int argc,char**argv)
{
    glutInit(&argc,argv);
    glutCreateWindow("Robot3D");
    glutDisplayFunc(display);
    glutMainLoop();
}

沒有留言:

張貼留言