title: binding multiple textures based on verticies
body: <p>My problem is that I am trying to set a certain texture onto triangles via retrieving verticies from a text file. Basically I want to be able to go through each matrix and set a value for the texture I want it to set. Right now I have it set to only 1 texture for literally everything. I am taking this from an example, but this is straight webgl no libraries or anything I am strictly using this for de-engineering and learning purposes. There must be a way to do this for I am doing this for the x,y,z coordinates and texture coordinates.</p>
  
  <pre><code>    gl.activeTexture(gl.TEXTURE0);
      gl.bindTexture(gl.TEXTURE_2D, rockTexture);
      gl.uniform1i(shaderProgram.samplerUniform, 0);
  </code></pre>
  
  <p>I've looked up some documentation, and you can't bind an array to a texture like you can for bindBuffer, basically I am just trying to grab a value from a text file to determine which texture I want it to be. Some help, or even a step in the right direction with some explanation would do wonders.</p>
  
  <p>Example of how I am doing this with coordinates:</p>
  
  <p>(text file example) </p>
  
  <pre><code>// Floor 1
  -25.0  0.0 -25.0 0.0 25.0
  -25.0  0.0  25.0 0.0 0.0
   25.0  0.0  25.0 25.0 0.0
  
  -25.0  0.0 -25.0 0.0 25.0
   25.0  0.0 -25.0 25.0 25.0
   25.0  0.0  25.0 25.0 0.0
  
  // Ceiling 1
  -25.0  4.0 -25.0 0.0 24.0
  -25.0  4.0  25.0 0.0 0.0
   25.0  4.0  25.0 24.0 0.0
  -25.0  4.0 -25.0 0.0 24.0
   25.0  4.0 -25.0 24.0 24.0
   25.0  4.0  25.0 24.0 0.0
  </code></pre>
  
  <p>And then it parses and connects it through here: </p>
  
  <pre><code>var lines = data.split("\n");
          var vertexCount = 0;
          var vertexPositions = [];
          var vertexTextureCoords = [];
          for (var i in lines) {
              var vals = lines[i].replace(/^\s+/, "").split(/\s+/);
              if (vals.length == 6 &amp;&amp; vals[0] != "//") {
                  // It is a line describing a vertex; get X, Y and Z first
                  vertexPositions.push(parseFloat(vals[0]));
                  vertexPositions.push(parseFloat(vals[1]));
                  vertexPositions.push(parseFloat(vals[2]));
  
                  // And then the texture coords
                  vertexTextureCoords.push(parseFloat(vals[3]));
                  vertexTextureCoords.push(parseFloat(vals[4]));
  
                  vertexCount += 1;
              }
          }
  
          worldVertexPositionBuffer = gl.createBuffer();
          gl.bindBuffer(gl.ARRAY_BUFFER, worldVertexPositionBuffer);
          gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertexPositions), gl.STATIC_DRAW);
          worldVertexPositionBuffer.itemSize = 3;
          worldVertexPositionBuffer.numItems = vertexCount;
  
          worldVertexTextureCoordBuffer = gl.createBuffer();
          gl.bindBuffer(gl.ARRAY_BUFFER, worldVertexTextureCoordBuffer);
          gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertexTextureCoords), gl.STATIC_DRAW);
          worldVertexTextureCoordBuffer.itemSize = 2;
          worldVertexTextureCoordBuffer.numItems = vertexCount;
  </code></pre>
  
  <p>So basically I am simply trying to do this to tell the program which texture I want to use. </p>