How to display pixel arrays in global GPU memory on screen directly?

I am doing a path tracer on the GPU, and I got some traceable pixel data results (which are an array of float3) in the global memory of the GPU, which I do to display the array on the screen in order to copy the array to the CPU memory and call OpenGL glTexImage2D :

 glTexImage2D (GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, pixelArray); 

then display the texture. pixelArray is an array of pixel data to display. Since the GPU is the device that controls the entire rendering process, is there a way to display pixelArray on the screen without copying data from the GPU to the CPU?

+4
source share
2 answers

Use the CUDA OpenGL GUI to map OpenGL textures as CUDA global memory. Either write the data directly to the texture, or use cudaMemcpy2D.

+2
source

Here is the function I did once to render an image whose data is stored in the global memory of the GPU. You will need freeglut and glew , along with CUDA to run. Currently it only works on Windows.

I still use this function to render graphic images. Just call ShowRawImage and you ShowRawImage done.

The only overhead that it has is a copy of memory from global memory to the OpenGL device buffer. But this is better because its device is for copying the device.

+1
source

All Articles