Dynamic OpenGl Texture

Hi !

I try to integrate OpenCl inside my platform. It’s works well but I have some problem with
dynamic OpenGl texture.

I want to pass in my kernel an image_2d corresponding to an Opengl animated texture.

I create my image_2d with clCreateFromGLTexture2D. It works well when my opengl texture doesn’t change but when my texture changes my image_2d doesn’t change and stay at the same value.

Have you got an idea ? I’m on Win7 64 bit with a GTX480.

I’m not quite sure but It might be the object synchronisation between CL and GL application. Probably you need to read that part in the OpenCL specification.

Hi !

I read the specifications and I try severals things. But it still doesn’t work. Maybe if we want dynamic texture. We can’t link with an opencl image but with an opencl buffer ?


How do you change your opengl texture?

I change my opengl texture by using a PBO. But I prefere use a cl image than clbuffer. To have access to image_sampler.

Do you works with a loop in that way :

  • OpenCL acquire shared objects
  • OpenCL works
  • OpenCL release shared objects
  • Wait OpenCL finish all commands
  • OpenGL works
  • Wait OpenGL finish all commands

BTW why don’t use render to texture with frame buffer object? I hope this is’nt the problem cause, but it’s easier to work with.

I do exactly what you say ! I didn’t use framebuffer because I work on animated volume rendering and I have an animated 3d texture format like a movie texture.

I didn’t understand why it doesn’t work because the cl_mem buffer is map on the opengl texture ID so if the texture change, the clImage must change too.