|
2 | 2 | from OpenGL.GLUT import * |
3 | 3 | from OpenGL.GLU import * |
4 | 4 |
|
| 5 | + |
| 6 | +""" |
| 7 | +A hello world application |
| 8 | +
|
| 9 | +This pages creates a simple window to which 2d orthogonal projection is applied. |
| 10 | +Next a couple of points are drawn. This will create a white window with three black |
| 11 | +dots. |
| 12 | +
|
| 13 | +url = http://www.de-brauwer.be/wiki/wikka.php?wakka=PyOpenGLHelloWorld |
| 14 | +""" |
| 15 | + |
| 16 | + |
5 | 17 | def initFun(): |
6 | | - glClearColor(1.0,1.0,1.0,0.0) |
7 | | - glColor3f(0.0,0.0, 0.0) |
| 18 | + glClearColor(1.0, 1.0, 1.0, 0.0) |
| 19 | + glColor3f(0.0, 0.0, 0.0) |
8 | 20 | glPointSize(4.0) |
9 | 21 | glMatrixMode(GL_PROJECTION) |
10 | 22 | glLoadIdentity() |
11 | | - gluOrtho2D(0.0,640.0,0.0,480.0) |
12 | | - |
| 23 | + gluOrtho2D(0.0, 640.0, 0.0, 480.0) |
| 24 | + |
13 | 25 |
|
14 | 26 | def displayFun(): |
15 | 27 | glClear(GL_COLOR_BUFFER_BIT) |
16 | 28 | glBegin(GL_POINTS) |
17 | | - glVertex2i(100,50) |
18 | | - glVertex2i(100,130) |
19 | | - glVertex2i(150,130) |
| 29 | + glVertex2i(100, 50) |
| 30 | + glVertex2i(100, 130) |
| 31 | + glVertex2i(150, 130) |
20 | 32 | glEnd() |
21 | 33 | glFlush() |
22 | 34 |
|
| 35 | + |
23 | 36 | if __name__ == '__main__': |
24 | 37 | glutInit() |
25 | | - glutInitWindowSize(640,480) |
| 38 | + glutInitWindowSize(640, 480) |
26 | 39 | glutCreateWindow(b"Drawdots") |
27 | 40 | glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB) |
28 | 41 | glutDisplayFunc(displayFun) |
|
0 commit comments