Community
cancel
Showing results for 
Search instead for 
Did you mean: 
nippey
Beginner
130 Views

CL-GL-Interop: clEnqueueAcquireGLObjects fails!

Hi,

I am trying to set up a CL-GL project.
Everything works fine up to the point where I want to use the GL-Buffer within CL.

Is this an issue with my code or with sys system specs?

Thank you!



System:
i5-2500 CPU (OpenCL 1.1 (Build 30316.30328))
Integrated Intel HD2000 Graphics (OpenGL 3.1.0 - Build 8.15.10.2696)

What I did:
[cpp]//GL is set-up and is running //CL is set-up with CL_GL_CONTEXT_KHR and CL_WGL_HDC_KHR and is running
//Context: CL_DEVICE_TYPE_CPU

//Loaded Texture with glGenTextures(1, &texture); glBindTexture(GL_TEXTURE_2D, texture); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels); //Texture is successfully rended on Screen! //Created CL-Image with cl::Image2DGL imageIn(context, CL_MEM_READ_ONLY, GL_TEXTURE_2D, 0, texture); //Success!! //Using Texture in CL with glFlush(); glFinish(); VECTOR_CLASS<:MEMORY> mem_objects(1); mem_objects.push_back(imageIn); queue.enqueueAcquireGLObjects(&mem_objects, NULL, &event); //FAILS WITH: -38 CL_INVALID_MEM_OBJECT

//glGetError() returns 0 at any point of this code![/cpp]
0 Kudos
1 Reply
nippey
Beginner
130 Views

It works now:

[cpp]//With these already *successfully* initialised variables cl::CommandQueue queue(context, devices[0], 0, &err); cl::Image2DGL imageIn(context, CL_MEM_READ_ONLY, GL_TEXTURE_2D, 0, texture); //Doing the following works now VECTOR_CLASS<:MEMORY>* mem_objects = new VECTOR_CLASS<:MEMORY>(); mem_objects->push_back(imageIn); queue.enqueueAcquireGLObjects(mem_objects);[/cpp] Maybe it might help someone else ;)