Rob*_*nto 6 c opengl winapi glfw visual-studio-2015
我是第一次使用GLFW.拉出最新的稳定版本(3.2.1),我正在使用GLFW网站上的示例代码:
#include <GLFW/glfw3.h>
int main(void)
{
GLFWwindow* window;
/* Initialize the library */
if (!glfwInit())
return -1;
/* Create a windowed mode window and its OpenGL context */
window = glfwCreateWindow(640, 480, "Hello World", NULL, NULL);
if (!window)
{
glfwTerminate();
return -1;
}
/* Make the window's context current */
glfwMakeContextCurrent(window);
/* Loop until the user closes the window */
while (!glfwWindowShouldClose(window))
{
/* Render here */
glClear(GL_COLOR_BUFFER_BIT);
/* Swap front and back buffers */
glfwSwapBuffers(window);
/* Poll for and process events */
glfwPollEvents();
}
glfwTerminate();
return 0;
}
Run Code Online (Sandbox Code Playgroud)
对choosePixelFormat()(wgl_context.c)的调用有一个相当长的延迟(大约20秒左右) - nativeCount的值为627,并且在for循环中似乎需要很长时间.
如果我使用freeGLUT创建一个窗口,或者我只是直接用WinAPI调用(CreateWindow等)创建一个窗口并自己设置PFD,那就没有延迟了.
我正在使用Windows 10,首先尝试使用Visual Studio 2015,然后在2017年使用.显卡是NVidia Quadro M6000.
我稍微修改了上面的代码来添加一个初始化glew的调用,但是这次调用与否并没有改变延迟.