Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to hack GTK to render to OpenGL texture

Tags:

opengl

gtk

I'm writing an OpenGL game, and want native looking GUI elements. I was wondering if anyone has successfully hacked GTK+ using GtkOffscreenWindow and gtk_offscreen_window_get_pixbuf to render to an OpenGL texture, and whether this would have reasonable performance, considering repeated re-uploading of texture data every time the GUI is updated

like image 905
Sudarshan S Avatar asked Nov 14 '22 20:11

Sudarshan S


1 Answers

While this is certainly possible, I'd instead use a real OpenGL widget toolkit like Clutter. If you want to render GTK+ with OpenGL, I'd start by creating a new GDK backend (X11/OpenGL or something like that), that (re-)implements all the GDK drawing functions using OpenGL. A nice side effect would be, that all GTK+ windows would allow for ordinary OpenGL rendering, too, i.e. no more need for a GtkGLWidget class.

like image 55
datenwolf Avatar answered Jan 05 '23 18:01

datenwolf