three-text2d icon indicating copy to clipboard operation
three-text2d copied to clipboard

Re-use the same texture for all text instances to reduce draw calls

Open endel opened this issue 9 years ago • 2 comments

As reported by @gpolyn here http://stackoverflow.com/questions/37194082/consolidate-three-js-sprite-draw-calls-into-one

endel avatar May 12 '16 18:05 endel

Thanks @endel.

To confirm, the following three.js example has as many draw calls as sprites, even though texture is reused: threejs.org/examples/#webgl_sprites

(A similar motivation, I think, prompted development at github.com/Leeft/three-sprite-texture-atlas-manager.)

gpolyn avatar May 12 '16 19:05 gpolyn

For other interested readers, here are some (of Endel's) thoughts on approaches for the fix:

1. Have a single texture in the GPU for all text instances 2. Re-position all texts every time a new instance is created/removed 3. Have a "destroy" method, to remove the text from the texture 4. Re-use coordinates when the same text input is given

gpolyn avatar May 12 '16 21:05 gpolyn