root / PyOpenGL-Demo / broken / GLE / cone.py
Historique | Voir | Annoter | Télécharger (945 octet)
| 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 |
from OpenGL.GL import * |
| 9 |
from OpenGL.GLUT import * |
| 10 |
from OpenGL.GLE import * |
| 11 |
import maintest |
| 12 |
|
| 13 |
|
| 14 |
# draw the polycone shape
|
| 15 |
def DrawStuff(): |
| 16 |
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) |
| 17 |
# set up some matrices so that the object spins with the mouse
|
| 18 |
gleSetJoinStyle (TUBE_NORM_EDGE | TUBE_JN_ANGLE | TUBE_JN_CAP) |
| 19 |
glPushMatrix () |
| 20 |
glTranslatef (0.0, 0.0, -80.0) |
| 21 |
glRotatef (maintest.lastx, 0.0, 1.0, 0.0) |
| 22 |
glRotatef (maintest.lasty, 1.0, 0.0, 0.0) |
| 23 |
|
| 24 |
# Phew. FINALLY, Draw the polycone
|
| 25 |
glePolyCone(((-6.0, 6.0, 0.0), (6.0, 6.0, 0.0), (6.0, -6.0, 0.0), (-6.0, -6.0, 0.0), (-6.0, 6.0, 0.0), (6.0, 6.0, 0.0)), |
| 26 |
((0.0, 0.0, 0.0), (0.0, 0.8, 0.3), (0.8, 0.3, 0.0), (0.2, 0.3, 0.9), (0.2, 0.8, 0.5), (0.0, 0.0, 0.0)), (1, 1, 3, 0.5, 2, 1)) |
| 27 |
|
| 28 |
glPopMatrix () |
| 29 |
|
| 30 |
glutSwapBuffers () |
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
maintest.main(DrawStuff) |