Repository: opencv/opencv_contrib

Issue #2307: RGBD failing to compile with OpenGL enabled
Created: 2019-10-24T14:55:11Z
System information (version)


OpenCV => Latest master
Operating System / Platform => Windows 10 x64
Compiler => Visual Studio 2017 x64

Detailed description
With OpenGL enabled and RGBD, it does not compile due to an error:
OpenCV-Contrib\modules\rgbd\src\dynafu.cpp(234): error C2131: expression did not evaluate to a constant
OpenCV-Contrib\modules\rgbd\src\dynafu.cpp(234): note: failure was caused by a read of a variable outside its lifetime
OpenCV-Contrib\modules\rgbd\src\dynafu.cpp(234): note: see usage of 'this'
OpenCV-Contrib\modules\rgbd\src\dynafu.cpp(206): note: while compiling class template member function 'void cv::dynafu::DynaFuImpl<cv::Mat>::drawScene(cv::OutputArray,cv::OutputArray)'
OpenCV-Contrib\modules\rgbd\src\dynafu.cpp(526): note: see reference to function template instantiation 'void cv::dynafu::DynaFuImpl<cv::Mat>::drawScene(cv::OutputArray,cv::OutputArray)' being compiled
OpenCV-Contrib\modules\rgbd\src\dynafu.cpp(275): note: while compiling class template member function 'cv::dynafu::DynaFuImpl<cv::Mat>::~DynaFuImpl(void)'
OpenCV-Contrib\modules\rgbd\src\dynafu.cpp(291): note: see reference to class template instantiation 'cv::dynafu::DynaFuImpl<cv::Mat>' being compiled
OpenCV-Contrib\modules\rgbd\src\dynafu.cpp(235): error C2131: expression did not evaluate to a constant
OpenCV-Contrib\modules\rgbd\src\dynafu.cpp(235): note: failure was caused by a read of a variable outside its lifetime
OpenCV-Contrib\modules\rgbd\src\dynafu.cpp(235): note: see usage of 'this'

The exact code that is failing is here:
float f[params.frameSize.width*params.frameSize.height];

Steps to reproduce
Compile with OpenGL and RGBD enabled.

Duplicate issue #2423: Building project "opencv_rgbd" FAILED
Created: 2020-02-07T01:31:28Z
System information (version)


OpenCV => 4.20
Operating System / Platform => Windows 64 Bit
Compiler => Visual Studio 2019
CUDA => 10.2

Detailed description

All other models except the rgbd model have been compiled.
following is the error message:

