Hi NG,
two questions:
1) how can determine the size of the window decoration of
a glut window? my window is slightly displaced when i re-init it....
2) i want to put a fps-throttle in my program so i added the following
code to the end of my display func which is registered via
glutDisplayFunc():
...
ltime.tv_sec=ttime.tv_sec;
ltime.tv_usec=ttime.tv_usec;
gettimeofday(&ttime,NULL);
if (ttime.tv_sec-ltime.tv_sec)
sec=(1000000-ltime.tv_usec)+ttime.tv_usec;
else sec=ttime.tv_usec-ltime.tv_usec;
if(sec<40000)
{ sec=((40000-sec)*1000);
wtime.tv_sec=0; wtime.tv_nsec=sec;
nanosleep(&wtime,NULL);
}
glutSwapBuffers();
whileQuote:}
struct timeval ltime,ttime;
struct timespec wtime;
long sec;
and a
gettimeofday(&ttime,NULL);
is done in the normal init of the program so the time struct is not
empty
but it differs about 7 milliseconds (31fps instead of 25 fps)
i tried usleep() and select(0,NULL,NULL,NULL,&timeout) too.. same
effect
i also tried to do it via a glut timer callback but its too slow then
(20fps)
gettimeofday seems to give me correct values (~15000microsecs/frame)
i have no idea what i could do ...
thanks in advance