我正在尝试重写一个应用程序来支持GLFW3。我遇到的问题是glfwInit()
将返回true,但glfwWindowHint
和glfwCreateWindow
会在程序在GLFW_NOT_INITIALIZED
结束之前反复抛出if (!window)
。
int main( void )
{
GLFWwindow* window;
glfwSetErrorCallback(error_callback);
if( !glfwInit() )
{
exit(EXIT_FAILURE);
}
glfwWindowHint(GLFW_SAMPLES, 4);
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
window = glfwCreateWindow(640, 480, "Test", NULL, NULL);
if (!window)
{
glfwTerminate();
exit(EXIT_FAILURE);
}