- Home /
Creating a Texture or Texture2D from a plugin.
Hello,
I have an Obj-C framework I have written which outputs a GLuint texture ID of a texture that other applications have published to the system. MY framework handles serving the texture from one app as well as reading it back into another app. This basically allows one app to publish a pre-existing texture which another app will pick up and read, without copying or readback, it all stays on the GPU (using IOSurface). This means you can do HD size or greater sharing of textures from one app to the other sans issue. I am trying to write a plugin for Unity to leverage this. I have working plugins for other new media environments.
In order to fit into Unity's Pipeline, the best way to handle this is to essentially make my own Unity "Texture" or Texture2D object which contains the instanceID (which is not documented as, but has been confirmed as having being the same as the TexureID). This way the incoming texture can be mapped to a material and onto a mesh, which keeps the normal Unity pipline functioning.
So basically, does anyone know how to output a "Texture" or Texture2D object from a 3rd party plugin, which contains its own internal texture handle? Please say yes. Its looking less and less like UNity's current plugin setup can handle it. You cant subclass Texture or Texture2D, or even over-ride GetInstanceID() in a Mono script. :(