Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uniforms Texture cannot read image assets in release build (Without metro server) - ract native #259

Open
lakinduakash opened this issue Jul 10, 2020 · 1 comment
Labels
Expo this is related to Expo

Comments

@lakinduakash
Copy link

bug report

library version

"gl-react": "^4.0.1",
"gl-react-native": "^4.0.1"

npm ls gl-react gl-react-dom gl-react-native gl-react-expo # Please run and paste the output of this

Petstagram@0.0.1 /home/lakinduakash/revokex/projects/pets_mobile/Petstagram
├── gl-react@4.0.1 
└─┬ gl-react-native@4.0.1 
  └── gl-react-expo@4.0.1 
MyShader: {
        frag: `
      precision highp float;
      varying vec2 uv;

      uniform sampler2D inputImageTexture;
      uniform sampler2D inputImageTexture2;
     ..............
     ..............
export const Effect = ({children: inputImageTexture}) =>
    <Node
        shader={shaders.MyShader}
        uniforms={{
            inputImageTexture,
            inputImageTexture2: require('../assets/filters/map.png'),
        }}
    />;

<Surface style={{height: wp(100), width: wp(100)}} ref={image}>
        <Effect>
           {{uri:imgPath}}
       </Effect> 
</Surface>

Platform: Android 9.0
"react-native": "^0.62.0"

When metro server is enabled Shader is applied to the child image(uri:imgPath). But when debugger is disconnected from computer ,shader won't work.It just display empty background. Same issue in release build apk.

I assume the issue is in {inputImageTexture2: require('../assets/filters/map.png')} cannot get the image assets when metro server is disconnected. Without any external texture maps, shaders works without any issue even metro server is not running. Is there any other way to refer image assets. React native won't add those images into android apk's asset folder. I also manually put those images into asset folder. None of them worked. I identified react native compress those images and put them into android's resource folder.

Expected behavior

Apply textures external image sources in all variants of build. Even without metro server

Actual behavior

External image textures won't apply when metro server is disconnected and release build also

Steps to reproduce the behavior

  • Create any shader script that apply external image.
  • Then in Node's uniform from give the image assets with require() tag.
  • Build release apk or disconnect from metro server, restart the app
@lakinduakash lakinduakash changed the title uniforms Texture cannot read image assets in release build (Without metro server) uniforms Texture cannot read image assets in release build (Without metro server) - ract native Jul 10, 2020
@gre gre added the Expo this is related to Expo label Dec 26, 2020
@maxximee
Copy link

@lakinduakash Have you found a solution?
It's now August 2023 and I have the same issue, it's killing me I've been trying to fix this for a week now. I've tried preloading the image, manually adding it in the assets/drawable...
iOS works fine in release as well, but I can't build my Android Release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Expo this is related to Expo
Projects
None yet
Development

No branches or pull requests

3 participants