I'm trying to set up a timer in my app, here is the declaration of const. :
double debut, fin,freq; //for timer : start, end, frequency...
float delta_time; //delta in sec. between start/end
another const. is fps, a float.
and here is how i implemented the timer :
QueryPerformanceCounter((LARGE_INTEGER*)&debut); //capture the timer before drawing
do
{
if(active && !DrawGLScene())
done = true;
QueryPerformanceCounter((LARGE_INTEGER*)&fin); //capture the timer after drawing
delta_time = (fin-debut)/QueryPerformanceFrequency((LARGE_INTEGER*)&freq);
}while(delta_time==0);
fps=1/delta_time;
it compiles with a warning : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
in fact, the app freeze and stay in the infinite in the do..while loop...
i suppose it's a type problem - see warning - but i don't know what to do : i tried many things, but at the best the fps is a small 0