vg_async_call( async_framebuffer_create, fb, 0 );
}
+void vg_framebuffer_free( vg_framebuffer *fb )
+{
+ glDeleteFramebuffers( 1, &fb->id );
+
+ for( u32 j=0; j<fb->attachment_count; j++ )
+ {
+ vg_framebuffer_attachment *attachment = &fb->attachments[j];
+
+ if( attachment->purpose == k_framebuffer_attachment_type_none )
+ continue;
+
+ if( attachment->purpose == k_framebuffer_attachment_type_renderbuffer )
+ {
+ glDeleteRenderbuffers( 1, &attachment->id );
+ }
+ else if( attachment->purpose == k_framebuffer_attachment_type_texture ||
+ attachment->purpose == k_framebuffer_attachment_type_texture_depth )
+ {
+ glDeleteTextures( 1, &attachment->id );
+ }
+ }
+}
+
void vg_framebuffer_ui( ui_context *ctx )
{
ui_px w = vg.window_x/3,
/*
* Allocate graphics memory and initialize
*/
-void vg_framebuffer_create( vg_framebuffer *fb );
+void vg_framebuffer_create( vg_framebuffer *fb ); /* LOADER THREAD */
+void vg_framebuffer_free( vg_framebuffer *fb );
/*
* Draw framebuffer debugging stuff