wglext - extension not installed in OpenGL context

前端 未结 2 917
春和景丽
春和景丽 2021-01-21 22:10

I am trying to disable vsync in OpenGl with WGL_EXT_swap_control using wglSwapIntervalEXT(int interval).

I am trying to include the wglext header but after much searchin

2条回答
  •  难免孤独
    2021-01-21 23:01

    So, a friend managed to figure this out without glew. So if anyone needs help with it this should be something similar to what you are looking for

    void SetVSync(bool sync)  
    {   
    typedef BOOL(APIENTRY *PFNWGLSWAPINTERVALPROC)(int);
    PFNWGLSWAPINTERVALPROC wglSwapIntervalEXT = 0;
    
    const char *extensions = (char*)glGetString(GL_EXTENSIONS);
    
    wglSwapIntervalEXT = (PFNWGLSWAPINTERVALPROC)wglGetProcAddress("wglSwapIntervalEXT");
    
    if (wglSwapIntervalEXT)
        wglSwapIntervalEXT(sync);
    }
    

提交回复
热议问题