Hello,
I am making a game with OpenGL and Assimp and I was trying to do simple animations. Instead of implementing a new model format, I decided to just create a model loader that is able to load in .obj animations (the ones that exports each individual model in each individual frame).
I had used this technique in the past with an OBJ loader that I had personally created and it worked perfectly!
When I use Assimp, on the other hand, I get incredibly slow performance when I do this, making the technique pointless because it slows the game down so much.
Here is the code I am using for the .OBJ file animator:
int i = 250;
std::string filename = "anim/cloth";
int num = 250;
char tmp[200];
while( !glfwWindowShouldClose( window ) )
{
...
...
...
if (i >= 250)
{
i = 0;
}
i += 1.0f;
if (i < 10)
sprintf(tmp, "_00000%d", i);
else if (i < 100)
sprintf(tmp, "_0000%d", i);
else if (i < 1000)
sprintf(tmp, "_000%d", i);
else if (i < 10000)
sprintf(tmp, "_00%d", i);
else if (i < 100000)
sprintf(tmp, "_0%d", i);
else if (i < 1000000)
sprintf(tmp, "_%d", i);
std::string tmp2(filename + tmp);
tmp2 += ".obj";
std::cout << tmp2 << std::endl;
Model modelCloth(tmp2.c_str());
modelCloth.DrawModel(shader);
THIS CODE IS IN MY WHILE LOOP
I am quite sure that code slows down because of this line:
Model modelCloth(tmp2.c_str());
but I cannot figure out any better way to do it because all the constructor does is just load in the model that is called in from the string…
Does anyone have any clues to what this could be? I have tried moving it around random places, and I just cannot figure out how to increase the model object loading speed.