Error: 'from' texture should be loaded
Hi,
I am trying to use the ProceduralTextureProvider to do some pixel manipulation in Lens Studio. I have tried to created a temporary texture by calling the following:
var tempTex = ProceduralTextureProvider.createFromTexture(texture);
However I get this error when it's called:
'from' texture should be loaded
I have tried changing the script start event to OnStart, however this hasn't worked. Does anyone know how I can resolve this issue?
Thanks in advance!
The texture you are trying to use should have a load status accessible off the control object like this: texture.control.getLoadStatus()
Which will return a number in order of these:
https://lensstudio.snapchat.com/api/classes/LoadStatus/
So if you wait for that to equal 2, then fire the createFromTexture, it should work.
It sounds like you might be trying to grab the device camera texture (or perhaps this happens with any other texture as well) and that won't be available until after the first frame has updated. Brandon's recommendation is probably your best bet if you are creating that procedural texture just once. If you are doing it every frame then you can change your script trigger to "Frame Updated" like here: https://arbootcamp.com/snapchat-advanced/color-sample
amazing! thanks both for your response :)