Clearing only part of a window

If I want a viewport to take up half of a window, naturally I might want to only have that half of the window cleared. However glClear() clears my entire window. How do I clear only part of the window while leaving everything in the ‘uncleared’ portion untouched?

You can use glScissor for that purposes.

Thanks, that worked, but it’s still clearing the rest of the window to white no matter what my clear color is. It also clears the entire window with white when I don’t call glClear().

That’s probably the Windows GDI background clear.
You need to override the WM_ERASEBKGND message.
In pure Win32 API message handling just add
case WM_ERASEBKGND: return 1;
to keep windows from clearing your client area.
In MFC generate a message handler function for it and do the same.

Actually this is on a Mac. I’d love to test my Windows and Linux code, but for the time being that’s not an option. Anyway it seems to be something in an agl routine. Any ideas?