unable to compile opencv 3.4.6 with opengl

Hello,
I am following this script https://github.com/jkjung-avt/jetson_nano/blob/master/install_opencv-3.4.6.sh by JK Jung for installing opencv, just disabling qt.
Even though I build it with WITH_OPENGL=ON , After generating config, I am getting this
GUI:
GTK+: YES (ver 3.22.30)
GThread : YES (ver 2.56.4)
GtkGlExt: NO
OpenGL support: NO
VTK support: NO

Is there any other way of building opencv with opengl support.

How ever when I did:
glxinfo | grep “OpenGL version”
OpenGL version string: 4.6.0 NVIDIA 32.1.0

glxinfo | grep rendering
direct rendering: Yes
GL_NV_path_rendering, GL_NV_path_rendering_shared_edge,
GL_NV_path_rendering, GL_NV_path_rendering_shared_edge,
GL_NV_packed_float_linear, GL_NV_path_rendering,
GL_NV_path_rendering_shared_edge, GL_NV_pixel_buffer_object,

But still when I am building opencv with opengl, it shows
– GUI:
– GTK+: YES (ver 3.22.30)
– GThread : YES (ver 2.56.4)
– GtkGlExt: NO
– OpenGL support: NO
– VTK support: NO

I am using the following patch as suggested in that article,

--- cuda_gl_interop.h.bak	2019-05-14 13:22:48.260006308 +0800
+++ cuda_gl_interop.h	2019-05-14 13:42:50.488005850 +0800
@@ -58,13 +58,13 @@
 
 #else /* __APPLE__ */
 
-#if defined(__arm__) || defined(__aarch64__)
-#ifndef GL_VERSION
-#error Please include the appropriate gl headers before including cuda_gl_interop.h
-#endif
-#else
+//#if defined(__arm__) || defined(__aarch64__)
+//#ifndef GL_VERSION
+//#error Please include the appropriate gl headers before including cuda_gl_interop.h
+//#endif
+//#else
 #include <GL/gl.h>
-#endif
+//#endif
 
 #endif /* __APPLE__ */

Every thing is building well, I am just stuck on this part, Any help ??

Is there any different patch required?

Hi,
Please check if below discussion thread helps:
https://devtalk.nvidia.com/default/topic/1055949/jetson-agx-xavier/opencv-with-gl-support-at-xavier/post/5353514/#5353514

thank you, It was all I needed.