Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
just to make it short: you want to store whats produced by opengl? – akira Jun 25 '10 at 16:08
Do you have access to the source code of the openGL application? – mrucci Jun 25 '10 at 17:06
@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 Jun 25 '10 at 19:29

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.