root / PyOpenGL-Demo / broken / tom / text.py
Historique | Voir | Annoter | Télécharger (1,07 ko)
| 1 |
#!/usr/bin/python
|
|---|---|
| 2 |
|
| 3 |
# This is statement is required by the build system to query build info
|
| 4 |
if __name__ == '__build__': |
| 5 |
raise Exception |
| 6 |
|
| 7 |
|
| 8 |
import string |
| 9 |
__version__ = string.split('$Revision: 1.1.1.1 $')[1] |
| 10 |
__date__ = string.join(string.split('$Date: 2007/02/15 19:25:40 $')[1:3], ' ') |
| 11 |
__author__ = 'Tarn Weisner Burton <twburton@users.sourceforge.net>'
|
| 12 |
|
| 13 |
from OpenGL.GL import * |
| 14 |
from OpenGL.Tk import * |
| 15 |
|
| 16 |
from logo import define_logo |
| 17 |
|
| 18 |
def redraw(o): |
| 19 |
if o.grob == -1: |
| 20 |
o.grob = glGenLists(1);
|
| 21 |
glNewList(o.grob, GL_COMPILE_AND_EXECUTE); |
| 22 |
glMaterialfv(GL_FRONT, GL_DIFFUSE, [1., 1., 0., 0.]) |
| 23 |
define_logo() |
| 24 |
glEndList() |
| 25 |
|
| 26 |
o.autospin = 1
|
| 27 |
|
| 28 |
o.xspin = 1
|
| 29 |
o.yspin = 2
|
| 30 |
|
| 31 |
o.update() |
| 32 |
|
| 33 |
o.after(10, o.do_AutoSpin)
|
| 34 |
|
| 35 |
else:
|
| 36 |
|
| 37 |
glCallList(o.grob) |
| 38 |
|
| 39 |
#
|
| 40 |
# Demo starts here really.
|
| 41 |
if __name__ == "__main__": |
| 42 |
import Tkinter, sys |
| 43 |
|
| 44 |
o = Opengl(None, width = 400, height = 200, double = 1, depth = 1) |
| 45 |
o.pack(expand = 1, fill = 'both') |
| 46 |
|
| 47 |
o.redraw = redraw |
| 48 |
o.set_centerpoint(30., 2., 0.) |
| 49 |
o.set_eyepoint(80.)
|
| 50 |
|
| 51 |
o.grob = -1
|
| 52 |
|
| 53 |
o.autospin_allowed = 1
|
| 54 |
|
| 55 |
# Enter the tk mainloop.
|
| 56 |
|
| 57 |
Tkinter.mainloop() |
| 58 |
|