OpenGL Performance Problem Mapping to Pbo Decreases Performance


I am developing a CUDA project that uses opengl to render frames.
I have probelm with “cudaGLMapBufferObject, cudaGLUnmapBufferObject” functions.

When I call these functions at every display routine, frames flow on the screen are ok and fps is around 20fps. On the other hand when I call these functions only at beginning, fps becomes 25 fps and I can watch video real-time. But in this case there are some fractures on the screen.

Is there any way to eliminate these fractures without losing fps? How should I call these functions (cudaGLMapBufferObject, cudaGLUnmapBufferObject) in order to give me max. speed performance?

Thanks in advance.