The best way to draw a GL texture from a different process

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

The best way to draw a GL texture from a different process

Jiří Janoušek
Hello,

My app consists of the main process, where the GTK+ main loop and widgetry
live, and the GPU process, which does OpenGL kung-fu and provides GL
texture and dirty/invalidated rectangles as a result. I have little control
over the GPU process - I can patch it a bit, but I cannot merge the main
and GPU process, for example.

If I understand it correctly, I cannot simply share GL textures between the
processes and use e.g. gdk_cairo_draw_from_gl(). I can transfer the pixel
buffer via IPC, store it in the main process, call
gtk_widget_queue_draw_area(), and finally paint it in the draw signal
handler, but that is slow and involves a lot of copying.

Do you have any suggestions what could be a better way to draw the GL
texture from a different process? With GTK 3.22 and under Xorg.

Thanks in advance,

Jiri Janousek
_______________________________________________
gtk-app-devel-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Reply | Threaded
Open this post in threaded view
|

Re: The best way to draw a GL texture from a different process

Emmanuele Bassi
On 25 May 2018 at 10:23, Jiří Janoušek <[hidden email]> wrote:

> Hello,
>
> My app consists of the main process, where the GTK+ main loop and widgetry
> live, and the GPU process, which does OpenGL kung-fu and provides GL
> texture and dirty/invalidated rectangles as a result. I have little control
> over the GPU process - I can patch it a bit, but I cannot merge the main
> and GPU process, for example.
>
> If I understand it correctly, I cannot simply share GL textures between the
> processes and use e.g. gdk_cairo_draw_from_gl(). I can transfer the pixel
> buffer via IPC, store it in the main process, call
> gtk_widget_queue_draw_area(), and finally paint it in the draw signal
> handler, but that is slow and involves a lot of copying.
>
> Do you have any suggestions what could be a better way to draw the GL
> texture from a different process? With GTK 3.22 and under Xorg.
>

You can store the texture data as an X11 Pixmap object, and use the
GLX_EXT_texture_from_pixmap extension to get a GL texture object out of a
Pixmap XID.

Ciao,
 Emmanuele.

--
https://www.bassi.io
[@] ebassi [@gmail.com]
_______________________________________________
gtk-app-devel-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list