I haven\'t been able to find any reference except for:
http://answers.opencv.org/question/9512/how-to-bind-gpumat-to-texture/
which discusses a CUDA approach.
OpenCV has OpenGL support. See opencv2/core/opengl_interop.hpp
header file. You can copy the content of GpuMat to Texture:
cv::gpu::GpuMat d_mat(768, 1024, CV_8UC3);
cv::ogl::Texture2D tex;
tex.copyFrom(d_mat);
tex.bind();
// draw something
You can also use cv::ogl::Buffer
class. It is a wrapper for OpenGL buffer memory. This memory can be mapped to CUDA memory without memory copy:
cv::ogl::Buffer ogl_buf(1, 1000, CV_32FC3);
cv::gpu::GpuMat d_mat = ogl_buf.mapDevice();
// fill d_mat with CUDA
ogl_buf.unmapDevice();
// use ogl_buf in OpenGL
ogl_buf.bind(cv::ogl::Buffer::ARRAY_BUFFER);
glDrawArray(...);