Suppose I already have a bitmap (an image) in Device (Video) Memory using cudaMalloc() and cudaMemcpy().
What is the simplest way to display this bitmap directly on screen (current window)?
I am guessing there should be an alternative to GDI’s BitBlt()… but any approach (Direct3D, OpenGL or even GDI) will be fine.
Examples in CUDA SDK (OpenGL version) use Texture, that uses buffer (Pixel Buffer Object) for holding data, that is registered as CUDA-resource, that should be mapped/unmapped at each frame (glutDisplayFunc() call). And all that seems just a tiny little bit complicated and uncalled for.
Okay, will try to answer my own question. Looks like there is a simpler way for displaying a bitmap via OpenGL. Instead of using Texture + Pixel Buffer Object, we could use
cudaGraphicsGLRegisterImage()that supports texture formatGL_RGBA8since CUDA Toolkit 4.0.For simplicity, example has no
cutilSafeCall()or error checks. I have little knowledge of OpenGL and will be glad to hear recommendations.