add window

This commit is contained in:
Luca Conte 2025-03-05 21:33:03 +01:00
parent 4127d978d2
commit f5020cf326
1 changed files with 22 additions and 1 deletions

View File

@ -1,7 +1,28 @@
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <stdio.h> #include <stdio.h>
int main(int argc, char const *argv[]) int main(int argc, char const *argv[])
{ {
printf("Hello World!\n"); 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, "CG1", NULL, NULL);
if (!window) {
printf("Failed to open window\n");
glfwTerminate();
return 1;
}
glfwMakeContextCurrent(window);
while (!glfwWindowShouldClose(window)) {
glfwSwapBuffers(window);
glfwPollEvents();
}
glfwTerminate();
return 0; return 0;
} }