My kernel function needs to get the OpenGL buffer data to do something…
When I call the “cudaGLRegisterBufferObject”…
It shows “Cuda error in file ‘OK.cu’ in line 383 : invalid resource handle.”
I have checked it for many times…
But…nothing happened… External Image
Does anyone know how to solve it…?
*************** My Program ********************
============= Host =================
//*** Create 2 OpenGL Buffer Object and ***//
GLuint *texname = NULL ;
texname = (GLuint )malloc(2sizeof(GLuint));
glBindTexture(GL_TEXTURE_2D, texname[0]);
glBindTexture(GL_TEXTURE_2D, texname[1]);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB,
UNSIGNED_BYTE, Image_1);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB,
GL_UNSIGNED_BYTE, Image_2);
.
.
.
//*** call function from *.cu ***//
Test_cu_function (texname ) ;
//============ *.cu ==================
void Test_cu_function (GLuint *Tex )
{
CUDA_SAFE_CALL(cudaGLRegisterBufferObject(Tex [0])); //<—ERROR
CUDA_SAFE_CALL(cudaGLRegisterBufferObject(Tex [0]));
.
.
}