Created
July 3, 2024 21:30
-
-
Save oknauta/86428b5ef825c8ae63c4e889521a1711 to your computer and use it in GitHub Desktop.
Window in C++ GLFW
This file contains 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
// File: `glfw_window.cpp` | |
// Date: `2024-07-03` | |
#include <GLFW/glfw3.h> | |
#include <GL/glut.h> | |
int main() | |
{ | |
// Initializing glfw | |
glfwInit(); | |
// Creating window | |
GLFWwindow *window = glfwCreateWindow(800, 600, "Simple Window", NULL, NULL); | |
// If fails, do something | |
if(!window) | |
{ | |
glfwTerminate(); | |
return EXIT_FAILURE; | |
} | |
// Window loop | |
while(!glfwWindowShouldClose(window)) | |
{ | |
// Treating the events | |
// Like the `quit button` | |
glfwPollEvents(); | |
} | |
// Destroying window | |
glfwDestroyWindow(window); | |
// Terminating glfw | |
glfwTerminate(); | |
return EXIT_SUCCESS; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment