#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
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
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
\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