title: WebGL texture creation trouble
body: <p>I'm coding a ray tracing program and the main idea is save the triangles and the indices of .obj model into 2 textures:</p>
  
  <p>a) Vertex texture
  b) Indices texture</p>
  
  <p>Im doing this to do a ray-triangle intersection in my GLSL fragment shader, browsers are telling me that I've this problem with textures : </p>
  
  <p>a) <strong>Mozilla Firefox</strong>:</p>
  
  <p>Error #1 (with vertexes texture) : <strong>Error: WebGL: texImage2D: invalid type 0x1406</strong>.</p>
  
  <p>Error #2 (with indices texture) : <strong>Error: WebGL: texImage2D: invalid type 0x1403</strong>.</p>
  
  <p>b) <strong>Google Chrome</strong> : </p>
  
  <p>Error with both textures : <strong>webgl invalid_enum teximage2d invalid texture type</strong></p>
  
  <p>Here is the code :</p>
  
  <pre><code>Obj.prototype.initTextures = function(){
  
  this.vertexTexture = gl.createTexture();
  gl.activeTexture(gl.TEXTURE0)
  gl.bindTexture(gl.TEXTURE_2D, this.vertexTexture);
  gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
  gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
  gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
  gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
  gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, this.vertexSize, 1, 0, gl.RGB, gl.FLOAT, new Float32Array(this.vertexArray));
  gl.bindTexture(gl.TEXTURE_2D, null);
  
  this.trianglesTexture = gl.createTexture();
  gl.activeTexture(gl.TEXTURE1);
  gl.bindTexture(gl.TEXTURE_2D, this.trianglesTexture);
  gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
  gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
  gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
  gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
  gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, this.faceSize, 1, 0, gl.RGB,  gl.UNSIGNED_SHORT, new Uint16Array(this.faceArray));
  gl.bindTexture(gl.TEXTURE_2D, null);
  </code></pre>
  
  <p>}</p>
  
  <p>For obvious reasons this.vertexArray and this.faceArray have the data with them.</p>