简体   繁体   English

使用画布three.js使用数据创建纹理

[英]Create a texture with data from a canvas three.js

I am relatively new to Three.js and trying to create a texture from the data in another canvas. 我是Three.js的新手,尝试从另一个画布中的数据创建纹理。

To be more specific - I intend to use Heatmap.js to obtain a heat map. 更具体地说-我打算使用Heatmap.js来获取热图。 The heat-map is returned in another canvas. 热图在另一个画布中返回。 I would then like to use this heatmap as a texture on my scene. 然后,我想将此热图用作场景中的纹理。

Any ideas on how to go about doing this ? 有关如何执行此操作的任何想法?

I tried to create the texture out of that canvas but getting a black texture. 我试图在画布上创建纹理,但得到黑色纹理。

I had a similar problem with black textures. 黑色纹理也有类似的问题。 This may help: 这可能会有所帮助:

// create texture from canvas
var texture = new THREE.Texture(canvas);
// my solution:
texture.needsUpdate = true

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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