summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/main.c b/main.c
new file mode 100644
index 0000000..3edd036
--- /dev/null
+++ b/main.c
@@ -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;
+}