function createAttributeSetters(gl, program) {
    var attribSetters = {
    };

    function createAttribSetter(index) {
      return function(b) {
        gl.bindBuffer(gl.ARRAY_BUFFER, b.buffer);
        gl.enableVertexAttribArray(index);
        gl.vertexAttribPointer(
            index, b.numComponents || b.size, b.type || gl.FLOAT, b.normalize || false, b.stride || 0, b.offset || 0);
      };
    }

    function createMatAttribSetter(index, typeInfo) {
      var defaultSize = typeInfo.size;
      var count = typeInfo.count;

      return function(b) {
        gl.bindBuffer(gl.ARRAY_BUFFER, b.buffer);
        var numComponents = b.size || b.numComponents || defaultSize;
        var size = numComponents / count;
        var type = b.type || gl.FLOAT;
        var typeInfo = typeMap[type];
        var stride = typeInfo.size * numComponents;
        var normalize = b.normalize || false;
        var offset = b.offset || 0;
        var rowOffset = stride / count;
        for (var i = 0; i < count; ++i) {
          gl.enableVertexAttribArray(index + i);
          gl.vertexAttribPointer(
              index + i, size, type, normalize, stride, offset + rowOffset * i);
        }
      };
    }

    var numAttribs = gl.getProgramParameter(program, gl.ACTIVE_ATTRIBUTES);
    for (var ii = 0; ii < numAttribs; ++ii) {
      var attribInfo = gl.getActiveAttrib(program, ii);
      if (!attribInfo) {
        break;
      }
      var index = gl.getAttribLocation(program, attribInfo.name);
      var typeInfo = attrTypeMap[attribInfo.type];
      if (typeInfo) {
        attribSetters[attribInfo.name] = createMatAttribSetter(index, typeInfo);
      } else {
        attribSetters[attribInfo.name] = createAttribSetter(index);
      }
    }

    return attribSetters;
  }
Creates setter functions for all attributes of a shader
program. You can pass this to {@link module:twgl.setBuffersAndAttributes} to set all your buffers and attributes.

@see {@link module:twgl.setAttributes} for example
@param {WebGLProgram} program the program to create setters for.
@return {Object.<string, function>} an object with a setter for each attribute by name.
@memberOf module:twgl/programs