glTexImage2D( GL_TEXTURE_2D, 0, textureFormat, temp->w, temp->h, 0, GL_RGB, GL_UNSIGNED_BYTE, temp->pixels);
y estas forzando siempre al formato GL_RGB, debería ser:
glTexImage2D( GL_TEXTURE_2D, 0, temp->format->BytesPerPixel, temp->w, temp->h, 0, textureFormat, GL_UNSIGNED_BYTE, temp->pixels);
y otra cosa, si la imagen no es true color (temp->format->BytesPerPixel < 3) no deberías utilizarla, es posible que pete.