How can I get a screenshot from a not visible window of a application which uses OpenGL under X?

2

4

I am trying to make a screenshot of a not visible window under X.

My first attempt was to capture the window using xwd or import (from ImageMagick). Unfortunately when window is under some other windows the hidden parts are black. What's even worse is that when window is not on the current desktop I get a BadMatch error.

The next thought was to use Xnest which would create a new X instance just for this one application and it would be always on top. And I run across other problem. Xnest does not support OpenGL.

Some searching on google and I find [Xephyr][1] which does support OpenGL... but not hardware accelerated so it's not accaptable as it kills my CPU.

The same goes for Xvfb which also uses CPU to render OpenGL. Below is part of the output from the glxinfo:

OpenGL vendor string: Mesa Project
OpenGL renderer string: Software Rasterizer
OpenGL version string: 2.1 Mesa 7.8.2
OpenGL shading language version string: 1.20

The only thing left that I can think of is to somehow use Xlib to force my X server to render window to a pixbuf. Unfortunately I have almost no knowledge of Xlib.

So my question is how can I get a screenshot from a not visible window of a application which uses OpenGL under X?

As for now I am only able to make a screenshot using [Python-Xlib][2] and PIL. Also any other solution using Python or C is acceptable.

elmo

Posted 2010-06-25T16:03:44.500

Reputation: 121

just to make it short: you want to store whats produced by opengl? – akira – 2010-06-25T16:08:27.203

Do you have access to the source code of the openGL application? – mrucci – 2010-06-25T17:06:37.580

@mrucci: No, I don't have.

@akira: It would be probably solution to my problem, but I would also like to know if there is a way to capture a i.e. Qt application with only one widget displaying OpenGL scene. – elmo – 2010-06-25T19:29:59.767

No answers