compute reasonable animate rate (Marcelo Magallon)
diff --git a/progs/samples/stretch.c b/progs/samples/stretch.c
index 9efa8e1..1fd015d 100644
--- a/progs/samples/stretch.c
+++ b/progs/samples/stretch.c
@@ -265,6 +265,17 @@
 
 void Animate(void)
 {
+    static double t0 = -1.;
+    double t, dt;
+    t = glutGet(GLUT_ELAPSED_TIME) / 1000.;
+    if (t0 < 0.)
+       t0 = t;
+    dt = t - t0;
+
+    if (dt < 1./60.)
+        return;
+
+    t0 = t;
 
     switch (op) {
       case OP_STRETCH:
@@ -307,6 +318,10 @@
     return GL_TRUE;
 }
 
+#if !defined(GLUTCALLBACK)
+#define GLUTCALLBACK
+#endif
+
 void GLUTCALLBACK glut_post_redisplay_p(void)
 {
       glutPostRedisplay();