From 68476cfb7414b9445faa5074de27235fdb38b370 Mon Sep 17 00:00:00 2001 From: Cyrus Date: Mon, 27 Nov 2023 12:14:42 +0800 Subject: [PATCH] fix test of webgl_srgb_textures --- examples/webgl_srgb_textures.html | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/examples/webgl_srgb_textures.html b/examples/webgl_srgb_textures.html index 30d1fde11294e9..d5d0b3afecc26e 100644 --- a/examples/webgl_srgb_textures.html +++ b/examples/webgl_srgb_textures.html @@ -35,7 +35,7 @@ import * as THREE from '@oppentech/three'; - let camera, scene, renderer1, renderer2; + let camera, scene, renderer1, renderer2, texture; init(); @@ -52,8 +52,9 @@ const mesh = new THREE.Mesh( geometry, material ); scene.add( mesh ); - new THREE.TextureLoader().load('textures/checkboard.png', ( texture ) => { + new THREE.TextureLoader().load('textures/checkboard.png', ( tex ) => { + texture = tex; texture.encoding = THREE.sRGBEncoding; material.map = texture; animate(); @@ -80,10 +81,10 @@ requestAnimationFrame( animate ); - THREE.Texture.useSrgbTextures = true; + texture.sRGBToLinearWithShader = false; renderer1.render( scene, camera ); - THREE.Texture.useSrgbTextures = false; + texture.sRGBToLinearWithShader = true; renderer2.render( scene, camera ); }