React-Native: Can anyone explain why some time dynamic texture is not rendering properly

Hello,
Most of the times, Dynamictexture context fill with black. Also sometime getting error like:
internalValidateCopyFromTexture:sourceSlice:sourceLevel:sourceOrigin:sourceSize:toTexture:destinationSlice:destinationLevel:destinationOrigin:options:]:384: failed assertion `Copy From Texture Validation

and app getting crashed!! :smiling_face_with_tear:
Thanks


I love what you are doing here !!! is it a game or a tracker ??? adding the @BabylonNative team regarding the issue

It’s realtime location tracker inside the golf course. But I’m facing such types of issue in react-native, But on the web it run smoothly :sweat_smile: :sweat_smile: :smiling_face_with_tear: :smiling_face_with_tear:

Might be related to React native update dynamic texture error occurring

@Suman Can you please try to repro in a sample like GitHub - BabylonJS/BabylonReactNativeSample
It will be so much easier to fix it with an example. Also, does it happen on Android and iOS? Can you post a callstack when that crash happens?

Hey,

This is happening on both of android and IOS and more particularly when using more dynamicTexture context to drawImage, fillText etc. But It is working smoothly with less DynamicTexture. Providing a repo will take lot of time right now and it would be really helpful if you can kindly provide any solution for now.

I’d be glad to provide you a solution …but without a repro, it’s close to impossible.

1 Like

Hey

Here is the repo @Cedric

Multiple time hit click on the button the sphere texture get black. I just try to implement my scenario where I’m getting the issue.

Thanks

2 Likes

Thanks! I’ll take care of this bug in the coming days!

1 Like

I’ve open a Github issue to not lose track of it : Dynamic texture lifecycle · Issue #1205 · BabylonJS/BabylonNative · GitHub

2 Likes

Hello, anyone have any suggestions for avoiding such scenario until the bug is fixed ?

Hi @Cedric is there have any alternative of DynamicTexture for 2D drawing on a mesh and adding text to the scene.

I think you can still use DynamicTexture if you do updates less frequently.
There is also this possibility : Fast, dynamic 3D text in any TrueType font
If you use a baked texture, it will work for sure.

Does this scenario occurs only for frequently updating dynamicTexture or dispose dynamicTexture + update DynamicTexture ?

I think so.
You can try this code snippet :

Also, don’t forget to read the .ttf font before :

You will have to adapt it a bit with react native but the core will be the same.

2 Likes