Using QtOpenCL with Qt5

In the age of Qt4, there was an experimental support for easily using OpenCL together with Qt: QtOpenCL. These days, you normally using Qt5 for your projects and unfortunately, QtOpenCL was not supported with Qt5.

I'm happy to annouce that you can now use the original QtOpenCL module together with Qt5. The changes have been quite easy, I just had to transfer it to a Qt5 module from *.pro-files point of view.

QtOpenCL internally consists of two sepereate modules: QtOpenCL and QtOpenCLGL. The first is for general OpenCL usage, the second one can be used for mixing OpenCL and OpenGL.

Build the module

# git clone
# cd qtopencl
# qmake
# make
# make install

Using the module

Adding the module to your *.pro file:
# ...
# QT += opencl
# ...

You then can use the QtOpenCL headers by #include <QtOpenCL/...>.

Using the examples/demos

You will find several examples inside the QtOpenCL module. vectoradd is a good starting point, it shows a minimal QtOpenCL application.
Additionally to the examples, you will find to applications in a seperate demo folder. The following picture shows the mandelbrot demo application:

What's next?

The module currently just has support for OpenCL 1.0. It has support for OpenCL 1.1, but therefore we need proper configure tests. Please check my incomplete list of action items:

  • config tests for OpenCL 1.1
  • support for QtWidget-less QOpenGL-classes
  • support integration with QML / scenegraph
Feel free to participate on Github or provide some feedback, check out


Beliebte Posts aus diesem Blog

Native Look-and-Feel on Windows 10 Mobile with Qt / QML

Building QtWebKit Technology Preview 5 from Sources

Qt5 on Windows Phone - Current State