I encountered a problem while trying to render in a thread other than the main one. I currently have different threads running in my app, each one with its shared AGL context, and everything was working fine…
But now I also have to switch rendering to one of those threads on some occasions. When that happens, I’m just hiding my ‘main’ AGL context. Then I create a new AGL context for my thread that will do the rendering, on the fly, bind it to my HIView using aglSetHIViewRef, and then everything goes on using the new AGL context.
Unfortunately, when swapping the buffers, nothing is displayed. I checked that the rendering is done and correct using the GL Profiler, the only thing that is not done is the display of what’s rendered.
I suspect that the cause is the GUI not being thread-safe, but what should I do to go around that (given that the rendering should stay in a separate thread when requested, and I can’t really change that) ?
Thanks for your help !