MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / gears_idle

Function gears_idle

test/full_es2_sdlproc.c:582–612  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

580}
581
582static void
583gears_idle(void)
584{
585 static int frames = 0;
586 static double tRot0 = -1.0, tRate0 = -1.0;
587 double dt, t = glutGet(GLUT_ELAPSED_TIME) / 1000.0;
588
589 if (tRot0 < 0.0)
590 tRot0 = t;
591 dt = t - tRot0;
592 tRot0 = t;
593
594 /* advance rotation for next frame */
595 angle += 70.0 * dt; /* 70 degrees per second */
596 if (angle > 3600.0)
597 angle -= 3600.0;
598
599 glutPostRedisplay();
600 frames++;
601
602 if (tRate0 < 0.0)
603 tRate0 = t;
604 if (t - tRate0 >= 5.0) {
605 GLfloat seconds = t - tRate0;
606 GLfloat fps = frames / seconds;
607 printf("%d frames in %3.1f seconds = %6.3f FPS\n", frames, seconds,
608 fps);
609 tRate0 = t;
610 frames = 0;
611 }
612}
613
614static const char vertex_shader[] =
615"attribute vec3 position;\n"

Callers 1

mainFunction · 0.70

Calls 1

printfFunction · 0.85

Tested by

no test coverage detected