def post_display(): global frame_number # Write frames if necessary if dump_frames: frame_interval = 4 if (frame_number % frame_interval) == 0: w = glutGet(GLUT_WINDOW_WIDTH) h = glutGet(GLUT_WINDOW_HEIGHT) global capture if capture is None: capture = Capture(w, h) glPixelStorei(GL_PACK_ALIGNMENT, 1) capture.record(glReadPixels(0, 0, w, h, GL_RGBA, GL_BYTE)) else: if capture is not None: capture.create_movie() capture = None glutSwapBuffers()