expo / expo-three

Utilities for using THREE.js on Expo
MIT License
738 stars 89 forks source link

Cannot load texture from URI from phone device #236

Closed TeamBaconn closed 2 years ago

TeamBaconn commented 2 years ago

Hi, i'm using expo three in my react-native project. I can not load texture from URI using expo three TextureLoader and apply it onto my object. This method only work on web, not my iphone. Here is my snack: https://snack.expo.dev/@baconn00/three This is on the snack image This is what my phone looks like image I would be appreciated for any help, thankyou

danmaas commented 2 years ago

With Expo SDK 45, I bisected versions of three and found that TextureLoader.load(url) works fine with three <= 0.135 and does not work with three >= 0.136.

Between 0.135 and 0.136, there were changes to how GL textures are uploaded in src/renderers/webgl/WebGLTextures.js. I suspect these changes made three's texture uploads no longer work with latest versions of the Expo SDK.

My working versions:

    "expo": "^45.0.0",
    "expo-gl": "~11.3.0",
    "expo-gl-cpp": "~11.3.0",
    "expo-three": "~6.0.1",
    "three": "^0.135.0",

Here is an Expo Snack that reproduces the issue on Expo SDK 45: https://snack.expo.dev/@maas38288/web-texture-issue If you open the app on Android, then go into package.json and change the version of "three" from 0.135.0 to 0.136.0, the texture disappears and the cube renders as black.