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