title: OpenGL rendering to Framebuffer, transfer to OpenCV Umat for OpenCL accelerated processing
body: <p>In an older version of OpenCV I could render using OpenGL to the backbuffer, used <code>glreadpixels</code> to "copy" the pixels to an OpenCV image (iplimage?) for some processing (blurring, templatematching with another OpenCV-loaded image).  However that would cost me with the transfer from GPU to CPU and then if I wanted to display it, back to the GPU.</p>
  
  <p>Now I can do something similar with just OpenGL and OpenCL, by using <code>clEnqueueAcquireGLObjects</code> and I do not have to transfer at all.  I OpenGL render to a Framebuffer and let OpenCL take control of it.</p>
  
  <p>However this forces me to write my own OpenCL kernels (nobody has time for that...actually terribly hard to debug OpenCL on an Nvidia) for whatever processing I would like to do.  Now that OpenCV has some great OpenCL-accelerated processes I would like to try them out.</p>
  
  <p>So my question: Is it possible to render to the Framebuffer (or another GL context on the GPU), give control (or copy) to an OpenCV context (umat?) for OpenCL-accelerated processing?  If so, how (big picture, key components)?</p>
  
  <p>I have a feeling I can use <code>cv::ogl::Buffer</code> to wrap the buffer, but the documentation is not exactly clear on this, and then copy it using <code>ogl::Buffer::copyTo</code>. similar: <a href="https://stackoverflow.com/questions/18086519/is-it-possible-to-bind-a-opencv-gpumat-as-an-opengl-texture">Is it possible to bind a OpenCV GpuMat as an OpenGL texture?</a></p>
  
  <p>other ref: <a href="https://stackoverflow.com/questions/21356592/transfer-data-from-mat-oclmat-to-cl-mem-opencv-opencl">Transfer data from Mat/oclMat to cl_mem (OpenCV + OpenCL)</a></p>