Question about GL_INTEROP option in SimpleGL sample code

Hi,

Does anybody know how different in term of data flow of oclSimpleGL program if enable/disable “#define GL_INTEROP”?

In createVBO(), and runKernel() procedures, I can see there is special GL buffer was create and map/unmap from OpenCL to “vbo_cl”. I guess, when enable GL_INTEROP, the collection of positions of points (or dots) was fed to GL buffer directly.

While without GL_INTEROP, the computed positions of dots were stored to a temporary pointer “ptr” (in runKernel()) before they can be copied to “vbo_cl”.

Please correct me or confirm if I understand the data flow correctly.

Thank you,

To me it looks like this:
With GL_INTEROP:

  • no new CL buffer is allocated for the VBO, GL already-allocated storage is used instead
  • it has to be acquired before executing the kernel and released after executing the kernel
    Without:
  • new CL buffer for the VBO is allocated on the device

In either case, the device/GL buffers are WRITE_ONLY, so they get filled by the kernel and then ‘need’ to be copied back to host for displaying.
Here, they copy the stuff after kernel is finished from the device to CPU and then to GL, so CL->CPU->GL. The CPU step (mapping GL buffers to server(host) memory) could be easily avoided by using CL/GL interoperability again (perhaps making the buffer read-write) :-)