-
Notifications
You must be signed in to change notification settings - Fork 9
Closed
emscripten-core/emscripten
#25972Description
As per the documentation, passing in NULL (or nullptr) into glfwMakeContextCurrent should detach the context from calling thread. This library instead emits an error into error callback with an error code GLFW_INVALID_VALUE and a message "window parameter invalid".
This code, for example, doesn't produce the same result compared to with original implementation:
glfwInit();
auto window = glfwCreateWindow(800, 600, "hello glfw", nullptr, nullptr);
glfwMakeContextCurrent(window);
// ...
auto current = glfwGetCurrentContext();
assert(current == window); // ok in both
// ...
glfwMakeContextCurrent(nullptr);
current = glfwGetCurrentContext();
assert(current == nullptr); // fail in emscripten-glfw; the current context unchangedI traced the problem to this code, where iWindow with nullptr value is not handled differently and is passed directly to getWindow which then reports an error:
emscripten-glfw/src/cpp/emscripten/glfw3/Context.cpp
Lines 856 to 865 in 09b60c7
| void Context::makeContextCurrent(GLFWwindow *iWindow) | |
| { | |
| auto window = getWindow(iWindow); | |
| if(window) | |
| { | |
| fCurrentWindow = window; | |
| fCurrentWindowOpaquePtr = iWindow; | |
| fCurrentWindow->makeGLContextCurrent(); | |
| } | |
| } |
Metadata
Metadata
Assignees
Labels
No labels