0

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.

4

1 回答 1

0

据我所知,这是不可能的。问题是您尝试保存的像素实际上不存在。X 服务器和视频驱动程序将避免渲染不可见的东西。

正如 Matias 所说,如果您可以控制 GL 应用程序,那么您可能可以在 GL 中做一些事情。例如,帧缓冲区对象扩展允许您渲染到屏幕外的纹理。

于 2010-07-23T02:08:20.010 回答