Created
May 2, 2022 18:43
-
-
Save lccalluchi/25d678093d991777537ee86700f76e3f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include<iostream> | |
| #include<glad/glad.h> | |
| #include<GLFW/glfw3.h> | |
| int main() | |
| { | |
| // Inicializar GLFW | |
| glfwInit(); | |
| // Configuramos declarando la versión de OpenGL | |
| glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); | |
| glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); | |
| // Declarando funciones adicionales para el core de nuestro proyecto | |
| glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); | |
| // Cree una ventana GLFWwindow de 800 por 800 píxeles, nombrándolo "Laboratorio 2 - C.G" | |
| GLFWwindow* window = glfwCreateWindow(800, 800, "Laboratorio 2 - C.G", NULL, NULL); | |
| // Capturamos el error | |
| if (window == NULL) | |
| { | |
| std::cout << "Failed to create GLFW window" << std::endl; | |
| glfwTerminate(); | |
| return -1; | |
| } | |
| // Agregar una nueva ventana dentro del contexto | |
| glfwMakeContextCurrent(window); | |
| // Cargando GLAD para configurar OPENGL | |
| gladLoadGL(); | |
| // Fijando los valores de la ventana | |
| glViewport(0, 0, 800, 800); | |
| // Color de fondo | |
| glClearColor(0.07f, 0.13f, 0.17f, 1.0f); | |
| glClear(GL_COLOR_BUFFER_BIT); | |
| glfwSwapBuffers(window); | |
| // Ejecucion del programa mientras el programa no cierre | |
| while (!glfwWindowShouldClose(window)) | |
| { | |
| glfwPollEvents(); | |
| } | |
| // Eliminar ventana | |
| glfwDestroyWindow(window); | |
| // Terminar el prorgama | |
| glfwTerminate(); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment