# HG changeset patch # User John Tsiombikas # Date 1315378381 -10800 # Node ID 6851489e70c2543358606f578a578099542eb688 # Parent 4c20f10a7183e0b51210d78fed07a4f527081d46 timing? diff -r 4c20f10a7183 -r 6851489e70c2 src/istereo.c --- a/src/istereo.c Wed Sep 07 09:35:20 2011 +0300 +++ b/src/istereo.c Wed Sep 07 09:53:01 2011 +0300 @@ -1,4 +1,5 @@ #include +#include #include #include #include "opengl.h" @@ -7,12 +8,22 @@ #include "sdr.h" #include "respath.h" #include "tex.h" +#include "config.h" static unsigned int get_shader_program(const char *vfile, const char *pfile); +static float get_sec(void); unsigned int prog; unsigned int tex; +int stereo; + +/* construction parameters */ +int sides = 24; +int segm = 20; +float ring_height = 0.5; + + int init(void) { add_resource_path("sdr"); @@ -38,6 +49,8 @@ void redraw(void) { + float t = get_sec(); + glClearColor(0.4, 0.6, 1.0, 1.0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); @@ -46,6 +59,7 @@ gl_matrix_mode(GL_MODELVIEW); gl_load_identity(); gl_translatef(0, 0, -8); + gl_rotatef(t * 100.0, 0, 0, 1); bind_texture(tex, 0); set_uniform_int(prog, "tex", 0); @@ -95,3 +109,28 @@ } return prog; } + + +#ifdef IPHONE +#include + +static float get_sec(void) +{ + static float first; + static int init; + + if(!init) { + init = 1; + first = CACurrentMediaTime(); + return 0.0f; + } + return CACurrentMediaTime() - first; +} + +#else + +static float get_sec(void) +{ + return (float)glutGet(GLUT_ELAPSED_TIME) / 1000.0f; +} +#endif