open window

This commit is contained in:
Christoph J. Scherr 2023-10-13 00:40:57 +02:00
parent 5824ba82f0
commit fccec68a2d

View file

@ -1,6 +1,14 @@
#include <glad/glad.h>
#include <glad/glad.h> // must come before GLFW
#include <GLFW/glfw3.h>
#include <iostream>
#include <stdio.h>
#include <thread>
#include <chrono>
#include <thread>
int main() {
printf("running the main function...\n");
printf("glfw init\n");
@ -8,7 +16,20 @@ int main() {
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
printf("opening window\n");
GLFWwindow *window = glfwCreateWindow(800, 600, "LearnOpenGL", NULL, NULL);
if (window == NULL) {
std::cout << "Failed to create GLFW window" << std::endl;
glfwTerminate();
return -1;
}
glfwMakeContextCurrent(window);
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
printf("closed window\n");
printf("program finished\n");
return 0;
}