function setTextureParameters(gl, tex, options) {
    var target = options.target || gl.TEXTURE_2D;
    gl.bindTexture(target, tex);
    if (options.min) {
      gl.texParameteri(target, gl.TEXTURE_MIN_FILTER, options.min);
    }
    if (options.mag) {
      gl.texParameteri(target, gl.TEXTURE_MAG_FILTER, options.mag);
    }
    if (options.wrap) {
      gl.texParameteri(target, gl.TEXTURE_WRAP_S, options.wrap);
      gl.texParameteri(target, gl.TEXTURE_WRAP_T, options.wrap);
      if (target === gl.TEXTURE_3D) {
        gl.texParameteri(target, gl.TEXTURE_WRAP_R, options.wrap);
      }
    }
    if (options.wrapR) {
      gl.texParameteri(target, gl.TEXTURE_WRAP_R, options.wrapR);
    }
    if (options.wrapS) {
      gl.texParameteri(target, gl.TEXTURE_WRAP_S, options.wrapS);
    }
    if (options.wrapT) {
      gl.texParameteri(target, gl.TEXTURE_WRAP_T, options.wrapT);
    }
    if (options.minLod) {
      gl.texParameteri(target, gl.TEXTURE_MIN_LOD, options.minLod);
    }
    if (options.maxLod) {
      gl.texParameteri(target, gl.TEXTURE_MAX_LOD, options.maxLod);
    }
    if (options.baseLevel) {
      gl.texParameteri(target, gl.TEXTURE_BASE_LEVEL, options.baseLevel);
    }
    if (options.maxLevel) {
      gl.texParameteri(target, gl.TEXTURE_MAX_LEVEL, options.maxLevel);
    }
  }
Sets the texture parameters of a texture.
@param {WebGLRenderingContext} gl the WebGLRenderingContext
@param {WebGLTexture} tex the WebGLTexture to set parameters for
@param {module:twgl.TextureOptions} options A TextureOptions object with whatever parameters you want set.
  This is often the same options you passed in when you created the texture.
@memberOf module:twgl/textures