WIN32 Question / Advice

First let me preface the question by describing my application. I have a “main” application that spawns an openGL rendering window. Everything regarding this window is contained in a class I defined - call it COGLwin. It has its own message handler (and of course its own rendering context). The ultimate purpose of COGLwin is to use openGL as a means to do volume rendering via raycasting. Nevermind the details of volume rendering. The only thing is that it operates very similar to raytracing. As such I would like, as other raytracers do, render the scene scanline by scanline. My question is this: Say during the raycasting (raytracing) procedure I get a WM_PAINT message (e.g. minimize then maximize again) and a portion of what I have already rendered gets invalidated. Since volume rendering can be computationally intensive, I clearly do not want to render the entire scene again. An option is to store my progress (i.e. the pixels I’ve rendered already) in some buffer and, when I need to repaint, simply dump that buffer to the window. I’d prefer not to do this though because: (a) the datasets that need to be rendered can be huge and minimizing memory-usage is vital (must avoid paging the dataset if possible) ; (b) writing to the buffer is just more overhead.
Can anyone offer a better suggestion? Or does Windoze somehow “implicitly” perform this refresh for us?

Thanks. Sorry for the length of the post…

A solution is to use the feedback mode of OpenGL. The image is not written to the framebuffer, but a buffer in system memory as far as I know. You could then just copy the image there to the framebuffer.

Another solution is to render it to one of the color buffers, read the image from there into system memory and use that image for further drawing.