vbo with complex structures/classes

hey guys

lets say i have an array of float4 when x,y,z respresnts the coord of the point and W stands for its color

is it possible to use the vbo to declare that glVertexPointer would use only the first 3 cords (xyz) and the glColorPointer on the W parm ?

and last question , how do i copy the points from the buffer back to the host array? should i use cudaMemCpy?


As far as I know using VBO in CUDA is passing an array of vertex data not even using either ‘glVertexPointer’ or ‘glColorPointer’. Register it and pass dev pointer to it as kernel argument. What You do with it within kernel is Your business. In my app I use array of float4s that is specially accessed - first float4 is position, second is color, third is texcoord. Such three float4s are single vertex data. Next vertex is addressed by adding some offset, like the stride parameter in mentioned ‘glVertexPointer’, the number of float4s that define a single vertex.

For info about ‘cudaMemcpy’ I would consider reading CUDA references.