35 EGLDisplay egl_display = eglGetCurrentDisplay();
36 if (egl_display == EGL_NO_DISPLAY) {
37 g_warning(
"Failed to create EGL image: Failed to get current EGL display");
41 EGLContext egl_context = eglGetCurrentContext();
42 if (egl_context == EGL_NO_CONTEXT) {
43 g_warning(
"Failed to create EGL image: Failed to get current EGL context");
47 return eglCreateImage(
48 egl_display, egl_context, EGL_GL_TEXTURE_2D,
49 reinterpret_cast<EGLClientBuffer
>(
static_cast<intptr_t
>(
texture_id)),
74 FL_FRAMEBUFFER(g_object_new(fl_framebuffer_get_type(),
nullptr));
79 glGenTextures(1, &
self->texture_id);
80 glGenFramebuffers(1, &
self->framebuffer_id);
82 glBindFramebuffer(GL_FRAMEBUFFER,
self->framebuffer_id);
84 glBindTexture(GL_TEXTURE_2D,
self->texture_id);
85 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
86 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
87 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
88 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
90 GL_UNSIGNED_BYTE, NULL);
91 glBindTexture(GL_TEXTURE_2D, 0);
97 glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
100 glGenRenderbuffers(1, &
self->depth_stencil);
101 glBindRenderbuffer(GL_RENDERBUFFER,
self->depth_stencil);
102 glRenderbufferStorage(GL_RENDERBUFFER,
107 glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
108 GL_RENDERBUFFER,
self->depth_stencil);
109 glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
110 GL_RENDERBUFFER,
self->depth_stencil);
121 g_return_val_if_fail(FL_IS_FRAMEBUFFER(
self),
nullptr);
122 g_return_val_if_fail(
self->image !=
nullptr,
nullptr);
124 FlFramebuffer* sibling =
125 FL_FRAMEBUFFER(g_object_new(fl_framebuffer_get_type(),
nullptr));
127 sibling->width =
self->width;
128 sibling->height =
self->height;
129 sibling->image =
self->image;
132 glGenTextures(1, &sibling->texture_id);
133 glBindTexture(GL_TEXTURE_2D, sibling->texture_id);
134 glEGLImageTargetTexture2DOES(GL_TEXTURE_2D,
self->image);
137 glGenFramebuffers(1, &sibling->framebuffer_id);
138 GLint saved_framebuffer_binding;
139 glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &saved_framebuffer_binding);
140 glBindFramebuffer(GL_DRAW_FRAMEBUFFER, sibling->framebuffer_id);
141 glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
142 sibling->texture_id, 0);
143 glBindFramebuffer(GL_DRAW_FRAMEBUFFER, saved_framebuffer_binding);
uint32_t uint32_t * format