-
Notifications
You must be signed in to change notification settings - Fork 860
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using shared context in mutliple threads #393
Comments
Hmm - I would have expected this code to work. Looking at the code, it looks like this logic got broke in the recent window refactor. BindToContext() should be (but isn't) setting the global Pangolin context (https://github.com/stevenlovegrove/Pangolin/blob/master/src/display/display.cpp#L81) to the one found. If that method blocks, then I have a silly deadlock issue - you can replace the lock with a recursive lock or comment it for a sec. |
Unblocking When calling How is |
I assume that // change class 'X11GlContext' to store framebuffer configuration 'chosenFbc'
if(context==nullptr) {
auto newctx = std::make_shared<X11GlContext>(display, glcontext->chosenFbc);
MakeCurrent(newctx->glcontext);
}
else {
MakeCurrent(global_gl_context.lock()->glcontext);
} |
I am trying to use Pangolin (X11+GLX) from multiple threads, i.e. I am creating a window in the main thread and drawing into this window from another thread.
Here is the modified HelloPangolin example, using a thread to draw into the window:
Getting the context via
pangolin::BindToContext("Main")
blocks the execution ofrun()
.pangolin::FindContext("Main")->MakeCurrent()
returns the same context, but the window is empty (black). Callingrun()
outside of a thread correctly draws the cube.What is the right way to use Pangolin in multiple threads?
Edit: I am getting the empty/black window only on Nvidia cards (with the proprietary driver). It works correctly with Intel GPUs.
The text was updated successfully, but these errors were encountered: