Commit 5ea3a102 authored by Alexander Larsson's avatar Alexander Larsson

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.
parent 869f300f
This diff is collapsed.
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment