| Flutter Linux Embedder |

Functions
fl_compositor_opengl.h File Reference
`#include <gtk/gtk.h>`
`#include "flutter/shell/platform/embedder/embedder.h"`
`#include "flutter/shell/platform/linux/fl_compositor.h"`
`#include "flutter/shell/platform/linux/public/flutter_linux/fl_engine.h"`

Go to the source code of this file.

## Functions
G_BEGIN_DECLS | G_DECLARE_FINAL_TYPE (FlCompositorOpenGL, fl_compositor_opengl, FL, COMPOSITOR_OPENGL, FlCompositor) FlCompositorOpenGL *fl_compositor_opengl_new(FlEngine *engine)
void | fl_compositor_opengl_setup (FlCompositorOpenGL *compositor)
void | fl_compositor_opengl_render (FlCompositorOpenGL *compositor, FlutterViewId view_id, int width, int height, const GdkRGBA *background_color)
void | fl_compositor_opengl_cleanup (FlCompositorOpenGL *compositor)

## Function Documentation

## ◆ fl_compositor_opengl_cleanup()

void fl_compositor_opengl_cleanup | ( | FlCompositorOpenGL * | compositor | ) |

fl_compositor_opengl_cleanup: @compositor: an #FlCompositorOpenGL.

Removes OpenGL resources used for rendering. Requires an active context.

Definition at line 617 of file fl_compositor_opengl.cc.

617 {
618 g_return_if_fail(FL_IS_COMPOSITOR_OPENGL(self));
619
620 if (self->program != 0) {
621 glDeleteProgram(self->program);
622 }
623 }

Referenced by unrealize_cb().

## ◆ fl_compositor_opengl_render()

void fl_compositor_opengl_render | ( | FlCompositorOpenGL * | compositor,
|  | FlutterViewId | view_id,
|  | int | width,
|  | int | height,
|  | const GdkRGBA * | background_color
| ) |  |

fl_compositor_opengl_render: @compositor: an #FlCompositorOpenGL. @view_id: view to render. @width: width of the window in pixels. @height: height of the window in pixels. @background_color: color to use for background.

Performs OpenGL commands to render current Flutter view.

Definition at line 597 of file fl_compositor_opengl.cc.

601 {
602 g_return_if_fail(FL_IS_COMPOSITOR_OPENGL(self));
603
604 glClearColor(background_color->red, background_color->green,
605 background_color->blue, background_color->alpha);
606 glClear(GL_COLOR_BUFFER_BIT);
607
608 GPtrArray* framebuffers = reinterpret_cast<GPtrArray*>((g_hash_table_lookup(
609 self->framebuffers_by_view_id, GINT_TO_POINTER(view_id))));
610 if (framebuffers != nullptr) {
611 render(self, framebuffers, width, height);
612 }
613
614 glFlush();
615 }
render
static void render(FlCompositorOpenGL *self, GPtrArray *framebuffers, int width, int height)
Definition: fl_compositor_opengl.cc:284
height
const uint8_t uint32_t uint32_t * height
Definition: fl_pixel_buffer_texture_test.cc:39
width
const uint8_t uint32_t * width
Definition: fl_pixel_buffer_texture_test.cc:38
view_id
G_BEGIN_DECLS FlutterViewId view_id
Definition: fl_view_accessible.h:49

References height, render(), view_id, and width.

Referenced by render_cb(), and TEST().

## ◆ fl_compositor_opengl_setup()

void fl_compositor_opengl_setup | ( | FlCompositorOpenGL * | compositor | ) |

fl_compositor_opengl_setup: @compositor: an #FlCompositorOpenGL.

Creates OpenGL resources required before rendering. Requires an active context.

Definition at line 582 of file fl_compositor_opengl.cc.

582 {
583 g_return_if_fail(FL_IS_COMPOSITOR_OPENGL(self));
584
585 // Note: NVIDIA and Vivante are temporarily disabled due to
586 // https://github.com/flutter/flutter/issues/152099
587 self->has_gl_framebuffer_blit =
588 !is_nvidia() && !is_vivante() &&
589 (epoxy_gl_version() >= 30 ||
590 epoxy_has_gl_extension("GL_EXT_framebuffer_blit"));
591
592 if (!self->has_gl_framebuffer_blit) {
593 setup_shader(self);
594 }
595 }
setup_shader
static void setup_shader(FlCompositorOpenGL *self)
Definition: fl_compositor_opengl.cc:160
is_vivante
static gboolean is_vivante()
Definition: fl_compositor_opengl.cc:97

References is_vivante(), and setup_shader().

Referenced by realize_cb(), and TEST().

## ◆ G_DECLARE_FINAL_TYPE()

G_BEGIN_DECLS G_DECLARE_FINAL_TYPE | ( | FlCompositorOpenGL | ,
|  | fl_compositor_opengl | ,
|  | FL | ,
|  | COMPOSITOR_OPENGL | ,
|  | FlCompositor |
| ) |  |

FlCompositorOpenGL:

#FlCompositorOpenGL is an abstract class that allows Flutter to draw pixels. fl_compositor_opengl_new: @engine: an #FlEngine.

Creates a new OpenGL compositor.

Returns: a new #FlCompositorOpenGL.