Pass ClientContext from Unity to plugin to RenderManager
DuFF14 opened this issue · comments
In reference to: ca5227c
Given the declaration:
extern "C" OSVR_ReturnCode EXPORT_API CreateRenderManagerFromUnity(OSVR_ClientContext ctx)
And in Unity:
[DllImport(PluginName, CallingConvention = CallingConvention.StdCall)]
private static extern Byte CreateRenderManagerFromUnity(IntPtr /*OSVR_ClientContext*/ ctx);
(@JeroMiya has noted that the IntPtr above should be a SafeClientContextHandle which is currently not exposed. SafeClientContextHandle maps to OSVR_ClientContext.)
What is the proper way to cast OSVR_ClientContext so that it can be passed to RenderManager::createRendermanager ?:
RenderManager *createRenderManager(clientkit::ClientContext &context
, std::string displayConfigJsonFileName
, std::string pipelineConfigJsonFileName)
ah, so that clientkit::ClientContext
is the C++ wrapper around the client context. Trying to think if I can make a non-owning constructor.
After @JeroMiya changed the render manager to use the client kit C api, I'm able to successfully pass a ClientContext from Unity and create a RenderManager.
Wasn't having success passing an IntPtr, so I also added a property in Managed-OSVR ClientKit.cs:
public SafeClientContextHandle Context
{
get { return m_context; }
}
I can push this to Managed-OSVR if this is acceptable.