CL/GL Interop

Is sharing OpenGL Textures with OpenCL possible in the current release?

I am able to create OpenCL image objects with the clCreateFromGLTexture2D function, but when I am trying to read data from (clEnqueueReadImage) or write (clEnqueueWriteImage or clEnqueueCopyImage) to the OpenCL image object a CL_INVALID_VALUE error occurs. Sharing of BufferObjects works fine though.

Haven’t tried it myself, but I believe it should work. What you can check is the list of supported image formats for your OpenCL implementation. Don’t know how to do this, but I vaguely remember discussions about this so a search either on this forum or should give you some hints.

I have made several tests and my results are:

    CL image channel order is CL_BGRA and channel type is CL_UNORM_INT8 with GL format GL_RGBA (GeForce 8800 GTS)

    reading from and writing to textures with kernel works

    copying with clEnqueueCopyImage does not work even if both source and destination are created from OpenGL textures (so no image format conflicts can occur)

    reading from and writing to textures with clEnqueueReadImage and clEnqueueWriteImage or mapping with clEnqueueMapImage does not work, too.

Can anyone confirm these results?