 <p>I solved my problem. The problem is since I am using RGBA as internal format I am telling opengl to use 4 bytes per pixel. However it is actually 3.</p> <pre><code>glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image-&gt;width, image-&gt;height, 0, GL_RGB,//The change is here GL_UNSIGNED_BYTE, image-&gt;pixels); </code></pre> <p>When I made this change, it worked.</p>