I am attempting to update a Unity texture from a native plugin (I’m on Win7).
Prior to Unity 3.5 there were 2 ways of going about this. Utilizing SetPixels32 or forcing Unity to run in OpenGL mode and passing the GL texture ID down to the native code and using OpenGL to do a texture fill. The OpenGL method had some faults due to the fact that forcing OpenGL mode on Windows was kinda unsupported and might yield problems (which in my experiments it did).
In 3.5 and later, I have come to understand that rendering can happen on a different thread than the one the plugin functions are invoked on. So this makes updating the texture OpenGL style problematic. Does this also effect SetPixels32?
What is now the most efficient way to update a texture from a plugin on Windows 7 with Unity3.5.1? I saw that access to the dx device pointer is now possible, but I still run into the rendering thread not necessarily being the same as the plugin thread. I heard there is some kind of callback mechanism, but I am having trouble finding out how to use it for doing plugin texture updates.