diff options
| author | realtradam <[email protected]> | 2022-11-19 22:08:52 -0500 |
|---|---|---|
| committer | realtradam <[email protected]> | 2022-11-19 22:08:52 -0500 |
| commit | 13432ece9e2a8c6d20158fd6886c6060c8a7bdc9 (patch) | |
| tree | fa8e821375708c281363916e9b352fdf4f208d94 /src/main.cpp | |
| download | Ogle-13432ece9e2a8c6d20158fd6886c6060c8a7bdc9.tar.gz Ogle-13432ece9e2a8c6d20158fd6886c6060c8a7bdc9.zip | |
init
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..05e27da --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,45 @@ +#include <glad/glad.h> +#include <GLFW/glfw3.h> + +#include <iostream> + +void framebuffer_size_callback(GLFWwindow* window, int width, int height) +{ + glViewport(0, 0, width, height); +} + +int main() { + glfwInit(); + glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); // 4.6 is highest + glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); + glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); + + GLFWwindow* window = glfwCreateWindow(800, 600, "Yep", NULL, NULL); + if (window == NULL) + { + std::cout << "Failed to create GLFW window" << std::endl; + glfwTerminate(); + return -1; + } + glfwMakeContextCurrent(window); + + if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress)) + { + std::cout << "Failed to init GLAD" << std::endl; + return -1; + } + + glViewport(0, 0, 800, 600); + + glfwSetFramebufferSizeCallback(window, framebuffer_size_callback); + + while(!glfwWindowShouldClose(window)) + { + glfwSwapBuffers(window); + glfwPollEvents(); + } + + glfwTerminate(); + return 0; +} + |
