Redraw part of scene

Hi there,
Im in the VC environment using MFC. When i refresh my scene it flickers. Attempted double-buffering but its not happening. Anyways, Id like to only redraw part of the scene. If i call Invalidate() it forces a call to OnPaint() which redraws the whole scene. If i call a function that only draws what i want, i still have to make a glClear() call to erase the previous part of the scene im trying to redraw…then the static part of the scene is erased.
So my question is how do i isolate the static part from the dynamic?
Thanx for your help.

If you are drawing to every pixel on the screen, then you could just clear the depth buffer without wiping the frame buffer. This should allow you to draw over the top of the previous image. Bear in mind that if you are using double buffering it wont be the last frame, but the one before.

I see what youre saying. But i dont want to draw over top of the previous image. Id like to clear that image and redraw it.
Any ideas?

When you say, “Attempted double-buffering but its not happening,” what do you mean by that? Why couldn’t you make it work?

Anyway, double buffering is how you get rid of that flickering (also, override OnEraseBkgrnd and return the value that keeps Windows from erasing the window for you). As for only redrawing part of a window, you’re out of luck.

If this is absolutely manditory that you do this, you might want to consider rendering to a bitmap and blting that to the screen.

Found an answer as to why my double-buffering wasnt working…
In my PIXELFORMATDESCRIPTOR i had the flag PFD_SUPPORT_GDI.
Thanx.