in my CAD-like application I store vector coordinates in arrays of following structures:
struct coord
{
double x,y,z;
unsigned char flags;
};
x, y and z hold the 3D coordinates, flags contains additional information (e.g. if a polygon ends here and line to next coordinate in this array has not to be drawn).
Now these data have to be converted to a plain float-array with one float value for x, y and z each and with as many of these triples as there are points in the polygon to be drawn. Reason is: the converted array of coordinates has to be handed over to OpenGL function glVertexAttribPointer() to let OpenGL draw this polygon.
My question: what is the fastest way of converting these data? My only idea is to allocate the target array and to go through it in a loop to cast the coordinate values down to float - which sounds quite slow for me.
Any other ideas?
Thanks! *)
*) I know stackoverflow does not like to be friendly but in fact I like it to be friendly that's why I want to thank all people that try to give an answer here! there are enough unfriendly places on this earth, stackoverflow should not be an other one!