X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=progs%2Fdemos%2Fspaceball%2Fspaceball.c;h=52da93a7f43fd612589e918337027e834ad1ea73;hb=63922c1586329f2ed481453aa9175ecc7b235adb;hp=72ad77eb475de9cb919b356f8419fd075aff9739;hpb=8507764d48cceb8461f9d0194915fa0b7fb58447;p=freeglut diff --git a/progs/demos/spaceball/spaceball.c b/progs/demos/spaceball/spaceball.c index 72ad77e..52da93a 100644 --- a/progs/demos/spaceball/spaceball.c +++ b/progs/demos/spaceball/spaceball.c @@ -15,6 +15,10 @@ #include #include "vmath.h" +#ifndef M_PI +#define M_PI 3.14159265358979323846264338327950 +#endif + void draw_cube(void); /* callbacks */ @@ -58,7 +62,7 @@ void disp(void) glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslatef(pos.x, pos.y, pos.z); - glMultTransposeMatrixf((float*)xform); + glMultMatrixf((float*)xform); draw_cube(); @@ -119,7 +123,7 @@ void draw_cube(void) void reshape(int x, int y) { float aspect = (float)x / (float)y; - float halfy = tan(FOV / 2.0); + float halfy = (float)tan(FOV / 2.0); float halfx = halfy * aspect; glViewport(0, 0, x, y); @@ -150,16 +154,16 @@ void keyb(unsigned char key, int x, int y) void sbmot(int x, int y, int z) { - pos.x += x * 0.001; - pos.y += y * 0.001; - pos.z -= z * 0.001; + pos.x += x * 0.001f; + pos.y += y * 0.001f; + pos.z -= z * 0.001f; glutPostRedisplay(); } void sbrot(int x, int y, int z) { - float axis_len = sqrt(x * x + y * y + z * z); - rot = quat_rotate(rot, axis_len * 0.001, -x / axis_len, -y / axis_len, z / axis_len); + float axis_len = (float)sqrt(x * x + y * y + z * z); + rot = quat_rotate(rot, axis_len * 0.001f, -x / axis_len, -y / axis_len, z / axis_len); glutPostRedisplay(); }