Best way to texSubImage2D



I am trying to update small chunks of a texture after the texture has been made and is in use. I was wondering if three has a standard way of doing this or if it’s just expected to use the webgl methods directly.

Thanks for any help!


No, there is no API/support so far but a feature request on github :wink:


Thanks :slight_smile: I couldn’t find that discussion with ze googles. Surprised something hasn’t been implemented yet!

Guess it’s time to bust out the raw gl on this one for now!


What kind of API would you expect of three.js in this context? Any ideas/suggestions?


Hmmmm I may not be the best for suggestions on this one.

I saw that the discussion in the article was trying to be super smart about it and provide essentially a lookup system for a given major texture; however, I prefer writing my own systems for all that jazz.

To be honest: All I really wanted out of Threejs for the texture was something like

myTexture.modify(bounds, ImageData);

and I would have been exceptionally happy :slight_smile:


I do have another question though: Is there anyway to access a WebGLTexture object from the ThreeJS Texture object? I’m trying to sub tex on it so I can manipulate it myself, but again can’t find a good answer there.


We now have a merged PR that adds support for texSubImage2D. I hope it adresses your requirements :blush:

Try this:

var textureProperties = texture );
console.log( textureProperties.__webglTexture );