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.

clCreateFromGLTexture2D

lollo-isweb_de
Beginner
808 Views
Hey guys... I have a problem with clCreateFromGLTexture2D.
The problem ist that I need to call the function twice to get a valid memory objects. Is this a bug... or did I missed to initialize something?!!?? Ive used the code with the NVidia SDK and there it works fine... currently just the CPU makes problems?!?! Any suggestions?!?!

SampleCode:

GLuint gl_texture_id;
GLenum target = GL_TEXTURE_2D;
cl_int l_Error;

// Create a texture in OpenGL and allocate space
glGenTextures(1, &gl_texture_id);
glBindTexture(target, gl_texture_id);
glTexImage2D(target, 0, GL_RGBA8, in_DisplacementTextureWidth, in_DisplacementTextureHeight, 0,
GL_RGBA, GL_FLOAT, NULL);

// Create first ref
cl_mem cl_image = clCreateFromGLTexture2D(m_ClContext.m_Context, CL_MEM_READ_WRITE,
GL_TEXTURE_2D, 0, gl_texture_id, &l_Error);
if (!cl_image || l_Error != CL_SUCCESS)
return false; // not valid


cl_image = clCreateFromGLTexture2D(m_ClContext.m_Context, CL_MEM_READ_WRITE,
GL_TEXTURE_2D, 0, gl_texture_id, &l_Error);
if (!cl_image || l_Error != CL_SUCCESS)
return false; // valid

0 Kudos
5 Replies
Evgeny_F_Intel
Employee
808 Views
Hey,

Your code looks fine.

Could you provide small reproducer application? This will help us to understand the problem.

Thanks,
Evgeny
0 Kudos
lollo-isweb_de
Beginner
808 Views
After building a sample application I figured out what was wrong... stupid thing! I just was still including and linking the NVdia libs and includes instead the one of Intel OpenCl SDK. Change it and not it works smoothly.
0 Kudos
lollo-isweb_de
Beginner
808 Views
After testing a little bit I found a version that doesnt work with the IntelSDK - I created a sample and uploaded it. I would appreciate it if your team could take a look at it?!?! As far as I can say the context is valid... but the error message say something different.
Thanks in advance

http://www.file-upload.net/download-3585270/Tes3.rar.html

0 Kudos
lollo-isweb_de
Beginner
808 Views
Can someone even confirm that there is something wrong... maybe it depends only on my configuration or system!?!
0 Kudos
Evgeny_F_Intel
Employee
808 Views
Hi,

It looks like code is right.
Today we accpect CL_WGL_HDC_KHR to be defined.

We must also enable the default value 0.

Meanwhile please provide this property.

Thanks,
Evgeny
0 Kudos
Reply