问题
- I have video tag and he plays simple video. [works]
- I have canvas2d with playing same video [works]
- opencvjs video processing (canvas is output , video is input)- also works
- I have three.js with plane mesh
texture = new THREE.CanvasTexture(this.$refs.testcanvas)
texture.needsUpdate = true;
materialLocal = new THREE.MeshBasicMaterial({ map: texture })
materialLocal.needsUpdate = true;
materialLocal.map.needsUpdate = true;
this.mainVideoMesh.material = materialLocal
this.mainVideoMesh.material.needsUpdate = true;
No hepls . I got just first image screen texture and than stops updating.
In runtime i found ->
this.scene.children[2].material.map.needsUpdate: undefined
Strange situation any suggestion.
回答1:
When using a video as a data source for a texture, the idea is to use the THREE.VideoTexture class. This type of texture will automatically manage its needsUpdate
flag in order to ensure new frames are correctly displayed on your plane mesh.
Using THREE.VideoTexture
requires that you use the video element as an argument, not the canvas.
来源:https://stackoverflow.com/questions/64249319/three-canvastexture-needsupdate-no-helps