PDA

View Full Version : clCreateFromGLTexture2D returns CL_INVALID_GL_OBJECT (-60)



kaesemeister
06-13-2012, 08:19 PM
Hi, I can't get "clCreateFromGLTexture2D" to work.. here is the relevant code:



glGenTextures(1, &t);
glBindTexture(GL_TEXTURE_2D, t);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1024, 768, 0, GL_RGBA, GL_FLOAT, 0);
glBindTexture(GL_TEXTURE_2D, 0);
glFlush();
cl_int err = 0;
cl_mem img = clCreateFromGLTexture2D(clContext(), CL_MEM_READ_WRITE, GL_TEXTURE_2D, 0, t, &err);
std::cout << err << std::endl;


this always outputs -60 which is the constant CL_INVALID_GL_OBJECT. But Why?
- t contains a valid texture id (i've checked this)
- t has a valid internal format. I tried many, including GL_RGBA16F, etc..
- t is complete according to GL specification -- as a test: using this texture in framebuffer works (I've tried to set other texture parameters to be sure)


- Is this maybe a driver problem?
- Is there other relevant code I've maybe done wrong? (as device I used my only GPU)

thanks for your help :)