Results 1 to 5 of 5

Thread: Clearing only part of a window

  1. #1
    Junior Member Newbie
    Join Date
    Feb 2005
    Posts
    3

    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?

  2. #2
    Senior Member Regular Contributor
    Join Date
    Jan 2001
    Location
    Ukraine
    Posts
    101

    Re: Clearing only part of a window

    You can use glScissor for that purposes.

  3. #3
    Junior Member Newbie
    Join Date
    Feb 2005
    Posts
    3

    Re: Clearing only part of a window

    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().

  4. #4
    Senior Member OpenGL Guru Relic's Avatar
    Join Date
    Apr 2000
    Posts
    2,450

    Re: Clearing only part of a window

    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.

  5. #5
    Junior Member Newbie
    Join Date
    Feb 2005
    Posts
    3

    Re: Clearing only part of a window

    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?

Similar Threads

  1. clearing sub-region of the window, or viewports
    By _arts_ in forum OpenGL: Basic Coding
    Replies: 7
    Last Post: 06-08-2011, 10:08 AM
  2. Clearing a part of the window
    By Mukund in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 03-30-2010, 07:56 PM
  3. Clearing part of the screen?
    By Cheps in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 03-31-2006, 01:00 AM
  4. clearing part of a display
    By apnamani in forum OpenGL: Windows
    Replies: 2
    Last Post: 04-22-2004, 09:23 PM
  5. Clearing the window
    By J.Warrick in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 06-03-2000, 08:20 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean