2012/11/20 Sam Spilsbury <[email protected]>:
> You can achieve this from within compiz but there's not a whole lot of
> point from doing it within compiz.
>
> All you'll need to do is grab the offscreen window pixmap and dump it
> every X ms. For example, this not-tested pseudocode should be on the
> right track:
>
> int main (...)
> {
>     /* get window id */
>     Window id = passed_window_id;
>
>     Display *dpy = XOpenDisplay (NULL);
>
>     XCompositeQueryExtension (...);
>     XDamageQueryExtension (..., &damageBase);
>
>     Damage damage = XDamageCreate (dpy, id, XDamageReportRawRectangles);
>
>     XCompositeRedirectWindow (dpy, id, CompositeRedirectAutomatic);
>
>     XEvent ev;
>
>     while (XNextEvent (&ev))
>     {
>         switch (ev.type)
>         {
>         case damageBase + XDamageNotify:
>             XDamageEvent *de = (XDamageEvent) &ev;
>             Pixmap p = XCompositeNameWindowPixmap (dpy, id);
>             /* Use any image manipulation library to pull the contents
> out of the pixmap
>              * as specified by the "area" member in the XDamageEvent */
>             XFreePixmap (p);
>         default:
>             break;
>         }
>     }
>
>     XCompositeUnredirectWindow (dpy, id);
>     XDamageDestroy (dpy, damage);
>     return 0;
> }
>


thanks. So this will work both for opengl or gui/gtk/kde/etc
applications regardless it is accelerated or not? What i'm trying to
understand is, if the opengl app is rendered in hw, a separate command
is usually required for grabbing the texture from the gpu device. I
know that, for instance, i can peek in the opengl pixel buffer by
starting the application with vnc/virtualgl, implement a transport
plugin that will allow me to access the frames rendered in the device

is this xcomposite approach at a different level of abstraction? will
it handle grabbing the images from the gpu hw, or does it only work
with software rendering?
_______________________________________________
dev mailing list
[email protected]
http://lists.compiz.org/mailman/listinfo/dev

Reply via email to