Don't see any reason why it wouldn't work. XComposite just makes the window
system handle to the applications rendering buffer available to other
applications as a pixmap. Since DRI2 opengl applications are directly
rendered by the GPU on to the pixmap given to opengl by the window system.

Note that when you do such capture using xcomposite that will effectively
be done in software and the application will be blocked from rendering
anything whilst any server operations on the pixmap are in progress.
There's no way to do capture in hardware that I know of.
On 23/11/2012 11:55 PM, "charles quarra" <
[email protected]> wrote:

> 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
>
_______________________________________________
dev mailing list
[email protected]
http://lists.compiz.org/mailman/listinfo/dev

Reply via email to