3DExtended
3DExtended

Reputation: 151

OpenCL - OpenGL - Interop: How to fill a cl::ImageGL

I have an issue with the OpenCL OpenGL interop mode:

cl::ImageGL imageFromGL(context, CL_MEM_READ_WRITE, GL_TEXTURE_2D, 0, myGL->textures[0], errNum);

so there are various problems:

  1. How do I get a const & cl_context from my cl_context context?
  2. What is my target? (some websites told me to use GL_TEXTURE_2D but this does not work.)

Upvotes: 2

Views: 386

Answers (1)

Lee
Lee

Reputation: 930

You can get the context by calling () on the cl::Context object, or the get method which is added in the latest version of the header if you wish to download that (https://www.khronos.org/registry/cl/api/2.0/cl2.hpp).

so cl::Context c = ....; cl_context ctx = c(); In the new version this was cleaned up so that ct. = c.get() works too. I'm not sure why you would need to get it in this case though, the constructor takes a cl::Context.

The full set of options are in the description of clCreateImageFromGLTexture (https://www.khronos.org/registry/cl/sdk/1.2/docs/man/xhtml/clCreateFromGLTexture.html).

GL_TEXTURE_2D is a valid target. What is the error you are seeing?

Upvotes: 1

Related Questions