There is a problem when we use these hints funcitons which cause the below statement return a null pointer.
GLFWwindow *window = glfwCreateWindow(WIN_WIDTH, WIN_HEIGHT, "", NULL, NULL );
// Select OpenGL 4.3 with a forward compatible core profile. glfwWindowHint( GLFW_CONTEXT_VERSION_MAJOR, 4 ); glfwWindowHint( GLFW_CONTEXT_VERSION_MINOR, 3 ); glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); glfwWindowHint(GLFW_RESIZABLE, GL_FALSE); glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, GL_TRUE);
solution:comment out glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);or change it to glfwWindowHint(GLFW_OPENGL_ANY_PROFILE, GLFW_OPENGL_CORE_PROFILE);will fix the problem
glfw can't get window
最新推荐文章于 2021-10-21 17:43:21 发布