It sounds like you're forgetting to call glLoadIdentity before your gluOrtho2D. Also make sure that you've got glMatrixMode (GL_PROJECTION) before both, and also identity in modelview. Full code:
glMatrixMode (GL_PROJECTION);glLoadIdentity ();gluOrtho2D (0, 800, 600, 0);glMatrixMode (GL_MODELVIEW);glLoadIdentity ();
This is needed because gluOrtho2D is documented as being equivalent to glOrtho with near -1 and far 1, and glOrtho multiples the current matrix by the generated ortho matrix; it doesn't replace it.
Wow, THANK YOU. I have actually posted this same thread twice on stackoverflow, and once on the OpenGL discussion boards, and no one has replied with anything useful. Thanks, your the first person to actually help me with this, and it works with no problems now.