[osg-users] How to byte-align Vec4Array

Mathias Fröhlich M.Froehlich at science-computing.de
Tue Jul 8 06:40:11 PDT 2008


On Tuesday 08 July 2008 11:57, David Spilling wrote:
> Is there an obvious way of aligning the contents of the Vec4Array to 16
> byte boundaries? Can I also guarantee that each std::vector entry will be
> contiguous in memory? i.e. I would like to make sure that array[0].x(),
> array[1].x() etc. are all on consecutive 16 byte boundaries.
> (I'm using MS VC++ 9, so would natively use __declspec(align(16)) but am
> not sure how to "get at" the vector).
> If not, can I declare a big array of floats, that is aligned as per
> requirements, and pass it into a geometry as a vertex array direclty,
> bypassing use of Vec4Array (and Vec4 for that matter)?
> I guess if neither of these works, then I'm down to subclassing
> Vec4Array...

and make sure that the pointer you provide to MyArray is aligned as you 
like ...


Dr. Mathias Fröhlich, science + computing ag, Software Solutions
Hagellocher Weg 71-75, D-72070 Tuebingen, Germany
Phone: +49 7071 9457-268, Fax: +49 7071 9457-511
Vorstand/Board of Management:
Dr. Bernd Finkbeiner, Dr. Florian Geyer,
Dr. Roland Niemeier, Dr. Arno Steitz, Dr. Ingrid Zech
Vorsitzender des Aufsichtsrats/
Chairman of the Supervisory Board:
Prof. Dr. Hanns Ruder
Sitz/Registered Office: Tuebingen
Registergericht/Registration Court: Stuttgart
Registernummer/Commercial Register No.: HRB 382196 

More information about the osg-users mailing list