how to enable vertical sync in opengl?

后端 未结 3 775
隐瞒了意图╮
隐瞒了意图╮ 2020-12-02 16:52

How do you enable vertical sync?

Is it something simple like glEnable(GL_VSYNC)? (though there\'s no such thing as GL_VSYNC or anything like it in the o

3条回答
  •  囚心锁ツ
    2020-12-02 17:26

    ((BOOL(WINAPI*)(int))wglGetProcAddress("wglSwapIntervalEXT"))(1);
    

    google: wglSwapIntervalEXT
    https://www.khronos.org/opengl/wiki/Swap_Interval

    "wglSwapIntervalEXT(1) is used to enable vsync; wglSwapIntervalEXT(0) to disable vsync."

    "A swap interval of 1 tells the GPU to wait for one v-blank before swapping the front and back buffers. A swap interval of 0 specifies that the GPU should never wait for v-blanks"

提交回复
热议问题