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 as a sequential c-style array. (For example, glVertexPointer() is passed a vector.front())) My question is, is this a vector class Hack or is it a standard feature? I have never seen it documented anywhere that that vector::front() returns a pointer to the underlying c-style array (that we can use to sequentially access all array elements). Am I missing something here? Also, the TemplateArray constructor had a simple std::vector<T>(ptr, ptr+count) type of argument that "magically" converted the c-style array to a vector !! I have gone through the documentation of the vector() constructors and it said it accepts an iterator. But I never imagined we can use the array pointer itself as iterator !! 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 :) Wish the documentation (either for vector or for OSG) can cover this. People like me who have seen "NO STL for gaming" slogans are taken aback when we see OSG using STL heavily. Thanks all.
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

