Re: [osg-users] Vector class Hacks?

2008-02-28 Thread Robert Osfield
On Wed, Feb 27, 2008 at 10:06 PM, Night Hawk [EMAIL PROTECTED] wrote: Surprising indeed. I was about to override the Array classes to use native c-style arrays. But now it seems OSG can convert vectors to C-style arrays fast enough :) The OSG wouldn't do it if it wasn't efficient, its

Re: [osg-users] Vector class Hacks?

2008-02-28 Thread Jeremy Moles
On Thu, 2008-02-28 at 09:11 +, Robert Osfield wrote: On Wed, Feb 27, 2008 at 10:06 PM, Night Hawk [EMAIL PROTECTED] wrote: Surprising indeed. I was about to override the Array classes to use native c-style arrays. But now it seems OSG can convert vectors to C-style arrays fast enough

[osg-users] Vector class Hacks?

2008-02-27 Thread Night Hawk
Hello all, I was going through the source-code of Array class in the OSG and was wondering the data-conversion efficiency between STL::Vector (used by OSG Arrays) and the underlying OpenGL C-Style Arrays. However, I came across this usage where vector.front() is used to treat the vector members

Re: [osg-users] Vector class Hacks?

2008-02-27 Thread Mike Weiblen
std::vector is guaranteed to have contiguous memory. So vector.front() or (vector[0]) are legal references to the first element of a c-style array. That is why it is important to preallocate vectors to the expected length when possible, to avoid the reallocation hit necessary to preserve

Re: [osg-users] Vector class Hacks?

2008-02-27 Thread Jason Daly
Mike Weiblen wrote: std::vector is guaranteed to have contiguous memory. So vector.front() or (vector[0]) are legal references to the first element of a c-style array. That is why it is important to preallocate vectors to the expected length when possible, to avoid the reallocation hit