if(?args at(0), moviePath = args at(0), moviePath = launchPath appendPath("knot.mpg") ) Screen = Object clone Screen parent = OpenGL Screen reshape = method(w, h, self width = w self height = h movie setOutputWidth(w) setOutputHeight(h) glViewport(0, 0, w, h) glMatrixMode(GL_PROJECTION) glLoadIdentity gluOrtho2D(0, w, 0, h) glMatrixMode(GL_MODELVIEW) glLoadIdentity ) Screen display = method( movie nextFrame movie draw if (movie isAtEnd, movie rewind) if (movie error, write(movie error, "\n"); exit) glFlush glutSwapBuffers ) Screen timer = method(v, glutTimerFunc(0, 0) write("frame ", movie frameNumber, "\n") self display ) Screen run = method( self movie = Movie clone setPath(moviePath) movie open glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE) glutInitWindowSize(movie width, movie height) glutInit glutCreateWindow(moviePath lastPathComponent) glutEventTarget(Screen) glutDisplayFunc glutReshapeFunc glutTimerFunc(1, 0) glutMainLoop ) Screen run