SimpleGL - 2D texture generation and display


I have questions concerning OpenGL+CUDA. I am trying to modify the SimpleGL example from the CUDA SDK to procedurally generate bitmap images in the kernel and then display them with OpenGL (flat surface is fine).

I think it would flow like this


Host sends CUDA some parameters with a reference to some block (VBO? bitmap array?)

CUDA does number crunching

-->end result is a bitmap array (or VBO?) that could be immediately be uploaded and displayed in OpenGL

OpenGL displays this image on a flat plane.


My confusion is on how to set up the interoperability between CUDA and OpenGL

First, is this scheme possible? Is a VBO the right thing to use? How can you store and get texture coordinates out of a VBO? Is giving CUDA just a bitmap array like data[height][width][0…3] = RGBval a better idea?

Can you register anything between CUDA and OpenGL? Does it have to be a buffer array or VBO? - could it be a bitmap array like the above, which we then make an image from?

And overall, what is the best (easiest) way of doing this?

This is my first real foray into CUDA, and I have not used the VBO method of doing OpenGL… forgive me if this problem is actually very easy. Any and all advice is appreciated, even just general tips about OpenGL and CUDA.