Statistics
| Revision:

root / PyOpenGL-Demo / tom / Line.py @ 1

History | View | Annotate | Download (869 Bytes)

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:38 $')[1:3], ' ')
11
__author__ = 'Tarn Weisner Burton <twburton@users.sourceforge.net>'
12

    
13
from OpenGL.GL import *
14
from OpenGL.Tk import *
15

    
16
def redraw(o):
17
        glClearColor(0.5, 0.5, 0.5, 0)
18
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
19
        glOrtho(0,1,0,1,0,1)
20
        glDisable(GL_LIGHTING)
21
        glBegin(GL_LINES)
22
        glColor3f(1,1,0)
23
        glVertex2f(0,0)
24
        glColor3f(1,0,1)
25
        glVertex2f(1,1)
26
        glColor3f(1,0,0)
27
        glVertex2f(1,0)
28
        glColor3f(0,0,1)
29
        glVertex2f(0,1)
30
        glEnd()
31
        glEnable(GL_LIGHTING)
32

    
33
o = Opengl(width = 400, height = 400, double = 1)
34
o.redraw = redraw
35
o.pack(side = 'top', expand = 1, fill = 'both')
36
o.mainloop()