import sys, time, math, os from OpenGL.GL import * from OpenGL.GLU import * from OpenGL.GLUT import * from dmsgl import * dir = os.getcwd() + os.sep camera = OrthoCamera(-25,25, -25,25, -25,25) tex = Texture2D(dir + 'aludiplt.jpg') active = False def draw(): Color.Black.clear() camera.apply() tex.apply() glBegin(GL_QUADS) glTexCoord2f(0, 0) glVertex2f(-10, -10) glTexCoord2f(1, 0) glVertex2f(10, -10) glTexCoord2f(1, 1) glVertex2f(10, 10) glTexCoord2f(0, 1) glVertex2f(-10, 10) glEnd() tex.disable() glutSwapBuffers() def keyboard(key, x, y): global active if key == chr(27): sys.exit(0) elif key == ' ': active = not active def update(): glutPostRedisplay() glutInit([]) glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH) glutInitWindowSize(400,400) glutCreateWindow(sys.argv[0]) glutDisplayFunc(draw) glutKeyboardFunc(keyboard) glutIdleFunc(update) glEnable(GL_DEPTH_TEST) glutMainLoop()