I am not a computer graphic people but I have been working on using CUDA to solve some other scientific computing problem. So I have a bounch of question regarding some CG terminologies:
There are functions in CUDA API to “bind” texture reference to raw linear global memory or CUDA array which is also in global memory. What does this “bind” do?
I suppose OpenGL texture memory is a chunk of memory which can be used for texture maping in graphic card. If I “bind” a texture reference to a CUDA array, does it means graphic card change the location of texture to the address of the CUDA array? So that in the future, whatever you put into the array will be used for texture mapping such as glTexImage2D?
The reason that I am asking this question is that I want to generate some results in CUDA kernel and display them directly on graphic card, without shipping them back to host memory and using OpenGL to display them. I have been stucked here for a couple of days and still coundn’t figure it out.
The demo code in imdenoise sample is rather confusing to me. In that example, a PBO buffer (I suppose it locates on the global memory) is created to store the processing result, and this demo use the following code to display the results:
glTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, imageW, imageH, GL_RGBA, GL_UNSIGNED_BYTE, BUFFER_DATA(0));
And BUFFER_DATA(0) is indeed a NULL pointer! So how could this display the result physically being stored in d_dst which is the global address of the PBO buffer?
I will appreaciate so much if some expert could shed some light on my question!