clCreateFromGLTexture2D

clCreateFromGLTexture2D

lollo-isweb.de's picture

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

6 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.
Evgeny Fiksman (Intel)'s picture

Hey,

Your code looks fine.

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

Thanks,
Evgeny

lollo-isweb.de's picture

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.

lollo-isweb.de's picture

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

lollo-isweb.de's picture

Can someone even confirm that there is something wrong... maybe it depends only on my configuration or system!?!

Evgeny Fiksman (Intel)'s picture

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

Login to leave a comment.