title: OpenGL: Can't get textures to display
body: <p>I'm trying to add a texture to a simple square for more than 5h now but I still don't manage to do so.</p>
  
  <p>Here's the code I'm using in <strong>paintGL()</strong>:</p>
  
  <pre><code>glEnable(GL_TEXTURE_2D);
  
  GLuint id;
  glGenTextures(1, &amp;id);
  glBindTexture(GL_TEXTURE_2D, id);
  
  float pixels[] = {
      0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f,
      1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f
  };
  
  glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 2, 2, 0, GL_RGB, GL_FLOAT, pixels);
  
  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
  
  glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
  glBegin(GL_QUADS);
      glTexCoord2f(0.0f, 0.0f); glVertex3f(0,0,0);
      glTexCoord2f(1.0f, 0.0f); glVertex3f(1,0,0);
      glTexCoord2f(1.0f, 1.0f); glVertex3f(1,1,0);
      glTexCoord2f(0.0f, 1.0f); glVertex3f(0,1,0);
  glEnd();
  
  if (glGetError() != 0)
  {
      qDebug() &lt;&lt; glGetError();
  }
  </code></pre>
  
  <p>There is no errors nor OpenGL's ones. I initialized the clear color to grey.
  When I try to change color with <code>glColor3f(...)</code>, it works.</p>
  
  <p>I read about all tutorials that I could find with Google but no one helped.</p>
  
  <p><strong>SOLUTION:</strong>
  I never put </p>
  
  <pre><code>glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
  </code></pre>
  
  <p>at the right place: just after the <code>glTexImage2D</code>! Code above is edited and now work like a charm.</p>