Make AnnotationOverlayCalculator compatible with GLES2/WebGL1 by using GL_RGB as internal format instead of GL_RGB8 for the texture that OpenCV renders into.

PiperOrigin-RevId: 519933934
This commit is contained in:
MediaPipe Team 2023-03-27 23:11:24 -07:00 committed by Copybara-Service
parent 94db96fa5e
commit a18a62ef04

View File

@ -658,7 +658,7 @@ absl::Status AnnotationOverlayCalculator::GlSetup(CalculatorContext* cc) {
glBindTexture(GL_TEXTURE_2D, image_mat_tex_);
// TODO
// OpenCV only renders to RGB images, not RGBA. Ideally this should be RGBA.
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, width_canvas_, height_canvas_, 0,
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width_canvas_, height_canvas_, 0,
GL_RGB, GL_UNSIGNED_BYTE, nullptr);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);