Add add_destructor_once interface

This lets us add a destructor to a refcounter that will execute one time only.

Signed-off-by: Casey Dahlin <cdahlin@redhat.com>
Sweep framebuf_maps when a texmap is destroyed

Signed-off-by: Casey Dahlin <cdahlin@redhat.com>
Make colorbuf interface work better for default buffer

We now have functions to give the default buffer colorbuf flags and set its
geometry (a convenient place to put glViewport. No more direct GL calls in the
demo!).

We introduce a bug here where resizing the demo will crash. This is because the
framebuffer doesn't seem to like it when you resize one of its underlying
textures.

Signed-off-by: Casey Dahlin <cdahlin@redhat.com>
Add a flags field to texmaps

Signed-off-by: Casey Dahlin <cdahlin@redhat.com>
Make texmaps notify colorbuf on change

Signed-off-by: Casey Dahlin <cdahlin@redhat.com>
Make colorbuf copying copy depth and stencil

Signed-off-by: Casey Dahlin <cdahlin@redhat.com>
Remember to bind framebuffer in colorbuf_notify_texmap_change

Signed-off-by: Casey Dahlin <cdahlin@redhat.com>
Prevent double-initialization of texmaps

Turns out OpenGL doesn't like this.

Signed-off-by: Casey Dahlin <cdahlin@redhat.com>
Replace colorbuf_append_buf with colorbuf_set_buf

We now have random access to the list of colorbufs. Gaps are filled with NULL,
which maps to a draw buffer of GL_NONE.

Signed-off-by: Casey Dahlin <cdahlin@redhat.com>
Rename COLORBUF_AUTO_DEPTH to COLORBUF_DEPTH

Signed-off-by: Casey Dahlin <cdahlin@redhat.com>
Make colorbuf hold its own OpenGL FBO

The mono-framebuffer optimization we were using was broken in several ways and
just generally a Bad Idea(tm). This can be "optimized" later if it needs to be,
but right now it's pretty much the most straightforward implementation of the
interface.

Signed-off-by: Casey Dahlin <cdahlin@redhat.com>
Update the colorbuf_copy API

We now copy only one attachment, with the index given in arguments.

Signed-off-by: Casey Dahlin <cdahlin@redhat.com>