activeTexture — select active texture unit
void activeTexture(GLenum texture);
texture specifies which texture unit to make active. The number of texture units is implementation dependent, but must be at least eight. texture must be between TEXTURE0 and TEXTURE0 + (MAX_COMBINED_TEXTURE_IMAGE_UNITS - 1). The initial value is TEXTURE0.
activeTexture selects which texture unit subsequent texture state calls will affect. The number of texture units an implementation supports is implementation dependent, but must be at least 8.
A common mistake is that when setting an active texture unit activeTexture requires a value between TEXTURE0 and TEXTURE0 + (MAX_COMBINE_TEXTURE_IMAGE_UNITS - 1) where as when telling a program which texture unit to use uniform1i and/or uniform1iv require just 0 to (MAX_COMBINE_TEXTURE_IMAGE_UNITS - 1)
var textureUnit = 3; gl.activeTexture(gl.TEXTURE0 + textureUnit); ... gl.uniform1i(someSamplerLocation, textureUnit);
INVALID_ENUM is generated if texture is not between TEXTURE0 and TEXTURE0 + (MAX_COMBINED_TEXTURE_IMAGE_UNITS - 1).
getParameter with argument ACTIVE_TEXTURE or MAX_COMBINED_TEXTURE_IMAGE_UNITS