Revision: 7
Author: aronb
Date: 2006-08-17 12:06:34 -0700 (Thu, 17 Aug 2006)
ViewCVS: http://svn.sourceforge.net/pydemeter/?rev=7&view=rev
Log Message:
-----------
- Add ability to show wireframe grid.
Modified Paths:
--------------
trunk/src/test/glut_example.py
Modified: trunk/src/test/glut_example.py
===================================================================
--- trunk/src/test/glut_example.py 2006-08-17 18:56:02 UTC (rev 6)
+++ trunk/src/test/glut_example.py 2006-08-17 19:06:34 UTC (rev 7)
@@ -22,7 +22,8 @@
camera = None
cameraPosition = None
# The "detail level" of the terrain - higher values will render faster but yield less visual quality
-threshold = 30.0;
+threshold = 30.0
+polygon_mode = 0
def init():
global terrain
@@ -142,6 +143,8 @@
glutPostRedisplay()
def key(ch, x, y):
+ global camera
+ global threshold
# Adjust control velocities based on user's current execution speed
CAMERA_SPEED = 100.0 # Meters per second
CAMERA_ROTATE_SPEED = 0.5 # Radians per second
@@ -164,12 +167,22 @@
camera.SetHoverElevation(camera.GetHoverElevation() - translateSpeed);
elif '+' == ch:
# Increase the detail threshold (make the terrain less detailed - worse looking but faster)
- self.mThreshold += 0.5
- print "SAMPLE: Threshold = ", self.mThreshold
+ threshold += 5
+ print "SAMPLE: Threshold = ", threshold
elif '-' == ch:
# Decrease the detail threshold (make the terrain more detailed - better looking but slower)
- self.mThreshold -= 0.5
- print "SAMPLE: Threshold = ", self.mThreshold
+ threshold -= 5
+ print "SAMPLE: Threshold = ", threshold
+ elif 'g' == ch:
+ global polygon_mode
+ polygon_mode = (polygon_mode+1)%3
+ if 0 == polygon_mode:
+ glPolygonMode(GL_FRONT_AND_BACK, GL_FILL)
+ elif 1 == polygon_mode:
+ glPolygonMode(GL_FRONT_AND_BACK, GL_LINE)
+ else:
+ glPolygonMode(GL_FRONT_AND_BACK, GL_POINT)
+
elif ord(ch) == 27: # Escape
sys.exit(0)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|