File: Line.py

package info (click to toggle)
python-opengl 1.5.7-5.3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 2,192 kB
  • ctags: 3,971
  • sloc: ansic: 18,030; python: 8,909; tcl: 328; cpp: 211; makefile: 115; sh: 24
file content (26 lines) | stat: -rw-r--r-- 538 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/env python

from OpenGL.GL import *
from OpenGL.Tk import *

def redraw(o):
	glClearColor(0.5, 0.5, 0.5, 0)
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
	glOrtho(0,1,0,1,0,1)
	glDisable(GL_LIGHTING)
	glBegin(GL_LINES)
	glColor3f(1,1,0)
	glVertex2f(0,0)
	glColor3f(1,0,1)
	glVertex2f(1,1)
	glColor3f(1,0,0)
	glVertex2f(1,0)
	glColor3f(0,0,1)
	glVertex2f(0,1)
	glEnd()
	glEnable(GL_LIGHTING)

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