GtkGLArea: Major reworking

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.
This commit is contained in:
Alexander Larsson
2014-10-30 18:22:44 +01:00
parent 869f300f0a
commit 5ea3a1028d
2 changed files with 466 additions and 84 deletions

View File

@ -94,11 +94,30 @@ GDK_AVAILABLE_IN_3_16
void gtk_gl_area_set_has_depth_buffer (GtkGLArea *area,
gboolean has_depth_buffer);
GDK_AVAILABLE_IN_3_16
gboolean gtk_gl_area_get_has_stencil_buffer (GtkGLArea *area);
GDK_AVAILABLE_IN_3_16
void gtk_gl_area_set_has_stencil_buffer (GtkGLArea *area,
gboolean has_stencil_buffer);
GDK_AVAILABLE_IN_3_16
gboolean gtk_gl_area_get_auto_render (GtkGLArea *area);
GDK_AVAILABLE_IN_3_16
void gtk_gl_area_set_auto_render (GtkGLArea *area,
gboolean auto_render);
GDK_AVAILABLE_IN_3_16
void gtk_gl_area_queue_render (GtkGLArea *area);
GDK_AVAILABLE_IN_3_16
GdkGLContext * gtk_gl_area_get_context (GtkGLArea *area);
GDK_AVAILABLE_IN_3_16
void gtk_gl_area_make_current (GtkGLArea *area);
GDK_AVAILABLE_IN_3_16
void gtk_gl_area_attach_buffers (GtkGLArea *area);
G_END_DECLS