lib/create-attributes.js
function createAttributeWrapper(gl, program, attributes, doLink) {
  var obj = {}
  for(var i=0, n=attributes.length; i<n; ++i) {
    var a = attributes[i]
    var name = a.name
    var type = a.type
    var location = gl.getAttribLocation(program, name)
    
    switch(type) {
      case 'bool':
      case 'int':
      case 'float':
        addVectorAttribute(gl, program, location, 1, obj, name, doLink)
      break
      
      default:
        if(type.indexOf('vec') >= 0) {
          var d = type.charCodeAt(type.length-1) - 48
          if(d < 2 || d > 4) {
            throw new Error('gl-shader: Invalid data type for attribute ' + name + ': ' + type)
          }
          addVectorAttribute(gl, program, location, d, obj, name, doLink)
        } else {
          throw new Error('gl-shader: Unknown data type for attribute ' + name + ': ' + type)
        }
      break
    }
  }
  return obj
}
function createAttributeWrapper(gl, program, attributes, doLink) {
  var obj = {}
  for(var i=0, n=attributes.length; i<n; ++i) {
    var a = attributes[i]
    var name = a.name
    var type = a.type
    var location = gl.getAttribLocation(program, name)
    
    switch(type) {
      case 'bool':
      case 'int':
      case 'float':
        addVectorAttribute(gl, program, location, 1, obj, name, doLink)
      break
      
      default:
        if(type.indexOf('vec') >= 0) {
          var d = type.charCodeAt(type.length-1) - 48
          if(d < 2 || d > 4) {
            throw new Error('gl-shader: Invalid data type for attribute ' + name + ': ' + type)
          }
          addVectorAttribute(gl, program, location, d, obj, name, doLink)
        } else {
          throw new Error('gl-shader: Unknown data type for attribute ' + name + ': ' + type)
        }
      break
    }
  }
  return obj
}
function createAttributeWrapper ( gl , program , attributes , doLink ) { var obj = { } for ( var i = 0 , n = attributes . length ; i < n ; ++ i ) { var a = attributes [ i ] var name = a . name var type = a . type var location = gl . getAttribLocation ( program , name ) switch ( type ) { case 'bool' : case 'int' : case 'float' : addVectorAttribute ( gl , program , location , 1 , obj , name , doLink ) break default : if ( type . indexOf ( 'vec' ) >= 0 ) { var d = type . charCodeAt ( type . length - 1 ) - 48 if ( d < 2 || d > 4 ) { throw new Error ( 'gl-shader: Invalid data type for attribute ' + name + ': ' + type ) } addVectorAttribute ( gl , program , location , d , obj , name , doLink ) } else { throw new Error ( 'gl-shader: Unknown data type for attribute ' + name + ': ' + type ) } break } } return obj }
Create shims for attributes
Create shims for attributes