Support changing the size/resolution of an existing `Texture`
kpreid opened this issue · 2 comments
OpenGL/WebGL allows uploading new image data of arbitrary dimensions to an existing texture, but the luminance
API only allows overwriting texels 1:1 at the originally specified dimensions.
I propose adding a method on Texture
which allows specifying a new size along with the data. This will allow updating a texture to a new size/resolution, without needing to structure code responsible for a single texture so that it also has the GraphicsContext
available (which may be impossible if a pipeline is in progress and the context is therefore borrowed by it).
Use cases I have thought of:
- Resizing a texture atlas to have room for more dynamically created tiles (my use case).
- Streaming asset fetches or expensive procedural generation may upload low-resolution textures before high-resolution ones are available.
Streaming asset fetches or expensive procedural generation may upload low-resolution textures before high-resolution ones are available.
That’s an interesting need. I think it shouldn’t be too hard to add this kind of feature, indeed.
This is now implemented and will get released soon.