Portability fixes to OpenGL example application (courtesy of djoshea)

This commit is contained in:
ocornut 2014-08-12 11:21:47 +01:00
parent 150ad95bd6
commit 8825545653

View File

@ -191,13 +191,13 @@ void InitGL()
if (!glfwInit()) if (!glfwInit())
exit(1); exit(1);
//glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
//glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
//glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
//glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
glfwWindowHint(GLFW_REFRESH_RATE, 60); glfwWindowHint(GLFW_REFRESH_RATE, 60);
glfwWindowHint(GLFW_RESIZABLE, GL_FALSE); glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);
window = glfwCreateWindow(1280, 720, "ImGui OpenGL example", nullptr, nullptr); window = glfwCreateWindow(1280, 720, "ImGui OpenGL example", NULL, NULL);
glfwMakeContextCurrent(window); glfwMakeContextCurrent(window);
glfwSetKeyCallback(window, glfw_key_callback); glfwSetKeyCallback(window, glfw_key_callback);
@ -207,8 +207,10 @@ void InitGL()
glewExperimental = GL_TRUE; glewExperimental = GL_TRUE;
glewInit(); glewInit();
GLenum err = GL_NO_ERROR; // After calling glewInit() our GL error state may be GL_INVALID_ENUM
err = glGetError(); IM_ASSERT(err == GL_NO_ERROR); const GLenum err = glGetError();
(void)err;
IM_ASSERT(err == GL_NO_ERROR || err == GL_INVALID_ENUM);
} }
void InitImGui() void InitImGui()