SOIL load image with incorrect color <p>In my opengl program, I use SOIL to load texture, and the code is like below:</p> <pre><code> m_objTexture = SOIL_load_OGL_texture ( fileName.c_str(), SOIL_LOAD_AUTO, SOIL_CREATE_NEW_ID, SOIL_FLAG_MULTIPLY_ALPHA | SOIL_FLAG_TEXTURE_REPEATS ); </code></pre> <p>But what's weired is that the color of the loaded texture seems not identical to the image sometimes (But sometimes it behaves fine). For example, the original image is shown below:</p> <p><img src="https://i.stack.imgur.com/Ovf9A.png" alt="enter image description here"></p> <p>But when I debug in nsight studio, I can see the buffer of the texture object is like this:</p> <p><img src="https://i.stack.imgur.com/zoCx1.png" alt="enter image description here"></p> <p>Obviously the color is very different from the original image. In this example, the texture is a 24bit jpg file (249 x 250). I wonder is there anything that I missed for texture loading with SOIL?</p>