Hi! I have been trying to wrap a small offscreen rendering app with pybind. I’ve got all that set up and working, but when I try to initialize and make a GLFW window current, I get this error:
python3: ../libs/glfw/src/posix_thread.c:64: _glfwPlatformGetTls: Assertion `tls->posix.allocated == GLFW_TRUE' failed.
Aborted (core dumped)
Here is where the code fails:
glfwInit();
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GLFW_TRUE);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_COCOA_RETINA_FRAMEBUFFER, GLFW_FALSE);
state.gl_main_context = glfwCreateWindow(640, 480, "MyApp", 0, 0);
glfwMakeContextCurrent(state.gl_main_context); //<--- fails on this line
I have checked that the app works as expected when not wrapped with pybind, so I guess I’m looking for any insight into what might trigger this error or any known gotchas when wrapping with pybind.