Archived

This topic is now archived and is closed to further replies.

Multi-threading, MakeCurrent

This topic is 5148 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''ve not tryed this for years, so dont take my word for it
If I remember correctly, you''ll need to sync the threads so only 1 thread can render at the time.
That''ll mean WaitFor...() functions

Share this post


Link to post
Share on other sites
quote:
Original post by Magmai Kai Holmlor
1) Can you swap buffers without changing the context?
2) Can I triple buffer and avoid the bottleneck?


1) I''m affraid each context has its own buffer. So swapping buffers on multiple contexts, requires a current context change.

2) No From the tripple buffers, only 1 can be used for rendering.

You could try giving your 2nd thread a new context of its own. Then render to this context, and after that copy to your main context in a synced function. Maybe via render to texture stuff. (textures can be shared between contexts) But I''m not sure if this is really effective.

Share this post


Link to post
Share on other sites
Hum, I think I''ve figured out a decent method.

I''ll double-buffer the GDI DC, render on the thread, then call SwapBuffer on the DC backbuffer. Then, if/when a paint message comes through, I can blit the already rendered DC (instead of locking a mutex and waiting for the rendering to complete).

Share this post


Link to post
Share on other sites