I have two engines. One for 2D and one for 3D. Both OpenGL and SDL2 based. And I need to draw the
output of the second engine under the output of the second. Do not ask why… (actually you may ask)
I’m afraid I cannot use them one by one at the same GL context, because they both have a bit complex set of states, that conflicting and is very tricky to save/restore between.
So I’m thinking about how to run them in separate threads within separate GL contexs. One (secondary) thread renders its part of scene to some shared object and then another thread (main) renders its part to the screen and puts results of first thread to the screen.
What kind of shared object is better to use? Texture? UBO? just Surface? Will it be portable on different driver implementations?
Or that’s better to do my best in implementing save/restore state mechanism to combine them both in main thread?
Also, could you please share relevant tutorials/examples links, if you have any? Most of googlable links are too basic and the rest is a bit irrelevant or strange.