Can some one please provide example code on how to use Texture2D.CreateExternalTexture and Texture2D.UpdateExternalTexture with DX11? Also, DOES UNITY ANSWER ANYTHING IN THIS FORUM? I have posted 3 threads related to this issue and there is no reply to anything!!!
In the unity manuals it says:
Description Creates Unity Texture on top of already inited native texture object.
Whoa, I’m going to play with this right now. Do you think we can point it at the texture id of a camera feed or decoded video feed made natively on mobile?
This is mostly a community forum. A number of us Unity-peeps keep an eye on the site and try and help out where we can.
To answer you real question, no, I don’t have a code example. The basic idea is that you’ll have a native code plugin that does something with DX11, most likely creating textures. You’d pass a System.IntPtr from the plugin into the Unity script code and call Texture2D.CreateExternalTexture. Unity then fakes up a Texture2D for you to use in your script code, but, in reality, it’s using your texture from your plugin. As an when you’d want this texture to change, you would call UpdateExternalTexture on it, passing in a new IntPtr from your plugin.
There’s an example that does something similar, but different, here:
Hi
When creating texture with CreateExternalTexture I get something like 5 or 6 ms of GFXWaitForPresent why this is happening? The texture is already created on the native side and uploaded to the GPU if I’m not wrong.
I’m using D3D11.
So please can you explain me what going on