I'm trying to setup two textures in my fragment shader but am getting this error if I try setup the corresponding uniform variables with:
gl.uniform1i(getUniformLocation(program, "uTextureOne"), 0);
and gl.uniform1i(getUniformLocation(program, "uTextureTwo"), 1);
.
What does it mean? (I'm using Chrome)
My shader looks like this:
"#ifdef GL_ES \r\n" +
"precision mediump float; \r\n" +
"#endif \r\n" +
"uniform sampler2D uTextureOne; \r\n" +
"uniform sampler2D uTextureTwo; \r\n" +
"varying vec3 vOrgNormal; \r\n" +
"void main(void) { \r\n" +
“Location not for current program” means that the active shader program (gl.useProgram
) is not the program which you obtained the uniform locations from.
If you are using only one shader program, then simply make sure that in your initialization you do gl.useProgram
before you do any gl.uniform…
.
If you are using multiple shader programs, make sure that the correct one is selected before you attempt to set uniform values. Note that uniforms are specific to programs and they are remembered by the programs, so you don't have to re-set them every time you switch programs!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With