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

1

1

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.

Insure answered 31/10, 2013 at 10:20 Comment(0)
I
1

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.

Intrust answered 31/10, 2013 at 15:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.