title: Texture loaded and bound, but fragment shader doesn't render it
body: <p>I'm trying to draw a cube with an FBO texture. The texture is rendered to correctly (which I can see in gDebugger), but it doesn't render on the cube. I thought that this might be a problem with the FBO texture so I loaded an ordinary texture and tried it as well, but I get the same problem, just a black cube.</p>
  
  <p>Stepping through the program in gDebugger, I can see that the texture is both loaded correctly and bound, but nothing is drawn. There also doesn't seem to be any problems with the texcoords. Note that I've also tried to output a solid color in the fragment shader which works correctly.</p>
  
  <p>This is my vertex shader:</p>
  
  <pre><code>#version 420
  
  uniform mat4 projection;
  uniform mat4 view;
  uniform mat4 model;
  
  layout(location = 0) in vec3 vertex;
  layout(location = 1) in vec2 texcoord;
  
  out vec2 f_texcoord;
  
  void main() {
      gl_Position = projection * view * model * vec4(vertex, 1.0);
      f_texcoord = texcoord;
  }
  </code></pre>
  
  <p>And this is my fragment shader:</p>
  
  <pre><code>#version 420
  
  uniform sampler2D tex;
  
  in vec2 f_texcoord;
  
  out vec4 gl_FragColor;
  
  void main() {
      gl_FragColor = texture2D(tex, f_texcoord);
  }
  </code></pre>
  
  <p>And this is where I draw the cube:</p>
  
  <pre class="lang-c prettyprint-override"><code>ShaderManager::Get("world")-&gt;Use();
  glBindVertexArray(cube_vao);
  glActiveTexture(GL_TEXTURE0);
  glBindTexture(GL_TEXTURE_2D, tex);
  glDrawArrays(GL_TRIANGLES, 0, 36);
  glBindTexture(GL_TEXTURE_2D, 0);
  glBindVertexArray(0);
  </code></pre>
  
  <p>I must be blind, because I see no errors.</p>
  
  <p>(Also, please note that I am using SFML and GLEW for context creation and extensions.)</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>I don't know if this will be helpful, but this is how I set up the cube VBO, uniforms, etc.:</p>
  
  <pre class="lang-c prettyprint-override"><code>glClearColor(1.0, 0.0, 0.0, 1.0);
  
  glEnable(GL_DEPTH_TEST);
  
  glGenTextures(1, &amp;tex);
  glBindTexture(GL_TEXTURE_2D, tex);
  sf::Image img;
  img.LoadFromFile("test.png");
  img.FlipVertically();
  glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, img.GetWidth(), img.GetHeight(), 0, GL_RGBA, GL_UNSIGNED_BYTE, img.GetPixelsPtr());
  glBindTexture(GL_TEXTURE_2D, 0);
  
  ShaderTime = 0.0;
  camz = -4.0f;
  rotation_y = 0.0f;
  
  Shader* shader = ShaderManager::Load("shader", "fx.vert", "fx.frag");
  Shader* world = ShaderManager::Load("world", "world.vert", "world.frag");
  shader-&gt;Use();
  glUniform1f(glGetUniformLocation(shader-&gt;GetId(), "time"), ShaderTime);
  world-&gt;Use();
  glm::mat4 proj = glm::perspective(60.0f, (float)WINDOW_WIDTH / (float)WINDOW_HEIGHT, 0.1f, 1000.0f);
  glm::mat4 view = glm::translate(glm::mat4(1.0f), glm::vec3(0.0f, 0.0f, camz));
  glm::mat4 model;
  glUniformMatrix4fv(glGetUniformLocation(world-&gt;GetId(), "projection"), 1, GL_FALSE, glm::value_ptr(proj));
  glUniformMatrix4fv(glGetUniformLocation(world-&gt;GetId(), "view"), 1, GL_FALSE, glm::value_ptr(view));
  glUniformMatrix4fv(glGetUniformLocation(world-&gt;GetId(), "model"), 1, GL_FALSE, glm::value_ptr(model));
  glUniform1i(glGetUniformLocation(world-&gt;GetId(), "tex"), 0);
  
  glGenVertexArrays(1, &amp;cube_vao);
  glBindVertexArray(cube_vao);
  glGenBuffers(1, &amp;cube_vbo);
  glBindBuffer(GL_ARRAY_BUFFER, cube_vbo);
  
  GLfloat* data = new GLfloat[5 * 36] {
      // Front
      -1.0f, -1.0f, 1.0f, 0.0f, 0.0f,     -1.0f, 1.0f, 1.0f, 0.0f, 1.0f,      1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
      1.0f, 1.0f, 1.0f, 1.0f, 1.0f,       1.0f, -1.0f, 1.0f, 1.0f, 0.0f,      -1.0f, -1.0f, 1.0f, 0.0f, 0.0f,
  
      // Back
      -1.0f, -1.0f, -1.0f, 0.0f, 0.0f,    -1.0f, 1.0f, -1.0f, 0.0f, 1.0f,     1.0f, 1.0f, -1.0f, 1.0f, 1.0f,
      1.0f, 1.0f, -1.0f, 1.0f, 1.0f,      1.0f, -1.0f, -1.0f, 1.0f, 0.0f,     -1.0f, -1.0f, -1.0f, 0.0f, 0.0f,
  
      // Top
      -1.0f, 1.0f, 1.0f, 0.0f, 1.0f,      -1.0f, 1.0f, -1.0f, 0.0f, 1.0f,     1.0f, 1.0f, -1.0f, 1.0f, 1.0f,
      1.0f, 1.0f, -1.0f, 1.0f, 1.0f,      1.0f, 1.0f, 1.0f, 1.0f, 1.0f,       -1.0f, 1.0f, 1.0f, 0.0f, 1.0f,
  
      // Bottom
      -1.0f, -1.0f, 1.0f, 0.0f, 1.0f,     -1.0f, -1.0f, -1.0f, 0.0f, 1.0f,        1.0f, -1.0f, -1.0f, 1.0f, 1.0f,
      1.0f, -1.0f, -1.0f, 1.0f, 1.0f,     1.0f, -1.0f, 1.0f, 1.0f, 1.0f,      -1.0f, -1.0f, 1.0f, 0.0f, 1.0f,
  
      // Left
      -1.0f, -1.0f, -1.0f, 0.0f, 0.0f,    -1.0f, 1.0f, -1.0f, 0.0f, 1.0f,     -1.0f, 1.0f, 1.0f, 0.0f, 1.0f,
      -1.0f, 1.0f, 1.0f, 0.0f, 1.0f,      -1.0f, -1.0f, 1.0f, 0.0f, 0.0f,     -1.0f, -1.0f, -1.0f, 0.0f, 0.0f,
  
      // Right
      1.0f, -1.0f, -1.0f, 0.0f, 0.0f,     1.0f, 1.0f, -1.0f, 0.0f, 1.0f,      1.0f, 1.0f, 1.0f, 0.0f, 1.0f,
      1.0f, 1.0f, 1.0f, 0.0f, 1.0f,       1.0f, -1.0f, 1.0f, 0.0f, 0.0f,      1.0f, -1.0f, -1.0f, 0.0f, 0.0f
  };
  
  glBufferData(GL_ARRAY_BUFFER, (5 * 36) * sizeof(GLfloat), data, GL_STATIC_DRAW);
  glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(GLfloat) * 5, (GLvoid*)(0));
  glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, sizeof(GLfloat) * 5, (GLvoid*)(sizeof(GLfloat) * 3));
  
  glEnableVertexAttribArray(0);
  glEnableVertexAttribArray(1);
  
  glBindBuffer(GL_ARRAY_BUFFER, 0);
  glBindVertexArray(0);
  </code></pre>