Three.js textures that work with a CanvasRenderer but display as black with WebGLRenderer

I draw an image on the canvas (using the cityTexture method at http://haldean.github.com/citycanvas/city.js ) and then using it as a texture. This works fine when I use the .js CanvasRenderer tag, but when using WebGLRenderer the textures appear as black. I generate textures as squares with side lengths of 256.

The demo and code are here, with the CanvasRenderer at the top, and a snapshot of the WebGLRenderer at the bottom: http://haldean.github.com/citycanvas/3d.html

This will not be a problem, except that the performance of the CanvasRenderer is pretty poor when a lot of geometry is rendered, and WebGL seems to work much better. (With that in mind, if anyone has any suggestions to make the CanvasRenderer more efficient, that would be great too.) Thanks!

0
source share
1 answer

The problem is resolved: I need to add mesh.dynamic = true to my grid and texture.needsUpdate = true to my texture.

+1
source

Source: https://habr.com/ru/post/1445729/


All Articles