PDA

View Full Version : Capture an image if the window is hide?????



pererm
01-11-2018, 03:05 AM
HI.

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.

PERE

Dark Photon
01-11-2018, 05:53 AM
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.

GClements
01-11-2018, 07:19 AM
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).

pererm
01-11-2018, 09:21 AM
Thanks, but can i export this to a wmf file?
PERE

Dark Photon
01-11-2018, 04:00 PM
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.