Is it possible to use GetNativeTexturePtr in the webplayer to get a reference to a texture, and then pass this pointer out of Unity to another web app?
Background:
------------------------
I'm trying to load a large number of images into a webplayer application - we're talking up to 3000 images at 4096x2048. Trying to load all of those into Unity just doesn't work - it lags the application (since Texture2D operations happen on the main thread), and even DXT compressed it's gigs of memory.
There are potential solutions: stream the images as needed from the backend as jpgs and use unmanaged code to overwrite the texture memory without hiccuping Unity, or use a video, for instance. Of course, unmanaged code isn't allowed with the webplayer security model, and MovieTextures are broken (can't rewind, can't seek, duration returns -1 until you play, can't change speed, etc.).
Question in more detail:
------------------------
The only solution I can see is to try and use both Unity and another app - maybe Silverlight, which theoretically allows unmanaged code. If I can somehow get a pointer to a unity texture on the GPU in that other app, then it can manage the images / video and overwrite the texture without hiccuping Unity.
Is what I'm describing possible? I've only seen one discussion of it (http://stackoverflow.com/questions/19703807/how-to-send-native-texture-ptr-from-unity-web-player-to-a-browser-plug-in), however it sounds like I may not be able to use a pointer from the web player in another app. I'm not honestly familiar enough with unmanaged code and texture pointers to know what to try and what's just not possible. What about Texture2D.CreateExternalTexture - any possibilities there?
Alternatively, any thoughts on ways to work within Unity to make this happen? I only actually need one texture displayed at any time, but I need to be able to scrub forward and back through them at 60 fps. Unfortunately, loading a 4096x2048 texture stutters Unity - I haven't found a way around it.
↧