So then comes the immediate question as to what vector/linear algebra library to use. The code base I am working with is already using Eigen for linear algebra. So i though i should use Eigen for my OpenGL work as well (since many people are saying they are doing this), and it would be a bit of a head ache to use multiple math libraries that were suppose to be doing many of the same things. Then I hit the alignment issue in Eigen, where all fixed sized types are 16 byte aligned.
The typical way i define a vertex in D3D is with a structure e.g.
struct MyVertex
{
Vec3 position;
Vec3 nornal;
Vec2 texcoord;
};
I know I can do something like this in OGL with interleaved VBOs, or i could split the vertices up in to component arrays. The issue is that if I replace Vec3 with Eigen::Vector3f (or the 2 float variants), Vector3f is 16 byte aligned. In the Eigen documentation, it states that it is recommended when declaring a struct containing Eigen fixed size types (such as Vector3f) that you should use the macro EIGEN_MAKE_ALIGNED_OPERATOR_NEW which redefines new to deal with alignment issues: http://eigen.tuxfami...genMembers.html
Would this not wreak havoc with an array of MyVertex, and specifying component offsets (or even component arrays)? Should I not be using Eigen types in my vertex structures or component arrays? Anyone have any experience with using OGL with Eigen as their math library and has dealt with these issues?
There isnt much documentation on the caveats of using OGL with Eigen (or maybe I'm just looking in the wrong place), the support module provided by Eigen seems to focus more on fixed function calls: http://eigen.tuxfami...rt__Module.html
Any insight would be greatly appreciated.