1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-31 08:13:04 +04:00

Merge pull request #29485 from kirtijindal14:opengl-core-highgui

Core, Highgui: OpenGL wrappers & window free-callback API #29485

This PR is a continuation of the work started in [20371](https://github.com/opencv/opencv/pull/20371)
### Pull Request Readiness Checklist

See details at https://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
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
kirtijindal14
2026-07-26 17:33:35 +05:30
committed by GitHub
parent 6e70e5d2a9
commit 4ccee4a65f
12 changed files with 1397 additions and 87 deletions
@@ -201,6 +201,11 @@ typedef void (*TrackbarCallback)(int pos, void* userdata);
*/
typedef void (*OpenGlDrawCallback)(void* userdata);
/** @brief Callback function defined to be called when a window's resources should be freed. See cv::setOpenGlFreeCallback
@param userdata The window's OpenGL user data to be freed.
*/
typedef void (*OpenGlFreeCallback)(void* userdata);
/** @brief Callback function for a button created by cv::createButton
@param state current state of the button. It could be -1 for a push button, 0 or 1 for a check/radio box button.
@param userdata The optional parameter.
@@ -617,6 +622,26 @@ prototyped as void Foo(void\*) .
*/
CV_EXPORTS void setOpenGlDrawCallback(const String& winname, OpenGlDrawCallback onOpenGlDraw, void* userdata = 0);
/** @brief Sets a callback function to be called when OpenGL resources related to a window should be freed.
@param winname Name of the window.
@param onOpenGlFree Pointer to the function to be called when resources should be freed. This
function should be prototyped as void Foo(void\*) .
*/
CV_EXPORTS void setOpenGlFreeCallback(const String& winname, OpenGlFreeCallback onOpenGlFree);
/** @brief This function returns the pointer to the function associated to a window to be called every frame. See cv::setOpenGlDrawCallback.
@param winname Name of the window.
*/
CV_EXPORTS OpenGlDrawCallback getOpenGlDrawCallback(const String& winname);
/** @brief This function returns the pointer to the OpenGL user data associated to a window.
@param winname Name of the window.
*/
CV_EXPORTS void* getOpenGlUserData(const String& winname);
/** @brief Sets the specified window as current OpenGL context.
@param winname Name of the window.