I’m trying to integrate Urho3D into OBS Studio. I originally planned to render to a texture and send it to OBS Studio, but everything went wrong.
First, I didn’t find a method to export the texture from Urho3D to render to an external application.
Secondly, it turned out that I can render directly in OBS Studio, but it works very strange and I do not know why or how to fix it.
What Urho3D must render:
Urho3D Expected.gif
What was expected:
OBS Expected.png
What i got somehow (just flashing background from Urho3D):
OBS Result.png
(Sorry, new users can attach only 2 links in the post)
I created the Urho3DModule class based on the Urho3D::Object class and created functions for initializing and rendering frames on command.
Inside the plugin code, I initialize Urho3D outside of the OBS Studio OpenGL context:
vtb->context = (new Urho3D::Context());
vtb->myApp = new Urho3DModule(vtb->context, NULL);
vtb->myApp->Setup();
vtb->MyApp->Start ();
Then I call a function that renders the image inside the OBS Studio OpenGL context of OBS Studio:
spv->myApp->UrhoFrame();
In total, I get an empty Urho3D window and a blinking background from Urho3D (the blinking background is intended), but there are no 3d objects. Other initialization combinations (initialize only inside the opengl context or partially) give a segmentation error or no image inside OBS Studio, just in Urho3D window.
I attach a repository with my code. Please help me figure out why it worked at all, and how to do it properly.