Which is the best way to build the host_ptr pointer? I mean, load an image file from disc.
I’m using libpng but only with RGBA channel-order (32-bit depth). It doesn’t work when I try to load a RGB image. Also, I need to work with another image formats (bmp, jpg, gif).
OpenCL doesn’t provide any built-in functionality for loading image data from disk.
However, you could use libraries like Qt or OpenCV to load the files from disk and then use the interop code in Boost.Compute to create OpenCL image objects. For example, see the qimage_blur demo program which loads a file with Qt, applies a gaussian blur kernel, and displays it (doing the same thing with OpenCV is also very simple).