title: Trouble accessing textures stored inside a TEXTURE_2D_ARRAY
body: <p>I am trying to load a texture array into my shader. The issue I'm facing is that I can only draw the last loaded texture in the array. Strangely, this is always at index 0. I create the texture array like so (I'm using Go bindings, but the general idea is clear):</p>
  
  <pre><code>// Allocate the array
  width := 32
  height := 32
  var textureArray uint32
  gl.GenTextures(1, &amp;textureArray)
  gl.BindTexture(gl.TEXTURE_2D_ARRAY_EXT, textureArray)
  gl.TexStorage3D(gl.TEXTURE_2D_ARRAY_EXT, 1, gl.RGBA, width, height, layerCount)
  gl.TexParameteri(gl.TEXTURE_2D_ARRAY_EXT, gl.TEXTURE_MIN_FILTER, gl.LINEAR)
  gl.TexParameteri(gl.TEXTURE_2D_ARRAY_EXT, gl.TEXTURE_MAG_FILTER, gl.LINEAR)
  gl.TexParameteri(gl.TEXTURE_2D_ARRAY_EXT, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE)
  gl.TexParameteri(gl.TEXTURE_2D_ARRAY_EXT, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE)
  
  // Load the textures into the array (assume rgbaN.Pix returns an RGBA image
  gl.TexSubImage3D(gl.TEXTURE_2D_ARRAY_EXT, 0, 0, 0, 0, width, height, 1, gl.RGBA, gl.UNSIGNED_BYTE, gl.Ptr(rgba0.Pix))
  gl.TexSubImage3D(gl.TEXTURE_2D_ARRAY_EXT, 0, 0, 0, 1, width, height, 1, gl.RGBA, gl.UNSIGNED_BYTE, gl.Ptr(rgba1.Pix))
  gl.TexSubImage3D(gl.TEXTURE_2D_ARRAY_EXT, 0, 0, 0, 2, width, height, 1, gl.RGBA, gl.UNSIGNED_BYTE, gl.Ptr(rgba2.Pix))
  </code></pre>
  
  <p>Then, inside my draw loop I do:</p>
  
  <pre><code>gl.BindTexture(gl.TEXTURE_2D_ARRAY_EXT, textureArray)
  gl.BindVertexArray(vertexArray)
  gl.DrawElements(gl.TRIANGLES, int32(len(indices)), gl.UNSIGNED_INT, nil)
  </code></pre>
  
  <p>My shader looks like this:</p>
  
  <pre><code>#version 110
  #if GL_EXT_texture_array
  #extension GL_EXT_texture_array : enable
  #endif
  
  varying vec2 texCoord;
  
  uniform sampler2DArray texArray;
  
  void main()
  {
      gl_FragColor = texture2DArray(texArray, vec3(texCoord, 0.0));
  }
  </code></pre>
  
  <p>With this shader, I always draw the last added texture to the array. If I change the <code>vec3(texCoord, 0.0)</code> to something like <code>vec3(texCoord, 1.0)</code> I get blackness. Nothing is drawn. My current thought is that I'm not assigning the uniform correctly, but I don't know how to fix that.</p>