1>------ Build started: Project: ZERO_CHECK, Configuration: Debug x64 ------
2>------ Build started: Project: opencv_rgbd, Configuration: Debug x64 ------
2>dynafu.cpp
2>E:\OpenCV4.2\SourceCode\opencv_contrib-4.2.0\modules\rgbd\src\dynafu.cpp(242,28): warning C4244: '=': conversion from 'double' to '_Tp', possible loss of data
2>        with
2>        [
2>            _Tp=float
2>        ]
2>E:\OpenCV4.2\SourceCode\opencv_contrib-4.2.0\modules\rgbd\src\dynafu.cpp(206): message : while compiling class template member function 'void cv::dynafu::DynaFuImplcv::Mat::drawScene(cv::OutputArray,cv::OutputArray)'
2>E:\OpenCV4.2\SourceCode\opencv_contrib-4.2.0\modules\rgbd\src\dynafu.cpp(524): message : see reference to function template instantiation 'void cv::dynafu::DynaFuImplcv::Mat::drawScene(cv::OutputArray,cv::OutputArray)' being compiled
2>E:\OpenCV4.2\SourceCode\opencv_contrib-4.2.0\modules\rgbd\src\dynafu.cpp(273): message : while compiling class template member function 'cv::dynafu::DynaFuImplcv::Mat::~DynaFuImpl(void)'
2>E:\OpenCV4.2\SourceCode\opencv_contrib-4.2.0\modules\rgbd\src\dynafu.cpp(289): message : see reference to class template instantiation 'cv::dynafu::DynaFuImplcv::Mat' being compiled
2>E:\OpenCV4.2\SourceCode\opencv_contrib-4.2.0\modules\rgbd\src\dynafu.cpp(181,5): error C3861: 'glGenRenderbuffersEXT': identifier not found
2>E:\OpenCV4.2\SourceCode\opencv_contrib-4.2.0\modules\rgbd\src\dynafu.cpp(169): message : while compiling class template member function 'cv::dynafu::DynaFuImplcv::Mat::DynaFuImpl(const cv::dynafu::Params &)'
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\xmemory(204): message : see reference to function template instantiation 'cv::dynafu::DynaFuImplcv::Mat::DynaFuImpl(const cv::dynafu::Params &)' being compiled
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\memory(1491): message : see reference to function template instantiation 'void std::_Construct_in_place<_Ty,const cv::dynafu::Params&>(_Ty &,const cv::dynafu::Params &) noexcept(false)' being compiled
2>        with
2>        [
2>            _Ty=cv::dynafu::DynaFuImplcv::Mat
2>        ]
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\memory(1591): message : see reference to function template instantiation 'std::_Ref_count_obj2<_Ty>::_Ref_count_obj2<const cv::dynafu::Params&>(const cv::dynafu::Params &)' being compiled
2>        with
2>        [
2>            _Ty=cv::dynafu::DynaFuImplcv::Mat
2>        ]
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\memory(1591): message : see reference to function template instantiation 'std::_Ref_count_obj2<_Ty>::_Ref_count_obj2<const cv::dynafu::Params&>(const cv::dynafu::Params &)' being compiled
2>        with
2>        [
2>            _Ty=cv::dynafu::DynaFuImplcv::Mat
2>        ]
2>E:\OpenCV4.2\SourceCode\opencv-4.2.0\modules\core\include\opencv2\core\cvstd_wrapper.hpp(146): message : see reference to function template instantiation 'std::shared_ptr std::make_shared<_Tp,const _Ty&>(const _Ty &)' being compiled
2>        with
2>        [
2>            T=cv::dynafu::DynaFuImplcv::Mat,
2>            _Tp=cv::dynafu::DynaFuImplcv::Mat,
2>            _Ty=cv::dynafu::Params
2>        ]
2>E:\OpenCV4.2\SourceCode\opencv_contrib-4.2.0\modules\rgbd\src\dynafu.cpp(544): message : see reference to function template instantiation 'cv::Ptr<cv::dynafu::DynaFuImplcv::Mat> cv::makePtr<cv::dynafu::DynaFuImplcv::Mat,_Ty>(const _Ty &)' being compiled
2>        with
2>        [
2>            _Ty=cv::dynafu::Params
2>        ]
2>E:\OpenCV4.2\SourceCode\opencv_contrib-4.2.0\modules\rgbd\src\dynafu.cpp(182,27): error C2065: 'GL_RENDERBUFFER_EXT': undeclared identifier
2>E:\OpenCV4.2\SourceCode\opencv_contrib-4.2.0\modules\rgbd\src\dynafu.cpp(182,5): error C3861: 'glBindRenderbufferEXT': identifier not found
2>E:\OpenCV4.2\SourceCode\opencv_contrib-4.2.0\modules\rgbd\src\dynafu.cpp(183,30): error C2065: 'GL_RENDERBUFFER_EXT': undeclared identifier
2>E:\OpenCV4.2\SourceCode\opencv_contrib-4.2.0\modules\rgbd\src\dynafu.cpp(183,5): error C3861: 'glRenderbufferStorageEXT': identifier not found
2>E:\OpenCV4.2\SourceCode\opencv_contrib-4.2.0\modules\rgbd\src\dynafu.cpp(186,5): error C3861: 'glGenFramebuffersEXT': identifier not found
2>E:\OpenCV4.2\SourceCode\opencv_contrib-4.2.0\modules\rgbd\src\dynafu.cpp(187,26): error C2065: 'GL_FRAMEBUFFER_EXT': undeclared identifier
2>E:\OpenCV4.2\SourceCode\opencv_contrib-4.2.0\modules\rgbd\src\dynafu.cpp(187,5): error C3861: 'glBindFramebufferEXT': identifier not found
2>E:\OpenCV4.2\SourceCode\opencv_contrib-4.2.0\modules\rgbd\src\dynafu.cpp(189,34): error C2065: 'GL_FRAMEBUFFER_EXT': undeclared identifier
2>E:\OpenCV4.2\SourceCode\opencv_contrib-4.2.0\modules\rgbd\src\dynafu.cpp(189,54): error C2065: 'GL_DEPTH_ATTACHMENT_EXT': undeclared identifier
2>E:\OpenCV4.2\SourceCode\opencv_contrib-4.2.0\modules\rgbd\src\dynafu.cpp(189,79): error C2065: 'GL_RENDERBUFFER_EXT': undeclared identifier
2>E:\OpenCV4.2\SourceCode\opencv_contrib-4.2.0\modules\rgbd\src\dynafu.cpp(189,5): error C3861: 'glFramebufferRenderbufferEXT': identifier not found
2>E:\OpenCV4.2\SourceCode\opencv_contrib-4.2.0\modules\rgbd\src\dynafu.cpp(193,5): error C3861: 'glGenRenderbuffersEXT': identifier not found
2>E:\OpenCV4.2\SourceCode\opencv_contrib-4.2.0\modules\rgbd\src\dynafu.cpp(194,27): error C2065: 'GL_RENDERBUFFER_EXT': undeclared identifier
2>E:\OpenCV4.2\SourceCode\opencv_contrib-4.2.0\modules\rgbd\src\dynafu.cpp(194,5): error C3861: 'glBindRenderbufferEXT': identifier not found
2>E:\OpenCV4.2\SourceCode\opencv_contrib-4.2.0\modules\rgbd\src\dynafu.cpp(195,30): error C2065: 'GL_RENDERBUFFER_EXT': undeclared identifier
2>E:\OpenCV4.2\SourceCode\opencv_contrib-4.2.0\modules\rgbd\src\dynafu.cpp(195,5): error C3861: 'glRenderbufferStorageEXT': identifier not found
2>E:\OpenCV4.2\SourceCode\opencv_contrib-4.2.0\modules\rgbd\src\dynafu.cpp(197,34): error C2065: 'GL_FRAMEBUFFER_EXT': undeclared identifier
2>E:\OpenCV4.2\SourceCode\opencv_contrib-4.2.0\modules\rgbd\src\dynafu.cpp(197,54): error C2065: 'GL_COLOR_ATTACHMENT0_EXT': undeclared identifier
2>E:\OpenCV4.2\SourceCode\opencv_contrib-4.2.0\modules\rgbd\src\dynafu.cpp(197,80): error C2065: 'GL_RENDERBUFFER_EXT': undeclared identifier
2>E:\OpenCV4.2\SourceCode\opencv_contrib-4.2.0\modules\rgbd\src\dynafu.cpp(197,5): error C3861: 'glFramebufferRenderbufferEXT': identifier not found
2>Done building project "opencv_rgbd.vcxproj" -- FAILED.
========== Build: 1 succeeded, 1 failed, 20 up-to-date, 0 skipped ==========

Closing comment (2020-02-07T07:19:59Z): duplicate #2307