I setup the texture like this:
glGenTextures(1, &m_iTexture);
glBindTexture(GL_TEXTURE_2D, m_iTexture);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, nImageWidth, nImageHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, whiteimg);
cudaGraphicsGLRegisterImage(&resource, m_iTexture, GL_TEXTURE_2D, cudaGraphicsRegisterFlagsNone);
texture parameters omitted
and attempt to copy to it like this every frame:
cudaGraphicsMapResources(1, &resource);
cudaArray* texarray;
cudaGraphicsSubResourceGetMappedArray(&texarray, resource, 0, 0);
auto width = 0;
auto height = 0;
GrabFrame(&width, &height);
CopyFrame(texarray);
cudaGraphicsUnmapResources(1, &resource);
where CopyFrame is this:
cudaMemcpy2DToArray(texarray, 0, 0, reinterpret_cast<void*>(pDevGrabBuffer), frameGrabInfo.dwWidth*4, frameGrabInfo.dwWidth*4, frameGrabInfo.dwHeight, cudaMemcpyDeviceToDevice);
but the original white image remains.