Why don't they display the same colors?
Original Image:

The plane with the image above as a texture:

WTF going on? The original image is 100x100 pixels, made with paint and saved as a 24-bit bitmap. Here is my opengl initialization code:
_hdc = GetDC(_hwnd);
PIXELFORMATDESCRIPTOR pfd;
ZeroMemory( &pfd, sizeof( pfd ) );
pfd.nSize = sizeof( pfd );
pfd.nVersion = 1;
pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
pfd.iPixelType = PFD_TYPE_RGBA;
pfd.cColorBits = 24;
pfd.cDepthBits = 16;
pfd.iLayerType = PFD_MAIN_PLANE;
int iFormat = ChoosePixelFormat( _hdc, &pfd );
SetPixelFormat( _hdc, iFormat, &pfd );
_hrc = wglCreateContext(_hdc);
wglMakeCurrent(_hdc, _hrc);
GLHelper* helper = GLHelper::get();
helper->initialize(_hwnd, _hdc, _hrc);
changeScreenResolution(_settings.windowWidth, _settings.windowHeight,
_settings.sceneWidth, _settings.sceneHeight);
glShadeModel(GL_SMOOTH);
glClearColor(0.0f, 0.0f, 0.0f, 0.5f);
glClearDepth(1.0f);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
glEnable(GL_LIGHTING);
glEnable(GL_COLOR_MATERIAL);
glEnable(GL_NORMALIZE);
glEnable(GL_TEXTURE_2D);
glDepthFunc(GL_LEQUAL);
float globalAmbient[4] = {0, 0, 0, 1};
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, globalAmbient);
I use the FreeImage library, which looks pretty well tested and widely used.
Here is the image upload code:
FREE_IMAGE_FORMAT fif = FIF_UNKNOWN;
FIBITMAP *dib(0);
BYTE* bits(0);
unsigned int width(0), height(0);
GLuint gl_texID;
fif = FreeImage_GetFileType(filename, 0);
if(fif == FIF_UNKNOWN)
fif = FreeImage_GetFIFFromFilename(filename);
if(fif == FIF_UNKNOWN)
return false;
if(FreeImage_FIFSupportsReading(fif))
dib = FreeImage_Load(fif, filename);
if(!dib)
return false;
bits = FreeImage_GetBits(dib);
width = FreeImage_GetWidth(dib);
height = FreeImage_GetHeight(dib);
if((bits == 0) || (width == 0) || (height == 0))
return false;
if(m_texID.find(texID) != m_texID.end())
glDeleteTextures(1, &(m_texID[texID]));
glGenTextures(1, &gl_texID);
m_texID[texID] = gl_texID;
glBindTexture(GL_TEXTURE_2D, gl_texID);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glTexImage2D(GL_TEXTURE_2D, level, internal_format, width, height,
border, image_format, GL_UNSIGNED_BYTE, bits);
FreeImage_Unload(dib);