OpenCL* for CPU
Ask questions and share information on Intel® SDK for OpenCL™ Applications and OpenCL™ implementations for Intel® CPU.
Announcements
This forum covers OpenCL* for CPU only. OpenCL* for GPU questions can be asked in the GPU Compute Software forum. Intel® FPGA SDK for OpenCL™ questions can be ask in the FPGA Intel® High Level Design forum.
1719 Discussions

CL-GL-Interop: clEnqueueAcquireGLObjects fails!

nippey
Beginner
598 Views
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
598 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 ;)
0 Kudos
Reply