cudaBindTexture

I have fully functional OpenGL texture which is a result of the following statements:

[codebox]

GLuint img;

glGenTextures(1, &img);

glBindTexture(GL_TEXTURE_2D, img);

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, TEXTURE_WIDTH, TEXTURE_HEIGHT, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);

glBindTexture(GL_TEXTURE_2D, 0);

// in the following statements i do the rendering to texture

[/codebox]

I want to get pixels from ‘img’. For doing that i think the most natural way would be binding my texture inside cuda context but as far as i understand I’m not allowed to do that directly. I should be using various routines involving PBO and do some memcpy’s for obtaining the data i need. I’m really disappointed because getting data from Cuda => OpenGL is pretty straightforward and doesn’t require any memcpy’s but doing from OpenGL => Cuda is really painful. :thumbsdown: :thumbsdown: :thumbsdown: