Work around emscripten window limitation;
@@ -116,14 +116,8 @@ void lovrGraphicsPresent() {
void lovrGraphicsCreateWindow(int w, int h, bool fullscreen, int msaa, const char* title, const char* icon) {
lovrAssert(!state.window, "Window is already created");
+#ifndef EMSCRIPTEN
if ((state.window = glfwGetCurrentContext()) == NULL) {
-#ifdef EMSCRIPTEN
- glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_ES_API);
- glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
- glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
- glfwWindowHint(GLFW_SAMPLES, msaa);
- glfwWindowHint(GLFW_SRGB_CAPABLE, state.gammaCorrect);
-#else
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
@@ -131,6 +125,12 @@ void lovrGraphicsCreateWindow(int w, int h, bool fullscreen, int msaa, const cha
glfwWindowHint(GLFW_SAMPLES, msaa);
glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);
glfwWindowHint(GLFW_SRGB_CAPABLE, state.gammaCorrect);
+#else
+ glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_ES_API);
+ glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
+ glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
+ glfwWindowHint(GLFW_SAMPLES, msaa);
+ glfwWindowHint(GLFW_SRGB_CAPABLE, state.gammaCorrect);
#endif
GLFWmonitor* monitor = glfwGetPrimaryMonitor();
@@ -157,9 +157,9 @@ void lovrGraphicsCreateWindow(int w, int h, bool fullscreen, int msaa, const cha
glfwMakeContextCurrent(state.window);
glfwSetWindowCloseCallback(state.window, onCloseWindow);
+#ifndef EMSCRIPTEN
}
-#ifndef EMSCRIPTEN
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
glfwSwapInterval(0);
glEnable(GL_LINE_SMOOTH);
