c++ - GLFW - Window takes 2 seconds to open -


i have started learn opengl api using https://www.learnopengl.com/ , using code hello window tutorial open new glfw window. however, not quite right console opens when executed window takes 2 seconds open. using visual studio debugger have found glfwcreatewindow() seems culprit no information seems exist on why slow me.

the code goes follows:

#include <glad/glad.h> #include <glfw/glfw3.h>  #include <iostream>  void processinput(glfwwindow* window); void framebuffersizecallback(glfwwindow* window, int width, int height);  int main() {     glfwinit();     glfwwindowhint(glfw_context_version_major, 3);     glfwwindowhint(glfw_context_version_minor, 3);     glfwwindowhint(glfw_opengl_profile, glfw_opengl_core_profile);      glfwwindow* window = glfwcreatewindow(800, 600, "opengl test", nullptr, nullptr); //this line takes 2 seconds execute     if (window == nullptr)     {         std::cout << "failed instantiate glfw window!" << std::endl;         glfwterminate();         return -1;     }     glfwmakecontextcurrent(window);     glfwsetframebuffersizecallback(window, framebuffersizecallback);      if (!gladloadglloader((gladloadproc)glfwgetprocaddress))     {         std::cout << "failed initialise glad" << std::endl;         return -1;     }      while (!glfwwindowshouldclose(window))     {         processinput(window);          glfwswapbuffers(window);         glfwpollevents();     }      glfwterminate();      return 0; }  void processinput(glfwwindow* window) {     if (glfwgetkey(window, glfw_key_escape) == glfw_press)     {         glfwsetwindowshouldclose(window, true);     } }  void framebuffersizecallback(glfwwindow* window, int width, int height) {     glviewport(0, 0, width, height); } 

i using visual studio 2017 , have tried running in debug , release mode using different glfw libs avail.

nevermind, turns out had set preferred graphics processor in nvidia control panel gpu rather auto-select causing program load in many opengl extensions using gpu , therefore take longer open window. after changing setting, window opens in more reasonable time of 500 milliseconds using integrated graphics.


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -