This commit is contained in:
amy 2023-05-05 17:18:11 +00:00
parent 76f0b0acce
commit 624ad99130
2 changed files with 7 additions and 3 deletions

View File

@ -5,6 +5,8 @@ optimized build : `clang ./src/*.c -lm -lglfw -lGL -lGLEW -fno-trapping-math`
- find a better epsilon
- fix the fps counter, its probably wrong
# known issues
- glfw & glew causes memory leak (not lost, related to video drivers)

View File

@ -972,9 +972,11 @@ int main(int argc,char*argv[]){
clock_gettime(CLOCK_REALTIME, &end_t);
double tt_diff = (end_t.tv_sec - start_t.tv_sec) * 1000.0 +
(end_t.tv_nsec - start_t.tv_nsec) / 1000000.0;
if(tt_diff>=1000){
printf("%f fps\n",frames);
frames=0;
if(tt_diff>1000){
char fpsc_dis[40];
sprintf(fpsc_dis,"%f fps",(double)(tt_diff/1000*frame_limit)*0.5+frames*0.5);
logm(fpsc_dis);
frames=0;
clock_gettime(CLOCK_REALTIME,&start_t);
}
}