CUDA array to opengl texture?

How to pass CUDA data array to opengl texture?

if cuda has a unsigned char array[1001003] called B.

how can i pass B array to opengl texture? i have no ideas.

Now i using this methos,but seem not like a good method.
1.copy B array to local memory.
(using cudaMemcpy(B_local, B, sizeof(unsigned char)sizexsizey*3, cudaMemcpyDeviceToHost);
2.gluBuild2DMipmaps(GL_TEXTURE_2D, 3, sizex, sizey,GL_RGB, GL_UNSIGNED_BYTE,B_local); works but seem low performance

Look into using a pixel buffer object - I believe the bicubic texture example included in the SDK uses one. A few other examples also use PBOs but I can’t recall offhand which ones they are.