[xlib] howto create screenshots?
tom at dbservice.com
Mon Sep 12 17:48:43 PDT 2005
Clemens Eisserer wrote:
> Hi there,
> Currently I am using java's Robot class to generate snapshots of my
> desktop, however for a single 1024x768 snapshot it takes 1.5s on my
> Athlon 800.
> Do you think this could be speed up by writing my own, x-lib based
> implementation and which way do you think is the most efficient?
I've tried to write something like FRAPS for linux/X11. My problem also
was that reading the image from the video memory was slow, but not as
slow as you've seen. I've tried to use GLX/OpengGL and glReadPixels and
later on glBindBuffer/FBOs and glReadPixels. However, the FBOs didn't
really improve the performance.
I've seen that when my application runs as the only opengl application
on the system, I could get 20-30 fps, but as soon as I've started
another opengl app (cedega/wine World of Warcraft or even glxgears at
300x300px), the framerate dropped down to 2-8 fps.
My system specs are: dual Xeon (HT), 2GiB RAM, nVidia 6800GT (I don't
know exactly), AGP-8x and proprietary nvidia drivers, resolution: 1280x1024
My approach was to create a fullscreen glx window (had to use
_NET_WM_STATE_FULLSCREEN to make the window really cover the whole
screen) and read from this window. The (good or bad) thing is that you
can minimize this window and you still can read the whole screen
contents. So I started my app, minimized it the window and started a game.
My problems were:
o low FPS when another opengl app was running (2-8fps max)
o horizontal wrap lines in the images/video (like when you have
vertical sync disabled)
I don't know if the Xserver is somehow able to lock the frontbuffer when
two opengl applications are running so I don't know how to prevent the
wrap lines. But this approach is quite good for desktop capturing and
(slow) non-opengl applications. Unless you don't want to have another
window open when you're capturing (would it be possible to hide the
frame completely?). Anyhow.. these are my expiriences with frame
capturing under X11
More information about the xorg