dimanche 19 avril 2015

How to use externally generated textures with three.js

I am using three.js hosted on node.js. I am using it with a camera that can generate opengl textures as output frames. I would like to use this live stream of textures within three.js. I have been able to create shared contexts between the camera and three.js, and i can confirm that the texture exists in both the camera context and the three.js context. I am not quite sure tho how to get three.js to respect an externally maintained texture. The existing videotexture object is not the right way, it copies over framedata from a browser dom object, and i would like to use the camera-generated texture directly.


Since this is akin to the threejs render-to-texture support, only with the rendering happening outside threejs, I tried to modify that code to support external textures, but it seems like a bit of a slog.


I'm currently thinking I should implement a variant of the shadermaterial object which understands how to work with an externally generated texture, but was wondering if there is a better path.


Aucun commentaire:

Enregistrer un commentaire