AnsweredAssumed Answered

OpenGL interop

Question asked by foofel on Sep 2, 2014
Latest reply on Jun 10, 2015 by dipak



I am currently trying to get the opengl/opencl interop running but can't get it to work. My current order of initialization is like this: init OpenGL context (debug context), Init OpenCL (with opengl sharing), create opengl ressources (texture and buffers), create opencl image from the opengl texture via clCreateFromGLTexture. Untill there everything works fine and no errors are reported. if i query the opencl image it has the same properties as the opengl texture, so this seems to work. but as soon as i try to aquire the opencl image via clEnqueueAcquireGLObjects, i get the error code -4 (CL_MEM_OBJECT_ALLOCATION_FAILURE). I have tried everything i could imagine but am stuck there. Any ideas what could create that error?

the kernel is simply:

__kernel void image_write(__write_only image2d_t image, float value) 
    int2 coords = (int2){ get_global_id(0), get_global_id(1) };
    write_imageui(image, coords, (uint4)value);

the whole program can be seen at but only the functions initOpenCL (line 325) and setupOpenCLInteropBuffers (line 400) should be of interest (the error code is returned on line 411), the rest is opengl and working

Btw. it only happens if i run it on the GPU, on the CPU no errors are returned. I am using a 5870.