| Flutter Linux Embedder |

Functions
fl_framebuffer.h File Reference
`#include <epoxy/gl.h>`
`#include <glib-object.h>`

Go to the source code of this file.

## Functions
G_BEGIN_DECLS FlFramebuffer * | fl_framebuffer_new (GLint format, size_t width, size_t height)
GLuint | fl_framebuffer_get_id (FlFramebuffer *framebuffer)
GLuint | fl_framebuffer_get_texture_id (FlFramebuffer *framebuffer)
GLenum | fl_framebuffer_get_target (FlFramebuffer *framebuffer)
size_t | fl_framebuffer_get_width (FlFramebuffer *framebuffer)
size_t | fl_framebuffer_get_height (FlFramebuffer *framebuffer)

## Function Documentation

## ◆ fl_framebuffer_get_height()

size_t fl_framebuffer_get_height | ( | FlFramebuffer * | framebuffer | ) |

fl_framebuffer_get_height: @framebuffer: an #FlFramebuffer.

Gets the height of the framebuffer in pixels.

Returns: height in pixels.

Definition at line 98 of file fl_framebuffer.cc.

98 {
99 return self->height;
100 }

Referenced by present_layers(), render_with_blit(), and render_with_textures().

## ◆ fl_framebuffer_get_id()

GLuint fl_framebuffer_get_id | ( | FlFramebuffer * | framebuffer | ) |

fl_framebuffer_get_id: @framebuffer: an #FlFramebuffer.

Gets the ID for this framebuffer.

Returns: OpenGL framebuffer id or 0 if creation failed.

Definition at line 82 of file fl_framebuffer.cc.

82 {
83 return self->framebuffer_id;
84 }

Referenced by fl_compositor_opengl_create_backing_store(), present_layers(), and render_with_blit().

## ◆ fl_framebuffer_get_target()

GLenum fl_framebuffer_get_target | ( | FlFramebuffer * | framebuffer | ) |

fl_framebuffer_get_target: @framebuffer: an #FlFramebuffer.

Gets target texture (example GL_TEXTURE_2D or GL_TEXTURE_RECTANGLE).

Returns: target texture.

Definition at line 90 of file fl_framebuffer.cc.

90 {
91 return GL_TEXTURE_2D;
92 }

## ◆ fl_framebuffer_get_texture_id()

GLuint fl_framebuffer_get_texture_id | ( | FlFramebuffer * | framebuffer | ) |

fl_framebuffer_get_texture_id: @framebuffer: an #FlFramebuffer.

Gets the ID of the texture associated with this framebuffer.

Returns: OpenGL texture id or 0 if creation failed.

Definition at line 86 of file fl_framebuffer.cc.

86 {
87 return self->texture_id;
88 }

Referenced by present_layers(), and render_with_textures().

## ◆ fl_framebuffer_get_width()

size_t fl_framebuffer_get_width | ( | FlFramebuffer * | framebuffer | ) |

fl_framebuffer_get_width: @framebuffer: an #FlFramebuffer.

Gets the width of the framebuffer in pixels.

Returns: width in pixels.

Definition at line 94 of file fl_framebuffer.cc.

94 {
95 return self->width;
96 }

Referenced by present_layers(), render_with_blit(), and render_with_textures().

## ◆ fl_framebuffer_new()

G_BEGIN_DECLS FlFramebuffer* fl_framebuffer_new | ( | GLint | format,
|  | size_t | width,
|  | size_t | height
| ) |  |

FlFramebuffer:

#FlFramebuffer creates framebuffers and their backing textures for use by the Flutter compositor. fl_framebuffer_new: @format: format, e.g. GL_RGB, GL_BGR @width: width of texture. @height: height of texture.

Creates a new frame buffer. Requires a valid OpenGL context to create.

Returns: a new #FlFramebuffer.

Definition at line 42 of file fl_framebuffer.cc.

42 {
43 FlFramebuffer* provider =
44 FL_FRAMEBUFFER(g_object_new(fl_framebuffer_get_type(), nullptr));
45
46 provider->width = width;
47 provider->height = height;
48
49 glGenTextures(1, &provider->texture_id);
50 glGenFramebuffers(1, &provider->framebuffer_id);
51
52 glBindFramebuffer(GL_FRAMEBUFFER, provider->framebuffer_id);
53
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);
59 glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format,
60 GL_UNSIGNED_BYTE, NULL);
61 glBindTexture(GL_TEXTURE_2D, 0);
62
63 glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
64 provider->texture_id, 0);
65
66 GLuint depth_stencil;
67 glGenRenderbuffers(1, &depth_stencil);
68 glBindRenderbuffer(GL_RENDERBUFFER, depth_stencil);
69 glRenderbufferStorage(GL_RENDERBUFFER, // target
70 GL_DEPTH24_STENCIL8, // internal format
71 width, // width
72 height // height
73 );
74 glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
75 GL_RENDERBUFFER, depth_stencil);
76 glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
77 GL_RENDERBUFFER, depth_stencil);
78
79 return provider;
80 }
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
format
uint32_t uint32_t * format
Definition: fl_texture_registrar_test.cc:42

References format, height, and width.

Referenced by fl_compositor_opengl_create_backing_store(), present_layers(), and TEST().