diff options
| author | auric <104602845+ihateamongus@users.noreply.github.com> | 2025-09-06 21:42:16 -0500 |
|---|---|---|
| committer | auric <104602845+ihateamongus@users.noreply.github.com> | 2025-09-06 21:42:16 -0500 |
| commit | 54429ac1abe5c4a7b6ada64e71f9a6e5cee79b59 (patch) | |
| tree | 12e0f7f5525febfba5fb27f728da611987137f95 /main.c | |
| parent | 223ac3c36c4d5059d49dc453695e65d6dab1a746 (diff) | |
Add GLFW OpenGL window example
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 31 |
1 files changed, 31 insertions, 0 deletions
@@ -0,0 +1,31 @@ +#include <stdio.h> +#include <GLFW/glfw3.h> + +int main(void) +{ + if (!glfwInit()) { + fprintf(stderr, "Failed to initialize GLFW\n"); + return 1; + } + + GLFWwindow *window = glfwCreateWindow(640, 480, "Hello OpenGL", NULL, NULL); + if (!window) { + fprintf(stderr, "Failed to create window\n"); + glfwTerminate(); + return 1; + } + + glfwMakeContextCurrent(window); + + while (!glfwWindowShouldClose(window)) { + glClear(GL_COLOR_BUFFER_BIT); + + glfwSwapBuffers(window); + + glfwPollEvents(); + } + + glfwDestroyWindow(window); + glfwTerminate(); + return 0; +} |
