- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
- glFramebufferTexture2D( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
- GL_TEXTURE_2D, fb->colour, 0);
-
- glGenRenderbuffers( 1, &fb->rb );
- glBindRenderbuffer( GL_RENDERBUFFER, fb->rb );
- glRenderbufferStorage( GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, ix, iy );
-
- glFramebufferRenderbuffer( GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT,
- GL_RENDERBUFFER, fb->rb );
- glBindFramebuffer( GL_FRAMEBUFFER, 0 );
-
- VG_CHECK_GL_ERR();
- fb->allocated = 1;
-}
-
-static void fb_free( struct framebuffer *fb )
-{
- glDeleteTextures( 1, &fb->colour );
- glDeleteFramebuffers( 1, &fb->fb );
-}
-
-static void fb_bindtex( struct framebuffer *fb, int texture )
-{
- glActiveTexture( GL_TEXTURE0 + texture );
- glBindTexture( GL_TEXTURE_2D, fb->colour );
-}
-
-static void fb_resize( struct framebuffer *fb )
-{
- if( !fb->allocated )
- return;
-
- i32 ix = vg_window_x / fb->div,
- iy = vg_window_y / fb->div;
-
- glBindTexture( GL_TEXTURE_2D, fb->colour );
- glTexImage2D( GL_TEXTURE_2D, 0, fb->format, ix, iy, 0,
- fb->format, GL_UNSIGNED_BYTE, NULL );
-
- glBindRenderbuffer( GL_RENDERBUFFER, fb->rb );
- glRenderbufferStorage( GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, ix, iy );
-}
-
-static void render_fb_resize(void)
-{
- if( gpipeline.ready )
- {
- glBindTexture( GL_TEXTURE_2D, gpipeline.rgb_background );
- glTexImage2D( GL_TEXTURE_2D, 0, GL_RGB, vg_window_x, vg_window_y, 0,
- GL_RGB, GL_UNSIGNED_BYTE, NULL );