Skip to content
Snippets Groups Projects
Commit a1bac3b7 authored by Patrick Teufel's avatar Patrick Teufel
Browse files

added performance measure

parent 95395d63
No related branches found
No related tags found
No related merge requests found
...@@ -45,8 +45,10 @@ void mainLoop() { ...@@ -45,8 +45,10 @@ void mainLoop() {
const int samples = 50; const int samples = 50;
float time[samples]; float time[samples];
int index = 0; int index = 0;
UINT i = 0;
double startTime = glfwGetTime();
while (!glfwWindowShouldClose(window) && !glfwGetKey(window, GLFW_KEY_ESCAPE)) { while (!glfwWindowShouldClose(window) && !glfwGetKey(window, GLFW_KEY_ESCAPE) && i < 10000) {
GLUtils::checkForOpenGLError(__FILE__, __LINE__); GLUtils::checkForOpenGLError(__FILE__, __LINE__);
scene->update(float(glfwGetTime())); scene->update(float(glfwGetTime()));
scene->render(); scene->render();
...@@ -69,6 +71,15 @@ void mainLoop() { ...@@ -69,6 +71,15 @@ void mainLoop() {
strm << " (fps: " << fps << ")"; strm << " (fps: " << fps << ")";
glfwSetWindowTitle(window, strm.str().c_str()); glfwSetWindowTitle(window, strm.str().c_str());
} }
i++;
}
stringstream strm;
strm << title;
strm.precision(4);
strm << " (duration: " << glfwGetTime() - startTime << ")";
glfwSetWindowTitle(window, strm.str().c_str());
while (!glfwWindowShouldClose(window) && !glfwGetKey(window, GLFW_KEY_ESCAPE)) {
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment