How to pass and mix textures in fragment shader with PIXI.js? I have a uniforms like this:
uniforms = {
uResolution: new PIXI.Point(800, 600),
texture: { value: new PIXI.Texture.from('img link here')}
}
And I have this fragment shader:
#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;
}
What should I do in fragment shader, for example, to draw my texture on the screen? I have an error in my example now:
Uncaught TypeError: texture.castToBaseTexture is not a function