Issue 1:
This is my specs:

General configuration for OpenCV 4.2.0 =====================================
Version control: 4.2.0

Extra modules:
Location (extra): /home/longlp/opencv/opencv_contrib_repo/modules
Version control (extra): 4.2.0

Platform:
Timestamp: 2019-12-22T05:39:36Z
Host: Linux 5.3.0-24-generic x86_64
CMake: 3.16.2
CMake generator: Ninja
CMake build tool: /usr/bin/ninja
Configuration: Release

CPU/HW features:
Baseline: SSE SSE2 SSE3
requested: SSE3
Dispatched code generation: SSE4_1 SSE4_2 FP16 AVX AVX2 AVX512_SKX
requested: SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX
SSE4_1 (16 files): + SSSE3 SSE4_1
SSE4_2 (2 files): + SSSE3 SSE4_1 POPCNT SSE4_2
FP16 (1 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX
AVX (5 files): + SSSE3 SSE4_1 POPCNT SSE4_2 AVX
AVX2 (29 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
AVX512_SKX (6 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_COMMON AVX512_SKX

C/C++:
Built as dynamic libs?: YES
C++ Compiler: /usr/bin/c++ (ver 8.3.0)
C++ flags (Release): -w -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG
C++ flags (Debug): -w -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG
C Compiler: /usr/bin/cc
C flags (Release): -w -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -O3 -DNDEBUG -DNDEBUG
C flags (Debug): -w -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -g -O0 -DDEBUG -D_DEBUG
Linker flags (Release): -Wl,--gc-sections
Linker flags (Debug): -Wl,--gc-sections
ccache: NO
Precompiled headers: NO
Extra dependencies: m pthread /usr/lib/x86_64-linux-gnu/libOpenGL.so /usr/lib/x86_64-linux-gnu/libGLX.so /usr/lib/x86_64-linux-gnu/libGLU.so cudart_static dl rt nppc nppial nppicc nppicom nppidei nppif nppig nppim nppist nppisu nppitc npps cublas cudnn cufft -L/usr/local/cuda/lib64 -L/usr/lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu/libClpSolver.so /usr/lib/x86_64-linux-gnu/libClp.so /usr/lib/x86_64-linux-gnu/libCoinUtils.so /usr/lib/x86_64-linux-gnu/libbz2.so /usr/lib/x86_64-linux-gnu/libz.so /usr/lib/x86_64-linux-gnu/liblapack.so /usr/lib/x86_64-linux-gnu/libblas.so /usr/lib/x86_64-linux-gnu/libm.so /home/longlp/halide/lib/libHalide.a
3rdparty dependencies:

OpenCV modules:
To be built: aruco bgsegm bioinspired calib3d ccalib core cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev cvv datasets dnn dnn_objdetect dnn_superres dpm face features2d flann freetype fuzzy gapi hdf hfs highgui img_hash imgcodecs imgproc line_descriptor ml objdetect optflow phase_unwrapping photo plot quality reg rgbd saliency sfm shape stereo stitching structured_light superres surface_matching text tracking ts video videoio videostab xfeatures2d ximgproc xobjdetect xphoto
Disabled: java_bindings_generator python_bindings_generator python_tests world
Disabled by dependency: -
Unavailable: cnn_3dobj java js matlab ovis python2 python3 viz
Applications: tests examples apps
Documentation: doxygen
Non-free algorithms: YES

GUI:
QT: YES (ver 5.14.0)
QT OpenGL support: YES (Qt5::OpenGL 5.14.0)
OpenGL support: YES (/usr/lib/x86_64-linux-gnu/libOpenGL.so /usr/lib/x86_64-linux-gnu/libGLX.so /usr/lib/x86_64-linux-gnu/libGLU.so)

Media I/O:
ZLib: /usr/lib/x86_64-linux-gnu/libz.so (ver 1.2.11)
JPEG: /usr/lib/x86_64-linux-gnu/libjpeg.so (ver 80)
WEBP: build (ver encoder: 0x020e)
PNG: /usr/lib/x86_64-linux-gnu/libpng.so (ver 1.6.37)
TIFF: /usr/lib/x86_64-linux-gnu/libtiff.so (ver 42 / 4.0.10)
JPEG 2000: build (ver 1.900.1)
OpenEXR: build (ver 2.3.0)
HDR: YES
SUNRASTER: YES
PXM: YES
PFM: YES

Video I/O:
DC1394: YES (2.2.5)
FFMPEG: YES
avcodec: YES (58.35.100)
avformat: YES (58.20.100)
avutil: YES (56.22.100)
swscale: YES (5.3.100)
avresample: YES (4.0.0)
GStreamer: YES (1.16.1)
v4l/v4l2: YES (linux/videodev2.h)
gPhoto2: YES

Parallel framework: TBB (ver 2019.0 interface 11008)

Trace: YES (with Intel ITT)

Other third-party libraries:
Intel IPP: 2019.0.0 Gold [2019.0.0]
at: /home/longlp/opencv/repo/build/3rdparty/ippicv/ippicv_lnx/icv
Intel IPP IW: sources (2019.0.0)
at: /home/longlp/opencv/repo/build/3rdparty/ippicv/ippicv_lnx/iw
VA: YES
Lapack: YES (/usr/lib/x86_64-linux-gnu/liblapack.so /usr/lib/x86_64-linux-gnu/libcblas.so /usr/lib/x86_64-linux-gnu/libatlas.so)
Halide: YES (/home/longlp/halide/lib/libHalide.a /home/longlp/halide/include)
Eigen: YES (ver 3.3.7)
Custom HAL: NO
Protobuf: build (3.5.1)

NVIDIA CUDA: YES (ver 10.2, CUFFT CUBLAS)
NVIDIA GPU arch: 60 61 70 75
NVIDIA PTX archs:

cuDNN: YES (ver 7.6.5)

OpenCL: YES (SVM)
Include path: /home/longlp/opencv/repo/3rdparty/include/opencl/1.2
Link libraries: Dynamic load

Python (for build): /usr/bin/python2.7

Install to: /home/longlp/opencv/install

Output:

FAILED: bin/example_rgbd_odometry_evaluation
: && /usr/bin/c++ -w -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG -Wl,--gc-sections modules/rgbd/CMakeFiles/example_rgbd_odometry_evaluation.dir/samples/odometry_evaluation.cpp.o -o bin/example_rgbd_odometry_evaluation -L/usr/local/cuda/lib64 -Wl,-rpath,/usr/local/cuda/lib64:/home/longlp/opencv/repo/build/lib:/home/longlp/qt/5.14.0/gcc_64/lib lib/libopencv_rgbd.so.4.2.0 lib/libopencv_calib3d.so.4.2.0 lib/libopencv_highgui.so.4.2.0 lib/libopencv_features2d.so.4.2.0 lib/libopencv_flann.so.4.2.0 lib/libopencv_videoio.so.4.2.0 lib/libopencv_imgcodecs.so.4.2.0 lib/libopencv_imgproc.so.4.2.0 lib/libopencv_core.so.4.2.0 lib/libopencv_cudev.so.4.2.0 -Wl,-rpath-link,/home/longlp/qt/5.14.0/gcc_64/lib && :
/usr/bin/ld: lib/libopencv_rgbd.so.4.2.0: undefined reference to `glRenderbufferStorageEXT'
/usr/bin/ld: lib/libopencv_rgbd.so.4.2.0: undefined reference to `glGenFramebuffersEXT'
/usr/bin/ld: lib/libopencv_rgbd.so.4.2.0: undefined reference to `glBindRenderbufferEXT'
/usr/bin/ld: lib/libopencv_rgbd.so.4.2.0: undefined reference to `glGenRenderbuffersEXT'
/usr/bin/ld: lib/libopencv_rgbd.so.4.2.0: undefined reference to `glFramebufferRenderbufferEXT'
/usr/bin/ld: lib/libopencv_rgbd.so.4.2.0: undefined reference to `glBindFramebufferEXT'

Issue 2:
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.