<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6000.16674" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=061404912-08072008><FONT face=Arial
color=#0000ff size=2>As long as the compiler follows the C++ spec , stl vectors
should be contiguous memory</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=061404912-08072008><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=061404912-08072008><FONT face=Arial
color=#0000ff size=2>But note vec4 could be either a vec4f or vec4d so will only
be 16 bytes if it expands to vec4f</FONT></SPAN></DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> osg-users-bounces@lists.openscenegraph.org
[mailto:osg-users-bounces@lists.openscenegraph.org] <B>On Behalf Of </B>David
Spilling<BR><B>Sent:</B> Tuesday, July 08, 2008 5:57 AM<BR><B>To:</B>
OpenSceneGraph Users<BR><B>Subject:</B> [osg-users] How to byte-align
Vec4Array<BR></FONT><BR></DIV>
<DIV></DIV>Dear All,<BR><BR>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.<BR><BR>(I'm using MS VC++ 9, so would natively use
__declspec(align(16)) but am not sure how to "get at" the vector).<BR><BR>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)?<BR><BR>I guess if neither of these works,
then I'm down to subclassing
Vec4Array...<BR><BR>Thanks,<BR><BR>David<BR></BODY></HTML>