Skip to content

Commit

Permalink
fix test of webgl_srgb_textures
Browse files Browse the repository at this point in the history
  • Loading branch information
nianxy committed Nov 27, 2023
1 parent e342da5 commit 68476cf
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions examples/webgl_srgb_textures.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

import * as THREE from '@oppentech/three';

let camera, scene, renderer1, renderer2;
let camera, scene, renderer1, renderer2, texture;

init();

Expand All @@ -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();
Expand All @@ -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 );

}
Expand Down

0 comments on commit 68476cf

Please sign in to comment.