28 FlFramebuffer*
self = FL_FRAMEBUFFER(
object);
30 glDeleteFramebuffers(1, &self->framebuffer_id);
31 glDeleteTextures(1, &self->texture_id);
33 G_OBJECT_CLASS(fl_framebuffer_parent_class)->dispose(
object);
43 FlFramebuffer* provider =
44 FL_FRAMEBUFFER(g_object_new(fl_framebuffer_get_type(),
nullptr));
46 provider->width =
width;
49 glGenTextures(1, &provider->texture_id);
50 glGenFramebuffers(1, &provider->framebuffer_id);
52 glBindFramebuffer(GL_FRAMEBUFFER, provider->framebuffer_id);
54 glBindTexture(GL_TEXTURE_2D, provider->texture_id);
55 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
56 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
57 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
58 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
60 GL_UNSIGNED_BYTE, NULL);
61 glBindTexture(GL_TEXTURE_2D, 0);
63 glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
64 provider->texture_id, 0);
70 return self->framebuffer_id;
74 return self->texture_id;