CL/GL Interop question


It’s time now for me to explore CL/GL Interop, so i started looking at the oclPostprocessGL example coming with the sdk.

as far as i understand , what happen is:

  1. 2 PBOs are created
  2. the teapot is rendered
  3. the image is read into a pbo with glReadPixels
  4. the PBOs are “registered” to CL, data is processed, then the PBOs are unregistered
  5. data is copied (glTexSubImage2D) from second pbo to a texture
  6. the texture is displayed

My question is: isnt it possible to eliminate the steps 3 and 5? i mean, isnt it possible to use an opencl buffer directly as a texture?
For example, couldnt it be possible to

  1. use a FBO to render into a texture
  2. register the texture as an opencl buffer or something
  3. register the second (output) buffer as a second opengl texture
  4. display it


in this way we would skip memory copy operation i think. Or i misunderstood, and these operations are not really being performed, as the PBO implementation
make so that there is no copy?

In general it would also be nice to use a cl_mem object in opengl either as a texture or as a vertex array, for example (VBO) without having to copy any memory.
Is it possible at the moment?

thanks in advance!