src/textures.js
function setTextureSamplerParameters(gl, target, parameteriFn, options) {
  if (options.minMag) {
    parameteriFn.call(gl, target, gl.TEXTURE_MIN_FILTER, options.minMag);
    parameteriFn.call(gl, target, gl.TEXTURE_MAG_FILTER, options.minMag);
  }
  if (options.min) {
    parameteriFn.call(gl, target, gl.TEXTURE_MIN_FILTER, options.min);
  }
  if (options.mag) {
    parameteriFn.call(gl, target, gl.TEXTURE_MAG_FILTER, options.mag);
  }
  if (options.wrap) {
    parameteriFn.call(gl, target, gl.TEXTURE_WRAP_S, options.wrap);
    parameteriFn.call(gl, target, gl.TEXTURE_WRAP_T, options.wrap);
    if (target === gl.TEXTURE_3D || helper.isSampler(gl, target)) {
      parameteriFn.call(gl, target, gl.TEXTURE_WRAP_R, options.wrap);
    }
  }
  if (options.wrapR) {
    parameteriFn.call(gl, target, gl.TEXTURE_WRAP_R, options.wrapR);
  }
  if (options.wrapS) {
    parameteriFn.call(gl, target, gl.TEXTURE_WRAP_S, options.wrapS);
  }
  if (options.wrapT) {
    parameteriFn.call(gl, target, gl.TEXTURE_WRAP_T, options.wrapT);
  }
  if (options.minLod) {
    parameteriFn.call(gl, target, gl.TEXTURE_MIN_LOD, options.minLod);
  }
  if (options.maxLod) {
    parameteriFn.call(gl, target, gl.TEXTURE_MAX_LOD, options.maxLod);
  }
  if (options.baseLevel) {
    parameteriFn.call(gl, target, gl.TEXTURE_BASE_LEVEL, options.baseLevel);
  }
  if (options.maxLevel) {
    parameteriFn.call(gl, target, gl.TEXTURE_MAX_LEVEL, options.maxLevel);
  }
}
function setTextureSamplerParameters(gl, target, parameteriFn, options) {
  if (options.minMag) {
    parameteriFn.call(gl, target, gl.TEXTURE_MIN_FILTER, options.minMag);
    parameteriFn.call(gl, target, gl.TEXTURE_MAG_FILTER, options.minMag);
  }
  if (options.min) {
    parameteriFn.call(gl, target, gl.TEXTURE_MIN_FILTER, options.min);
  }
  if (options.mag) {
    parameteriFn.call(gl, target, gl.TEXTURE_MAG_FILTER, options.mag);
  }
  if (options.wrap) {
    parameteriFn.call(gl, target, gl.TEXTURE_WRAP_S, options.wrap);
    parameteriFn.call(gl, target, gl.TEXTURE_WRAP_T, options.wrap);
    if (target === gl.TEXTURE_3D || helper.isSampler(gl, target)) {
      parameteriFn.call(gl, target, gl.TEXTURE_WRAP_R, options.wrap);
    }
  }
  if (options.wrapR) {
    parameteriFn.call(gl, target, gl.TEXTURE_WRAP_R, options.wrapR);
  }
  if (options.wrapS) {
    parameteriFn.call(gl, target, gl.TEXTURE_WRAP_S, options.wrapS);
  }
  if (options.wrapT) {
    parameteriFn.call(gl, target, gl.TEXTURE_WRAP_T, options.wrapT);
  }
  if (options.minLod) {
    parameteriFn.call(gl, target, gl.TEXTURE_MIN_LOD, options.minLod);
  }
  if (options.maxLod) {
    parameteriFn.call(gl, target, gl.TEXTURE_MAX_LOD, options.maxLod);
  }
  if (options.baseLevel) {
    parameteriFn.call(gl, target, gl.TEXTURE_BASE_LEVEL, options.baseLevel);
  }
  if (options.maxLevel) {
    parameteriFn.call(gl, target, gl.TEXTURE_MAX_LEVEL, options.maxLevel);
  }
}
function setTextureSamplerParameters ( gl , target , parameteriFn , options ) { if ( options . minMag ) { parameteriFn . call ( gl , target , gl . TEXTURE_MIN_FILTER , options . minMag ) ; parameteriFn . call ( gl , target , gl . TEXTURE_MAG_FILTER , options . minMag ) ; } if ( options . min ) { parameteriFn . call ( gl , target , gl . TEXTURE_MIN_FILTER , options . min ) ; } if ( options . mag ) { parameteriFn . call ( gl , target , gl . TEXTURE_MAG_FILTER , options . mag ) ; } if ( options . wrap ) { parameteriFn . call ( gl , target , gl . TEXTURE_WRAP_S , options . wrap ) ; parameteriFn . call ( gl , target , gl . TEXTURE_WRAP_T , options . wrap ) ; if ( target === gl . TEXTURE_3D || helper . isSampler ( gl , target ) ) { parameteriFn . call ( gl , target , gl . TEXTURE_WRAP_R , options . wrap ) ; } } if ( options . wrapR ) { parameteriFn . call ( gl , target , gl . TEXTURE_WRAP_R , options . wrapR ) ; } if ( options . wrapS ) { parameteriFn . call ( gl , target , gl . TEXTURE_WRAP_S , options . wrapS ) ; } if ( options . wrapT ) { parameteriFn . call ( gl , target , gl . TEXTURE_WRAP_T , options . wrapT ) ; } if ( options . minLod ) { parameteriFn . call ( gl , target , gl . TEXTURE_MIN_LOD , options . minLod ) ; } if ( options . maxLod ) { parameteriFn . call ( gl , target , gl . TEXTURE_MAX_LOD , options . maxLod ) ; } if ( options . baseLevel ) { parameteriFn . call ( gl , target , gl . TEXTURE_BASE_LEVEL , options . baseLevel ) ; } if ( options . maxLevel ) { parameteriFn . call ( gl , target , gl . TEXTURE_MAX_LEVEL , options . maxLevel ) ; } }
Sets the parameters of a texture or sampler
@param {WebGLRenderingContext} gl the WebGLRenderingContext
@param {number|WebGLSampler} target texture target or sampler
@param {function()} parameteriFn texParamteri or samplerParameteri fn
@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.
@private
Sets the parameters of a texture or sampler