View Full Version : Clearing only part of a window
02-28-2005, 09:46 PM
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.
03-01-2005, 10:08 PM
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().
03-01-2005, 11:30 PM
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.
03-02-2005, 03:21 PM
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?
Powered by vBulletin® Version 4.2.2 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.