View Full Version : Redraw part of scene

10-26-2001, 04:53 AM
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.

Rob The Bloke
10-26-2001, 06:13 AM
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.

10-26-2001, 08:15 AM
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?

10-26-2001, 10:50 AM
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.

10-26-2001, 10:52 AM
Found an answer as to why my double-buffering wasnt working...