Description
Problem
Currently, as soon as an image src disappears from the uniforms (e.g: moving from uniforms { t: "foo.png" }
to { t: "bar.png" }
), the image/texture allocated to "foo.png"
instantly get cleaned which results of blinks and is especially annoying when you loop over a limited set of images.
We need a way to tell the GL.View
to retain some textures to avoid glitches during loading steps (see for instance the Blur example, switching textures create a blink).
Solutions
Caching: images
prop
images
propWe might want to preload images and ensure they are retained by having a preload={[ array of images ]}
props.
Rendering mode: preload
prop
Now, that raise another interesting use-case: a user may also want to freeze the rendering until all the uniforms are loaded.
Implementation:
gl-react-core
will resolve the array of images to wait & pass-in to implementers. we might handle it in multiple levels in the rendering tree.
LRU cache
We might implement some LRU cache strategy that guess that the image are likely to get re-used (this is advanced, and I would be in favor of giving more control to users).