如何使用 PIXI.js 在片段着色器中传递和混合纹理?我有这样的制服:
uniforms = {
uResolution: new PIXI.Point(800, 600),
texture: { value: new PIXI.Texture.from('img link here')}
}
我有这个片段着色器:
#ifdef GL_ES
precision mediump float;
#endif
// Uniforms from Javascript
uniform vec2 uResolution;
uniform float uScrollProgress;
// The texture is defined by PixiJS
varying vec2 vTextureCoord;
uniform sampler2D uSampler;
uniform sampler2D texture;
void main() {
// Normalized coordinates
vec2 uv = gl_FragCoord.xy / uResolution.xy;
vec4 pixel = texture2D(texture, vTextureCoord);
gl_FragColor = pixel;
}
我应该在片段着色器中做什么,例如,在屏幕上绘制我的纹理?我现在的例子有一个错误:
Uncaught TypeError: texture.castToBaseTexture is not a function
一只名叫tom的猫
呼唤远方
相关分类