Registered Member
|
Hello ,
I am trying to integrate Eigen into an OpenGL application but I am having problem with creating VAO using Eigen Vector3f inside a structure. If I define something like this:
Then if I pass it to glVertexAttribPointer , I am not sure what the size of the stride should be ? What is the suggested workflow in this case ? Thanks in advance, Alex |
Moderator
|
The stride should be 'sizeof(Vertex)'. For the pointer offsets, the safest is to let the compiler computes it for you, e.g.:
Vertex *vertices = ...; then the offset for the texture coordinates is: (void*)(vertices[0].texcoord.data() - vertices[0].position.data()) |
Registered users: Bing [Bot], claydoh, Google [Bot], rblackwell, Yahoo [Bot]