New answers tagged color
You are checking how many bytes there are per pixel, but you are not checking how colours are ordered, and it could be RGBA or BGRA (or possibly something else). You need something like this instead of mode = GL_RGBA (little-endian machines): if (surface->format->Rmask == 0x000000ff) mode = GL_RGBA; else mode = GL_BGRA; If you want a more ...
For this case the BMP was not in RGB Format but in BGR Format. Switching those made the colors appear correctly. Im am not sure how a generic version would look like.
Top 50 recent answers are included