views:

65

answers:

2

Hello!

Is it ok to use both OpenGL an OpenCL in one program? Both operate on GPU and I'm afraid how switching between OpenCL and OpenGL is handled in "background" (e.g. registers are overwritten).

I'm using Linux working on computer with some nVidia graphic 8k, so i can use OpenCL implemented on top of the CUDA.

+1  A: 

Yes, it's fine, you can even share data between OpenCL and OpenGL.

Matias Valdenegro
Where can read about details about sharing data between both solutions?
Goofy
See the appendix of the CL specification about creating CL buffers from GL buffersn and take a look at the CL_KHR_gl_sharing extension.
Matias Valdenegro
+1  A: 

Yes you can

OpenCL 1.1 includes significant new functionality including::

Improved OpenGL interoperability through efficient sharing of images and buffers by linking OpenCL event objects to OpenGL fence sync objects

http://www.khronos.org/opencl/

honibis
One thing to note (and actually something i tripped over) is that you have to get the OpenCL context from your OpenGL context ... else object sharing won't work.
Florian