From a18a62ef044a38858f687c4810400de4a3ee9528 Mon Sep 17 00:00:00 2001 From: MediaPipe Team Date: Mon, 27 Mar 2023 23:11:24 -0700 Subject: [PATCH] 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 --- mediapipe/calculators/util/annotation_overlay_calculator.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediapipe/calculators/util/annotation_overlay_calculator.cc b/mediapipe/calculators/util/annotation_overlay_calculator.cc index 8af4a5de8..6e0dc769b 100644 --- a/mediapipe/calculators/util/annotation_overlay_calculator.cc +++ b/mediapipe/calculators/util/annotation_overlay_calculator.cc @@ -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);