I have written a relatively simple interactive C program using OpenGL 4.4 with a vertex shader and a fragment shader, running in the CodeBlocks IDE on Windows. I included an FPS counter basically as in Anton Gerdelan's tutorial here:
However, instead of GLFW I just use the Windows API myself. When the graphics window is in focus, the reported fps stays around 60. I noticed recently when the program was still running, but was not the active window, that the fan started running very loudly and the laptop became very warm. Using ALT-TAB a preview of the various windows I had open appeared above the taskbar (I think), as is normal in that version of windows. In the little scaled-down preview of the graphics window, visible before choosing that as the active window, I could see that the fps was reported as 8000 fps or something like that. As soon as I selected that as the active window, the fps dropped down to 60 and the fan began to calm down.
Now I am worried - by tabbing away, have I accidentally defeated the mechanism that allows the operating system to tell my C program to wait until it is ready to swap the buffers, and if so, do I thereby risk allowing my program to run the GPU so hot that I will damage it ?
Do laptop GPUs these days have built-in throttling that will slow them down when they get hot enough to risk damage ? If so, then by programming in C using OpenGL, have I accidentally defeated this mechanism ?
Ought I to add a Sleep command to my animation loop, to avoid this ? Would that work ?