Fix vsync
This commit is contained in:
parent
b5b35992c6
commit
d3fe07c34d
@ -26,6 +26,7 @@
|
||||
|
||||
#include "err.h"
|
||||
#include "filereader.h"
|
||||
#include "gl_draw.h"
|
||||
#include "half_edge.h"
|
||||
|
||||
#include <GL/glut.h>
|
||||
@ -262,7 +263,7 @@ static void draw_Planet_1(void)
|
||||
glColor3f(1.0f, 0.0f, 0.0f);
|
||||
|
||||
/* A rotation (full 360°) once a day is much
|
||||
* too fast you woulden'd see a thing */
|
||||
* too fast you wouldn't see a thing */
|
||||
glRotatef((ROT_FACTOR_PLANET * day) / rot_fac_day, 0.0f, 0.0f, 1.0f);
|
||||
glutWireSphere(1.0f, XY_WIRE_COUNT, XY_WIRE_COUNT);
|
||||
glRotatef((ROT_FACTOR_PLANET * day) / rot_fac_day, 0.0f, 0.0f, -1.0f);
|
||||
@ -490,7 +491,7 @@ void animate()
|
||||
day = 0;
|
||||
}
|
||||
|
||||
usleep(30000); /* some very basic VScny to see the movement better */
|
||||
glutTimerFunc(TIMERMSECS, animate, 0);
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
@ -31,6 +31,12 @@
|
||||
#include <GL/glu.h>
|
||||
|
||||
|
||||
/**
|
||||
* Vsync timer for animate() function
|
||||
*/
|
||||
#define TIMERMSECS 25
|
||||
|
||||
|
||||
void init(char const * const filename);
|
||||
void display(void);
|
||||
void reshape(GLsizei w, GLsizei h);
|
||||
|
@ -73,7 +73,7 @@ int main(int argc, char *argv[])
|
||||
glutKeyboardFunc(keyboard);
|
||||
glutReshapeFunc(reshape);
|
||||
glutDisplayFunc(display);
|
||||
glutIdleFunc(animate);
|
||||
glutTimerFunc(TIMERMSECS, animate, 0);
|
||||
glutMainLoop();
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user