From f3bdb6cf0101693d48cd533a7bd381b3b3dbf8cc Mon Sep 17 00:00:00 2001 From: kirtijindal14 Date: Thu, 30 Jul 2026 14:14:31 +0530 Subject: [PATCH] highgui: enable depth buffer for GTK3 GtkGLArea so GL_DEPTH_TEST works --- modules/highgui/src/window_gtk.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/highgui/src/window_gtk.cpp b/modules/highgui/src/window_gtk.cpp index ec5df72aa0..301013c542 100644 --- a/modules/highgui/src/window_gtk.cpp +++ b/modules/highgui/src/window_gtk.cpp @@ -1069,6 +1069,8 @@ static std::shared_ptr namedWindow_(const std::string& name, int flags #if defined(HAVE_OPENGL) && defined(GTK_VERSION3) if (flags & cv::WINDOW_OPENGL) { window->glArea = gtk_gl_area_new(); + // GtkGLArea has no depth buffer by default; request one so GL_DEPTH_TEST works. + gtk_gl_area_set_has_depth_buffer(GTK_GL_AREA(window->glArea), TRUE); gtk_container_add(GTK_CONTAINER(window->frame), window->glArea); gtk_widget_show(window->glArea); } else {