I wish to be able to take the binary visual data and send it to my game engine program from electron. Currently I use Chromium Embedded with Java and JMonkeyEngine 3, the image data from Chromium embedded goes to a JMonkeyEngine 3 image texture and renders to the screen. I can then do many transformation such as changing the image by sending its data through OpenCV for image processing or placing the image data on a rotating cube and so on.
I want to be able to have the capability to do the same with image data from Electron for the reason that it is easy to control Electron from Javascript and Electron is also a reasonable platform to code within.
Can this be done? How difficult is it to do? Is there more than one way to achieve this?
I would also like to be able to embed Atom.io in my application through this method.
I'm willing to pay for it if someones interested to write code for money but I'd like to know how much effort it is roughly or if its even feasible before offering an amount and I'm not sure if anyone's interested to for for money.
@PhilAndrew I'm not an electron maintainer, nor officially affiliated with that project. However, since you reached me directly, and since I'm interested in the matter, I'll give my 2 cents
This is probably doable and you can probably get it done with a solid bounty. The large issue I see with that is the way Electron apps are structured/entered in, and that's a central JS entry point.
Electron is more of a "shell" that can control all the desktop APIs, rather than a pure web renderer.
Therefore this would require new mode/paradigm.
I'd suggest looking for something more specific for the purpose - see Coherent GT and Coherent UI - both commercial, I'm not directly affiliated with them either, but I know they're very good in performance. Possible drawbacks are incompatibilities/lack of APIs to WebKit, and lack of Node.js integration like Electron. But they are built _specifically for games, specifically with performance in mind, specifically to render in texture_.
You can use the webContents.beginFrameSubscription
API for this purpose:
http://electron.atom.io/docs/v0.37.2/api/web-contents/#webcontentsbeginframesubscriptioncallback
It is contributed by @brenca, and I think it is exactly for the use case like yours.
Yepp, I contributed this for a very similar usecase, you should be able to use it for rendering onto a 3D texture. Performance could be improved further in the future, but that would take a lot more work, and for now it works pretty well imo. :)
Most helpful comment
You can use the
webContents.beginFrameSubscription
API for this purpose:http://electron.atom.io/docs/v0.37.2/api/web-contents/#webcontentsbeginframesubscriptioncallback
It is contributed by @brenca, and I think it is exactly for the use case like yours.