Frame-independant-rendering... (timers)
The above values (anonymous poster) are probably more accurate than the ones I mentioned :-)
Thanks for all your replies Anyoumous poster with the code...
Would "doframe()" be to render the frame? and everything before it to update the scene?
Would "doframe()" be to render the frame? and everything before it to update the scene?
Here is how I do mine...
Edited by - blide on July 20, 2000 2:45:06 AM
bool notDone = TRUE;while(notDone){ if(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) { if(msg.message == WM_QUIT) notDone = FALSE; TranslateMessage(&msg); DispatchMessage(&msg); } else { if(gtimer.istime()) //gtimer is for graphics { //update frames here } if(itimer.istime()) //itimer is for input { //poll keyboard and mouse }} [/source] By the way...my timers are using QueryPerformanceCounter...this seems to work very well for me.So how I use the performance timer is something like:[source]QueryPerformanceFrequency(cps); //i dont remember if it returns //or uses argumentctime = cps / fps; //fps is whatever frames per second you wantQueryPerformanceCounter(lasttime);//that WAS the init//here IS the istime()bool istime(){ QueryPerformanceCounter(currenttime); if(pasttime + ctime >= currenttime) return TRUE; else return FALSE;}
Edited by - blide on July 20, 2000 2:45:06 AM
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement