GtkGLArea: Major reworking

Desktop / GNOME / GTK - Alexander Larsson [redhat.com] - 30 October 2014 15:04 UTC

This restructures the way buffers are allocated and bound in a way that is more flexible.

Buffer operation happens in three phases: create_buffer() - Creates the gl objects allocate_buffers() - Allocates space for the buffers at a given size attach_buffers() - Attaches the buffers to the framebuffer and makes the framebuffer the default drawing target And destroy via delete_buffers()

We call all these the first draw, and after that we allocate buffers each time the widget changes size until the buffers are deleted. We delete the buffers at unrealize.

However, anyone that wants to manually control buffer allocation strategies can manually call allocate/delete_buffers().

There are also some other changes:
- Support for stencil buffers.
- A manual render mode where ::draw doesn't render unless you manually invalidated the previous rendering.

5ea3a10 GtkGLArea: Major reworking
gtk/gtkglarea.c | 531 ++++++++++++++++++++++++++++++++++++++++++++++---------
gtk/gtkglarea.h | 19 ++
2 files changed, 466 insertions(+), 84 deletions(-)

Upstream: git.gnome.org


  • Share