you replace clCreateFromGLBuffer() with clCreateFromTexture2D(context, flags, GL_TEXTURE_2D, 0, gl_texture, &err);
only diference is specify texture_target and mipmap level. you just pass GL_TEXTURE_2D and mipmap 0.
also in kernel you treat it as image2d_t