Skip to content

highgui GTK2 with OpenGL broken in master #20850

@huangqinjin

Description

@huangqinjin
System information (version)
Case 1 (resolved, 4.5.5)
cmake .. -DWITH_GTK=ON -DWITH_GTK_2_X=ON -DWITH_OPENGL=ON
/usr/lib64/gcc/x86_64-suse-linux/11/../../../../x86_64-suse-linux/bin/ld: lib/libopencv_core.so.4.5.4: undefined reference to `glXGetCurrentDisplay'
/usr/lib64/gcc/x86_64-suse-linux/11/../../../../x86_64-suse-linux/bin/ld: lib/libopencv_core.so.4.5.4: undefined reference to `glXGetCurrentContext'
/usr/lib64/gcc/x86_64-suse-linux/11/../../../../x86_64-suse-linux/bin/ld: lib/libopencv_core.so.4.5.4: undefined reference to `glXGetProcAddressARB'
Case 2
cmake .. -DWITH_GTK=ON -DWITH_GTK_2_X=ON -DWITH_OPENGL=ON -DHIGHGUI_ENABLE_PLUGINS=OFF
#include <opencv2/highgui.hpp>
#include <opencv2/core/opengl.hpp>

int main(int argc, char* argv[])
{
    bool use_texture = argc > 1;

    cv::namedWindow("img", cv::WINDOW_OPENGL | cv::WINDOW_AUTOSIZE);
    cv::Mat img = cv::Mat(200, 200, CV_8UC3, CV_RGB(255, 0, 0));

    if (use_texture)
    {
        cv::ogl::Texture2D tex;
        tex.copyFrom(img);
        cv::imshow("img", tex);
    }
    else
    {
        cv::imshow("img", img);
    }

    cv::waitKey(0);
}
use_texture Window
true red (OK)
false black ( X )
Case 3
cmake .. -DWITH_GTK=ON -DWITH_GTK_2_X=ON -DWITH_OPENGL=ON -DWITH_QT=ON -DHIGHGUI_PLUGIN_LIST=all
#include <opencv2/highgui.hpp>

int main()
{
    cv::namedWindow("img", cv::WINDOW_OPENGL | cv::WINDOW_AUTOSIZE);
}
terminate called after throwing an instance of 'cv::Exception'
  what():  OpenCV(4.5.4-pre) /home/huangqinjin/Projects/opencv/modules/highgui/src/window_gtk.cpp:1137: error: (-218:No OpenGL support) Library was built without OpenGL support in function 'namedWindow_'
Issue submission checklist
  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues,
    forum.opencv.org, Stack Overflow, etc and have not found solution
  • I updated to latest OpenCV version and the issue is still there
  • There is reproducer code and related data files: videos, images, onnx, etc

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions