title: Load Textures in open gl
body: <p>We can't manage to add a texture in open gl. </p>
  
  <p>Here our code to make a simple black/white cases texture: </p>
  
  <pre><code> GLuint tex;//before the main function
  </code></pre>
  
  <p>then in the main: </p>
  
  <pre><code>glGenTextures(1, &amp;tex);
  
  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
  };
  glBindTexture(GL_TEXTURE_2D, tex);
  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
  glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 2, 2, 0, GL_RGB, GL_FLOAT, pixels);
  glEnable(GL_TEXTURE_2D);
  </code></pre>
  
  <p>and then in the draw method we apply it in the following way</p>
  
  <pre><code>glBegin(GL_QUADS);
      glTexCoord2d(0, 1);     glVertex3d(0, -0.1, 0);
      glTexCoord2d(0, 0);     glVertex3d(50, -0.1, 0);
      glTexCoord2d(1, 1);     glVertex3d(50, -0.1, 50);
      glTexCoord2d(1, 1);     glVertex3d(0, -0.1, 50);
  glEnd();
  </code></pre>
  
  <p>We want to apply this texture simple on the ground of the scene. Are we missing something?</p>