Skip to content

Commit 853bc10

Browse files
authoredSep 24, 2023
fix(useTexture): support experimental universal backend (#1662)
1 parent e590f48 commit 853bc10

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed
 

‎src/core/useTexture.tsx

+5-2
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,12 @@ export function useTexture<Url extends string[] | string | Record<string, string
1919

2020
// https://github.com/mrdoob/three.js/issues/22696
2121
// Upload the texture to the GPU immediately instead of waiting for the first render
22+
// NOTE: only available for WebGLRenderer
2223
useEffect(() => {
23-
const array = Array.isArray(textures) ? textures : [textures]
24-
array.forEach(gl.initTexture)
24+
if ('initTexture' in gl) {
25+
const array = Array.isArray(textures) ? textures : [textures]
26+
array.forEach(gl.initTexture)
27+
}
2528
}, [gl, textures])
2629

2730
if (IsObject(input)) {

1 commit comments

Comments
 (1)

vercel[bot] commented on Sep 24, 2023

@vercel[bot]
Please sign in to comment.