Using GLFW3, I currently made a bvh file parser which reads the file in and converts it to a human model I made in opengl. However, whenever I launch it, the movement is so fast that the animation cannot be seen in the eye. So I want to tone the animation speed a little down. Here is my render loop
while (!glfwWindowShouldClose(window))
{
// per-frame time logic
// --------------------
float currentFrame = glfwGetTime();
deltaTime = currentFrame - lastFrame;
lastFrame = currentFrame;
// input
// -----
processInput(window);
// render
// ------
glClearColor(0.9f, 0.9f, 0.9f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
(Some Shader Settings)
glm::mat4 model = glm::mat4(1.0f);
if (moveFlag == true) {
bvh.clearVISITED();
bvh.setMotionPerFrame(bvh.root, 0);
}
if (resetMatrices == true) {
bvh.clearVISITED();
bvh.resetMatrices(bvh.root);
}
drawBones(shader, bvh.root, model);
glfwSwapBuffers(window);
glfwPollEvents();
}
The function inside the if statement bvh.setMotionPerFrame(bvh.root, 0)
is where the animation reads in the JOINT configurations per Frame data inside the file, and sets each joint's rotation matrix and translation matrix accordingly. (moveFlag
and resetMatrices
are flags that are set if spacebar and r button are hit respectively)
Since reading the channel data per frame in each render loop unchangeable, I want to come up with a way that I can slower the render loop speed itself. Any suggestions?