Capture an image if the window is hide?????


Probably this is not posible.
I want get a capture of an image in a view when the window of the view is hidden.
Is there a way of do that???

Thank you.


Yes. Instead of rendering directly to the window each frame, render to an off-screen framebuffer (FBO) and then blit (glBlitFramebuffers) to the window at the end each frame. This ensures you always have the latest rendered content, regardless of if/how much of the window is visible.

Note that FBOs require OpenGL 3.0 or the ARB_framebuffer_object extension.

There are equivalents for older versions, but the functionality is platform-specific (and on X11, there are at least two different approaches: GLXPixmaps and pbuffers).

Thanks, but can i export this to a wmf file?

Sure. Whatever you want. You can readback the pixels (e.g. glReadPixels) just like you can when rendering to the window.

Unlike the window though, it doesn’t have the “window is hidden” problem you’re hitting.