12 std::shared_ptr<egl::ProcTable> gl)
18 if (gl_texture_ != 0) {
19 gl_->DeleteTextures(1, &gl_texture_);
26 FlutterOpenGLTexture* opengl_texture) {
27 if (!CopyPixelBuffer(width, height)) {
32 opengl_texture->target = GL_TEXTURE_2D;
33 opengl_texture->name = gl_texture_;
34 opengl_texture->format = GL_RGBA8_OES;
35 opengl_texture->destruction_callback =
nullptr;
36 opengl_texture->user_data =
nullptr;
37 opengl_texture->width = width;
38 opengl_texture->height = height;
43 bool ExternalTexturePixelBuffer::CopyPixelBuffer(
size_t& width,
46 texture_callback_(width, height, user_data_);
47 if (!pixel_buffer || !pixel_buffer->
buffer) {
50 width = pixel_buffer->
width;
51 height = pixel_buffer->
height;
53 if (gl_texture_ == 0) {
54 gl_->GenTextures(1, &gl_texture_);
56 gl_->BindTexture(GL_TEXTURE_2D, gl_texture_);
57 gl_->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
58 gl_->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
59 gl_->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
60 gl_->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
63 gl_->BindTexture(GL_TEXTURE_2D, gl_texture_);
65 gl_->TexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, pixel_buffer->
width,
66 pixel_buffer->
height, 0, GL_RGBA, GL_UNSIGNED_BYTE,