Best way to texSubImage2D [SOLVED]

textures

#1

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!


#2

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


#3

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!


#4

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


#5

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:


#6

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.


#7

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

Try this:

var textureProperties = renderer.properties.get( texture );
console.log( textureProperties.__webglTexture );

#8

I know this is waaaay later since you posted this: but this definitely gives me what I needed now! Thanks :slight_smile: