PDA

View Full Version : Cuda/OpenGL FBO/PBO and write to screen



__bob__
06-29-2016, 08:05 AM
Hi all,

I have an openGL app that generate in a FBO ( as GL_RGBA32F,GL_TEXTURE_2D_ARRAY) position and normal for defered use.

I need to make this FBO readable from cuda to do some shade computation:


glm::vec4 *myFBO;
cudaGraphicsGLRegisterBuffer( &FBO, adrFBO, cudaGraphicsMapFlagsReadOnly);
cudaGraphicsResourceGetMappedPointer((void**)&myFBO, &FBOSize, FBO);

///run kernel
cudaGraphicsUnmapResources(1, &FBO, 0);



Is this the good way to read in my FBO from Cuda?

How can i write the result of my kernel dirctly to screen?