我在向着色器发送纹理时遇到问题。这是我正在使用的代码。
uniforms = {
"rightTexture": { type: "t", value: THREE.ImageUtils.loadTexture( "images/doors_right_512.png" ) },
"tDiffuse": { type: "t", value: null },
"aspect": { type: "v2", value: new THREE.Vector2( 512, 512 ) },
};
uniform sampler2D rightTexture;
vec3 sample;
sample = texture2D(rightTexture, vUv).rgb;
gl_FragColor = vec4(vec3(sample), 1.0);
当我对tDiffuse进行采样时,一切看起来都不错,但如果我使用rightTexture,我只会得到黑屏。这是为什么?