Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Support OpenGL GTK3 New API#25822

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
asmorkalov merged 10 commits intoopencv:4.xfrommqcmd196:gtk3-gl-support
Jul 15, 2024
Merged

Conversation

@mqcmd196
Copy link
Contributor

@mqcmd196mqcmd196 commentedJun 27, 2024
edited
Loading

Fixes#20001

GSoC2024 Project

Pull Request Readiness Checklist

See details athttps://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
  • The PR is proposed to the proper branch
  • There is a reference to the original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake

@asmorkalov
Copy link
Contributor

./bin/example_opengl_openglUsage: ./bin/example_opengl_opengl image[ WARN:0@0.001] global samples.cpp:61 findFile cv::samples::findFile('lena.jpg') => '/home/alexander/Projects/OpenCV/opencv-build/../opencv-master/samples/data/lena.jpg'terminate called after throwing an instance of 'cv::Exception'  what():  OpenCV(4.10.0-dev) /home/alexander/Projects/OpenCV/opencv-master/modules/core/src/opengl.cpp:359: error: (-215:Assertion failed) bufId_ != 0 in function 'Impl'

@asmorkalov
Copy link
Contributor

I created a sample from your test and it shows just empty window:

#ifdef _WIN32    #define WIN32_LEAN_AND_MEAN 1    #define NOMINMAX 1    #include <windows.h>#endif#if defined(__APPLE__)    #include <OpenGL/gl.h>    #include <OpenGL/glu.h>#else    #include <GL/gl.h>    #include <GL/glu.h>#endif#include "opencv2/core.hpp"#include "opencv2/core/opengl.hpp"#include "opencv2/core/cuda.hpp"#include "opencv2/highgui.hpp"using namespace cv;using namespace std;int main(int argc, char* argv[]){    const std::string window_name("gl_test_window");    const Size image_size(800, 600);    namedWindow(window_name, WINDOW_OPENGL);    Mat m = Mat(image_size, CV_8UC3, Scalar(255, 0, 0));    resizeWindow(window_name, image_size);    setOpenGlContext(window_name);    setOpenGlDrawCallback(window_name, [](void*){        glClear(GL_COLOR_BUFFER_BIT);        glColor3f(1.0f, 0.0f, 0.0f);        glBegin(GL_QUADS);        glVertex2f(-0.5f, -0.5f);        glVertex2f( 0.5f, -0.5f);        glVertex2f( 0.5f,  0.5f);        glVertex2f(-0.5f,  0.5f);        glEnd();    });    imshow(window_name, m);    while (waitKey(30) != 27)    {    }    setOpenGlDrawCallback(window_name, 0);    destroyAllWindows();}

@asmorkalovasmorkalov self-assigned thisJul 3, 2024
@mqcmd196mqcmd196force-pushed thegtk3-gl-support branch 3 times, most recently fromea0e347 toa35dfd3CompareJuly 5, 2024 07:18
@mqcmd196
Copy link
ContributorAuthor

mqcmd196 commentedJul 5, 2024
edited
Loading

@asmorkalov
I updated the codes and confirmed that the GL test inmodules/highgui/test/test_gui.cpp works well. (This test will be removed when merged.) As I mentioned online, GTK3's OpenGL API only supports OpenGL > 3.2 , and I updated its test code to 3.2.

I'll continue working on supporting current OpenCV's OpenGL example code.

@mqcmd196
Copy link
ContributorAuthor

And I squashed some commits into a single commit.

@asmorkalov
Copy link
Contributor

Looks like we are closer to result, but opengl/opengl.cpp still does not work correctly. I do not see error messages any more and just black window.

@asmorkalov
Copy link
Contributor

In case I add sample with your test code I see the following error:

/usr/bin/ld: CMakeFiles/example_opengl_opengl.dir/opengl.cpp.o: unresolved external symbol «epoxy_glDrawArrays»//usr/lib/x86_64-linux-gnu/libepoxy.so.0: error adding symbols: DSO missing from command linecollect2: error: ld returned 1 exit statussamples/opengl/CMakeFiles/example_opengl_opengl.dir/build.make:103: recipe for target 'bin/example_opengl_opengl' failedmake[3]: *** [bin/example_opengl_opengl] Error 1

The error means that libepoxy is missing somewhere in cmake. I'll take a look today.

@mqcmd196
Copy link
ContributorAuthor

mqcmd196 commentedJul 5, 2024
edited
Loading

Looks like we are closer to result, but opengl/opengl.cpp still does not work correctly. I do not see error messages any more and just black window.

Thank you. The code is written in a legacy OpenGL version, so it won't be drawn in a newer GtkGlArea, I think.

So I added the example code for OpenGL 3.2c035d93

@mqcmd196mqcmd196 marked this pull request as ready for reviewJuly 14, 2024 03:57
@mqcmd196
Copy link
ContributorAuthor

Sorry, I forgot to remove them.

@asmorkalov
Copy link
Contributor

Tested manually with:

  • Ubuntu 18.04 + GTK 2
  • Ubuntu 18.04 + GTK 3
  • Ubuntu 18.04 + QT 5.9
  • Ubuntu 24.04 + GTK 3
  • Ubuntu 24.04 + QT 5.15

@asmorkalovasmorkalov merged commit4842043 intoopencv:4.xJul 15, 2024
@mqcmd196mqcmd196 deleted the gtk3-gl-support branchJuly 15, 2024 14:08
@asmorkalovasmorkalov mentioned this pull requestJul 16, 2024
fengyuentau pushed a commit to fengyuentau/opencv that referenced this pull requestAug 15, 2024
Support OpenGL GTK3 New APIopencv#25822Fixesopencv#20001GSoC2024 Project### Pull Request Readiness ChecklistSee details athttps://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request- [x] I agree to contribute to the project under Apache 2 License.- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV- [x] The PR is proposed to the proper branch- [x] There is a reference to the original bug report and related work- [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable      Patch to opencv_extra has the same branch name.- [ ] The feature is well documented and sample code can be built with the project CMake
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@asmorkalovasmorkalovasmorkalov approved these changes

+1 more reviewer

@cpoerschkecpoerschkecpoerschke left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

@asmorkalovasmorkalov

Projects

None yet

Milestone

4.11.0

Development

Successfully merging this pull request may close these issues.

A strange logic when checking opengl support in OpenCVFindLibsGUI.cmake

3 participants

@mqcmd196@asmorkalov@cpoerschke

[8]ページ先頭

©2009-2025 Movatter.jp