📜  opengl 0 deltatime - 无论代码示例

📅  最后修改于: 2022-03-11 14:55:15.592000             🧑  作者: Mango

代码示例1
while (running) {
    if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {

        if (msg.message == WM_QUIT) {
            running = false;

            break;
        } else {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }
    } else {
        clock_t last = clock();
        deltaTime = last-start;

        //if ((double)deltaTime >= 16.666666666) {
        fps++;
        millis += deltaTime;
        start = last;

        if (millis > 1000) {
            millis = 0;
            std::cout << "FPS: " << fps << std::endl;
            fps = 0;
        }

        openglContext.renderScene();
        //}
    }
}