Half float RGBA texture

Hi everyone,

I have a half-float RGBA image that I want to pass from openGL to CUDA as a texture. I have created a frame buffer and attached this image as a color texture to the FBO. This is how I’m allocating memory for the texture:

glTexImage2D(GL_TEXTURE_2D , 0, GL_RGBA32F, m_iWidth, m_iHeight, 0, GL_RGBA, GL_HALF_FLOAT, _image);

I am confused how I should declare the CUDA texture to use this texture with it? currently I’m using this code but it’s not working :

texture<char4, cudaTextureType2D, cudaReadModeElementType> texRef;

I have to have access to each element of the texture in my cuda kernel, but now everything is zero and it’s not working. Do you have any suggestion or solution for this problem? Thanks.