Using vertex buffer object with cuda

Hi
I’m new to CUDA and GPU programming in general.

I read the programmer’s guide and I think I’ve gotten the hang of things
I ran the simpleGL example that comes with the SDK and would like to know how to change the program so that the output would not only be points but quads

ie i want to change the vertex buffer object to store and display quads and show the wave motion as well

any help would be appreciated.
thanks for your time.

The easiest way would be to just allocate the vertex buffer with 4 times as many vertices, and call glDrawArrays with GL_QUADS instead of GL_POINTS.

With the existing kernel, each thread would be responsible for computing one vertex of a quad, or you could modify it to have each thread process one quad and write 4 vertices.

Alternatively, if you don’t mind the quad mesh being always connected, you could just create an index buffer so that each position of quad vertex comes from looking up in the original grid of vertices. This avoids duplicating work at the shared vertices.

You’d probably want to calculate surface normals as well.

hi
thanks for the quick reply

could you please elaborate on the second method?

I would recommend reading up on OpenGL rendering, e.g.:
http://www.opengl.org/documentation/specs/…awelements.html