diff --git a/src/main.cpp b/src/main.cpp index bc237c7..3f26e48 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,6 +1,40 @@ -#include +#include #include +#include -int main(void){ +#define UNUSED(x) (void)(x) + +void framebuffer_size_callback(GLFWwindow* window, int width, int height); + +int main(void) { + int tmp = 0; + + glfwInit(); + glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); + glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); + glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); + + GLFWwindow *window = glfwCreateWindow(800, 600, "LearnOpenGL", NULL, NULL); + assert(window != NULL && "Window Failed"); + glfwMakeContextCurrent(window); + + tmp = gladLoadGLLoader((GLADloadproc)glfwGetProcAddress); + assert(tmp && "Failed to init glad"); + + glViewport(0, 0, 800, 600); + glfwSetFramebufferSizeCallback(window, framebuffer_size_callback); + + while(!glfwWindowShouldClose(window)) + { + glfwSwapBuffers(window); + glfwPollEvents(); + } + + glfwTerminate(); return 0; } + +void framebuffer_size_callback(GLFWwindow* window, int width, int height) { + UNUSED(window); + glViewport(0, 0, width, height); +}