MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/SPlisHSPlasH / mainLoop

Method mainLoop

GUI/OpenGL/MiniGL.cpp:1082–1120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1080}
1081
1082void MiniGL::mainLoop()
1083{
1084 while (!glfwWindowShouldClose(m_glfw_window))
1085 {
1086 if (idlefunc != nullptr)
1087 idlefunc();
1088
1089 double currentTime = glfwGetTime();
1090 if (currentTime - m_lastTime >= 1.0 / 60.0) // render at maximum at 60 fps
1091 {
1092 glfwPollEvents();
1093
1094 glPolygonMode(GL_FRONT_AND_BACK, drawMode);
1095 viewport();
1096
1097 if (scenefunc != nullptr)
1098 scenefunc();
1099
1100 if (selectionMode)
1101 drawSelectionRect();
1102
1103 if (m_vsync)
1104 glfwSwapBuffers(m_glfw_window);
1105 else
1106 glFlush();
1107
1108 m_lastTime = currentTime;
1109 }
1110 }
1111
1112 if (destroyfunc != nullptr)
1113 destroyfunc();
1114
1115 destroy();
1116
1117 glfwDestroyWindow(m_glfw_window);
1118
1119 glfwTerminate();
1120}
1121
1122void MiniGL::leaveMainLoop()
1123{

Callers

nothing calls this directly

Calls 7

glfwWindowShouldCloseFunction · 0.85
glfwGetTimeFunction · 0.85
glfwPollEventsFunction · 0.85
glfwSwapBuffersFunction · 0.85
destroyFunction · 0.85
glfwDestroyWindowFunction · 0.85
glfwTerminateFunction · 0.85

Tested by

no test coverage detected