I have this code. (I have a folder called include that had glad.h in)
#include <iostream>
#include "include/glad.h"
#include <GLFW/glfw3.h>
int main() {
glfwInit();
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_REFRESH_RATE, 60);
GLFWwindow* window = glfwCreateWindow(800, 800, "Project", NULL, NULL);
if (window == NULL) {
std::cout << "Failed to create the GLFW window!" << std::endl;
glfwTerminate();
return -1;
}
glfwMakeContextCurrent(window);
glfwSwapInterval(0);
while(!glfwWindowShouldClose(window)) {
glfwPollEvents();
}
glfwDestroyWindow(window);
glfwTerminate();
return 0;
}
If I run it, it causes my CPU to run at 100%
I have tried glfwSwapInterval
and glfwWindowHint(GLFW_REFRESH_RATE, 60);
as shown in code but neither of them helped, my CPU still runs at 100%.