title: Why do images loaded to texture with IMG_Load in SDL and OpenGL look bluish?
body: <p>I'm loading a PNG texture with:</p>
  
  <pre><code>void Sprite::setTexture(string f) {
      SDL_Surface *image = IMG_Load(f.c_str());
      if (image == NULL) {
          this-&gt;texture = -1;
          return;
      }
      SDL_DisplayFormatAlpha(image);
      unsigned object(0);
      glGenTextures(1, &amp;object);
      glBindTexture(GL_TEXTURE_2D, object);
      glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER, GL_LINEAR);
      glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER, GL_LINEAR);
      glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP_TO_EDGE);
      glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP_TO_EDGE);
      glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image-&gt;w, image-&gt;h, 0, GL_RGBA, GL_UNSIGNED_BYTE, image-&gt;pixels);
      SDL_FreeSurface(image);
      this-&gt;texture = object;
  }
  </code></pre>
  
  <p>The only problem is that instead of being like this (seen in Photoshop):</p>
  
  <p><img src="https://i.stack.imgur.com/QWibe.png" alt="Original box"></p>
  
  <p>it is shown like this (seen in the app):</p>
  
  <p>What's wrong? I have tried playing a little bit with tha GL_RGBA and tried to invert it to GL_BGRA or change it to GL_RGBA8, GL_RGBA16... but nothing changed (actually GL_BGRA didn't show anything). I need the alpha channel, even in this little PNG the borders are radius at 4px and so the image angles are transparent.</p>
  
  <p>What am I doing wrong?
  <img src="https://i.stack.imgur.com/6DGRN.png" alt="App box"></p>