Removed autotools build files (I think I got all of them, did I?)
[freeglut] / progs / demos / spaceball / spaceball.c
index 72ad77e..52da93a 100644 (file)
 #include <GL/freeglut.h>\r
 #include "vmath.h"\r
 \r
+#ifndef M_PI\r
+#define M_PI    3.14159265358979323846264338327950\r
+#endif\r
+\r
 void draw_cube(void);\r
 \r
 /* callbacks */\r
@@ -58,7 +62,7 @@ void disp(void)
   glMatrixMode(GL_MODELVIEW);\r
   glLoadIdentity();\r
   glTranslatef(pos.x, pos.y, pos.z);\r
-  glMultTransposeMatrixf((float*)xform);\r
+  glMultMatrixf((float*)xform);\r
 \r
   draw_cube();\r
 \r
@@ -119,7 +123,7 @@ void draw_cube(void)
 void reshape(int x, int y)\r
 {\r
   float aspect = (float)x / (float)y;\r
-  float halfy = tan(FOV / 2.0);\r
+  float halfy = (float)tan(FOV / 2.0);\r
   float halfx = halfy * aspect;\r
 \r
   glViewport(0, 0, x, y);\r
@@ -150,16 +154,16 @@ void keyb(unsigned char key, int x, int y)
 \r
 void sbmot(int x, int y, int z)\r
 {\r
-  pos.x += x * 0.001;\r
-  pos.y += y * 0.001;\r
-  pos.z -= z * 0.001;\r
+  pos.x += x * 0.001f;\r
+  pos.y += y * 0.001f;\r
+  pos.z -= z * 0.001f;\r
   glutPostRedisplay();\r
 }\r
 \r
 void sbrot(int x, int y, int z)\r
 {\r
-  float axis_len = sqrt(x * x + y * y + z * z);\r
-  rot = quat_rotate(rot, axis_len * 0.001, -x / axis_len, -y / axis_len, z / axis_len);\r
+  float axis_len = (float)sqrt(x * x + y * y + z * z);\r
+  rot = quat_rotate(rot, axis_len * 0.001f, -x / axis_len, -y / axis_len, z / axis_len);\r
   glutPostRedisplay();\r
 }\r
 \r