title: OpenGL 3.2 Texturing Issue
body: <p>I'm working on a 2D engine in C++ at the moment.</p>
  
  <p>I've run into a problem which I seem to believe I've come up against once before, but have since forgotten how I fixed it.</p>
  
  <p>The engine is cross platform ( Win, OSX, Linux ) and to accomplish this I am using GLFW as a base.</p>
  
  <p>When doing the normal texturing thing I end up with this : </p>
  
  <p><img src="https://i.stack.imgur.com/3Em1U.png" alt="http://tinypic.com/r/263ec6o/6"></p>
  
  <p>As you can see the texturing isn't right ( as the image is supposed to be a simple Image of me ).</p>
  
  <p>Using geDebugger I can confirm that the image being buffered to the GPU is correct, but some how it is ending up as you see in the Image.</p>
  
  <p>I'll include some cuts of relevant code below, but should you want more info feel free to ask.</p>
  
  <p>-Buffer Generation Code</p>
  
  <pre><code>glGenVertexArrays( 1, &amp;_vao );
  // Generate Buffers and so on.
  glBindVertexArray( _vao );
  
  glGenBuffers( 1, &amp;_vboVertices );
  glBindBuffer( GL_ARRAY_BUFFER, _vboVertices );
  glBufferData( GL_ARRAY_BUFFER, sizeof(GLfloat) * 3 * _numVertices, _vertices, GL_STATIC_DRAW );
  
  glGenBuffers( 1, &amp;_vboTexCoords );
  glBindBuffer( GL_ARRAY_BUFFER, _vboTexCoords );
  glBufferData( GL_ARRAY_BUFFER, sizeof(GLfloat) * 2 * _numVertices, _texCoords, GL_STATIC_DRAW );
  
  glGenBuffers( 1, &amp;_vboIndices );
  glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, _vboIndices );
  glBufferData( GL_ELEMENT_ARRAY_BUFFER, sizeof(GLint) * _numIndices, _indices, GL_STATIC_DRAW );
  </code></pre>
  
  <p>-Render Code</p>
  
  <pre><code>glm::mat4 modelViewProjMatrix = projMatrix * viewMatrix * modelMatrix;
  
  ShaderResource * shader = ShaderManager::GetInstance()-&gt;GetShader( _shaderName.c_str() );
  TextureResource * texture = TextureManager::GetInstance()-&gt;GetTexture( _textureName.c_str() );
  
  shader-&gt;BindShader();
  
  // Bind VAO
  glBindVertexArray( _vao );
  
  // Bind all VBO's
  glBindBuffer( GL_ARRAY_BUFFER, _vboVertices );
  GLint posLocation = shader-&gt;GetAttribLocation("in_position");
  glVertexAttribPointer( posLocation, 3, GL_FLOAT, GL_FALSE, 0, (void*)0 );
  GLint texCoordLocation = shader-&gt;GetAttribLocation("in_texCoord");
  glVertexAttribPointer( texCoordLocation, 2, GL_FLOAT, GL_FALSE, 0, (void*)0 );
  glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, _vboIndices );
  
  // Enable VBO Pointers
  glEnableVertexAttribArray( posLocation );
  glEnableVertexAttribArray( texCoordLocation );
  
  // Find and assign Uniforms
  GLint MVPMatrixLocation = shader-&gt;GetUniformLocation("in_MVPMatrix");
  GLint colourLocation = shader-&gt;GetUniformLocation("in_colour");
  GLint textureLocation = shader-&gt;GetUniformLocation("texMap");
  
  glUniformMatrix4fv( MVPMatrixLocation, 1, GL_FALSE, glm::value_ptr( modelViewProjMatrix ) );
  glUniform4fv( colourLocation, 1, glm::value_ptr( _colour ) );
  
  // Texture Uniform
  if( texture != 0 )
  {
      glActiveTexture( GL_TEXTURE0 );
      glUniform1i( textureLocation, 0 );
      glBindTexture( GL_TEXTURE_2D, texture-&gt;GetTextureId() );
  }
  
  glDrawElements( GL_TRIANGLES, _numIndices, GL_UNSIGNED_INT, (void*) 0 );
  
  glDisableVertexAttribArray( posLocation );
  glDisableVertexAttribArray( texCoordLocation );
  
  shader-&gt;UnbindShader();
  
  glBindVertexArray( 0 );
  </code></pre>
  
  <p>-Vert Shader</p>
  
  <pre><code>#version 150
  
  in vec3 in_position;
  in vec2 in_texCoord;
  
  out vec4 out_colour;
  smooth out vec2 out_texCoord;
  
  uniform vec4 in_colour;
  uniform mat4 in_MVPMatrix;
  
  void main()
  {
  out_colour = in_colour;
  out_texCoord = in_texCoord;
  
      gl_Position = in_MVPMatrix * vec4( in_position, 1.0 );
  }
  </code></pre>
  
  <p>-Frag Shader</p>
  
  <pre><code>#version 150
  
  in vec4 out_colour;
  smooth in vec2 out_texCoord;
  
  out vec4 fragColor;
  
  uniform sampler2D texMap;
  
  void main()
  {
      vec4 diffuseTexel = texture2D( texMap, out_texCoord );
  
      fragColor = out_colour * diffuseTexel;
  } 
  </code></pre>