Most image file formats have the pixel data in BGR or BGRA order. If you load such image data using a RGB ordering the blue and red channel will be swapped, of course.
OpenGL does offer those pixel formats as well, since version 1.4. You'll have to either use a extension wrapper like GLEW or fetch and install a current glext.h
to get access to the new format tokens. Have a look at http://www.opengl.org/sdk/docs/man/xhtml/glTexImage2D.xml for the complete list of supported formats in OpenGL-3 core and later. For older OpenGL, namely OpenGL-1.4 to OpenGL-2.1 look at http://www.opengl.org/sdk/docs/man2/xhtml/glTexImage2D.xml
Update
That your image shows only once is due to the following:
while (isRunning)
{
/*...*/
glClear(GL_COLOR_BUFFER_BIT);
gluOrtho2D(0, 600, 0, 600); // For some reason, I prefer having '0,0' at the bottom left.
gluOrtho2D
multiplies on top whats already on the matrix. Which is what gluOrtho2D
did in the previous iteration. Also you left the matrix mode in a "dangling" state. As a general rule you should always freshly setup the whole OpenGL drawing state (viewport, clear color, clear depth, all the matrices) at the beginning of each drawing iteration. In your case
while (isRunning)
{
/*...*/
glViewport(0, 0, win_width, win_height);
glClearColor(0,0,0,1);
glClear(GL_COLOR_BUFFER_BIT);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, win_width, 0, win_height, -1, 1); // gluOrtho2D is the most useless wrapper ever..., just put a -1, 1 as additional parameters to glOrtho
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glShadeModel(GL_SMOOTH);