front buffers, back buffers & wglMakeCurrent

I’m using one RC and two windows (two HDCs) on a dual screen setup.

All rendering is done to two screen sized textures, via fbos, using the primary HDC. When the secondary display needs updating (using WM_PAINT) I’m simply using wglMakeCurrent( secondaryHDC, RC), drawing a screen sized quad using the appropriate texture, swapping the front & back buffers, then wglMakeCurrent( primaryHDC, RC) to ‘reset’ all future draw commands to go via the first HDC.

My question is regarding the memory requirements on the video card for the front & back buffers. For example…

primary monior
1280x1024 (5mb fbo, 5mb back buffer, 5mb front buffer = 15mb)

secondary monitor
1024x768 (3mb fbo, 3mb back buffer, 3mb front buffer = 9mb)

If I were using two RCs the memory would be easy to calculate - 15mb + 9mb = 24mb.

But because I’m using just the one RC and redirecting to two HDCs, does this mean each call to wglMakeCurrent deletes the previous front & back buffers, and reallocates new storage for the next HDC? Or does the driver try to reuse the existing buffers? Or perhaps f&b buffers are maintained for both HDCs? Or is it arcane black magic?!?

It’s not a particularly important question in the sense that there’s not much I can do about it… I was just interested :smiley:

EDIT - i realise that glViewport needs to be called etc - it’s just whether the two HDC’s maintain their own buffers.

Don’t worry, what you intend to do is perfectly legal. Also don’t worry about the front&backbuffer stuff - they are bound to the two HDCs. Since you keep both HDCs all the time, there is no need for the driver to reallocate anything when you call wglMakeCurrent.