简体   繁体   中英

How to send native texture ptr from Unity web player to a browser plug-in?

I have written an NPAPI browser plug-in (using Firebreath ) that Unity uses to access a Kinect camera. I can retrieve skeleton data from Unity through JavaScript easily since it isn't too big, but the problem is in retrieving color image data.

Is it possible to send a native texture pointer ( GetNativeTexturePtr ) from Unity through JavaScript into the C++ plug-in so that it can write the texture data directly? (tested in standalone version and it works)

Any other suggestions on how to transfer image data from browser plug-ins to Unity web player are very welcome.

Unfortunately NPAPI plugins do not contain any mechanisms for exchanging binary data with the page. Probably the most performant way of doing that that I know of would be to base64 encode it and send it as part of a string.

Note that strings in NPAPI are UTF8.

The only way to get anything from Unity in your plugin would be to use the javascript interface, so you can use whatever methods you can find and then pass the data into your plugin; however, note that Unity is most likely running in another process, so you probably can't use any direct memory pointers that you might get from it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM