Thanks for taking the time to read this. I'm using a mesh object that contains std::vectors for vertex and index data.
class Mesh2
{
// snipped for brevity
std::vector<unsigned short> indices;
}
void Mesh2::AddFace(unsigned short _i1,unsigned short _i2, unsigned short _i3) {
indices.push_back(_i1);
indices.push_back(_i2);
indices.push_back(_i3);
}
The above functions reside in a static lib that contains all rendering code, linked to the main executable. Below are functions in the .Exe.
// In main()
Mesh2 cube;
GenerateCube(&cube,true,true);
and the function GenerateCube
GenerateCube(Mesh2* mesh, bool bGenNorms, bool bGenTangents)
{
// at some point
mesh->AddFace(0,1,2);
//.. and so on
}
The issue is as soon as mesh.indices has to resize past 10(it's default size) I get a heap corruption. I'm not sure what must be done to rectify this. If anyone has a good link or can spare 5 minutes for a thorough explanation it would be much appreciated. Everything I've pulled up on google so far has to do with crossing DLL boundaries which I'm not doing, but might be happening behind the scenes in the std::vector. I'm heading back to google for now.