2013年4月30日 星期二

劉宇馨的第十一週作業


Timer

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

float rot=0;
void display()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glRotatef(rot, 0,0,1);
glutSolidTeapot(0.3);
glPopMatrix();
glutSwapBuffers();
}


void timer(int t)
{
     glutTimerFunc(100,timer,t+1);
     rot+=10;
     if(t%20==0)PlaySound("BULLET.wav",NULL,SND_ASYNC);
     glutPostRedisplay();
}
int main()
{
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
    glutCreateWindow("a");
    
    glutDisplayFunc(display);
    glutTimerFunc(0,timer,0);
    
    glutMainLoop();
}



沒有留言:

張貼留言