WebGL: INVALID_OPERATION: uniform1i: location not for current program WebGL: INVALID_OPERATION: uniform1i: location not for current program google-chrome google-chrome

WebGL: INVALID_OPERATION: uniform1i: location not for current program


“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!