-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathglfw_test.cpp
More file actions
39 lines (33 loc) · 1.01 KB
/
glfw_test.cpp
File metadata and controls
39 lines (33 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include "pypp_util/main_error_handler.h"
#include <GLFW/glfw3.h>
#include <cstdlib> // Required for EXIT_FAILURE
#include <string>
int main() {
try {
/* Initialize the library */
if (!glfwInit())
return -1;
/* Create a windowed mode window and its OpenGL context */
std::string title = "Hello World";
GLFWwindow *window =
glfwCreateWindow(640, 480, title.c_str(), NULL, NULL);
if (!window) {
glfwTerminate();
return -1;
}
/* Make the window's context current */
glfwMakeContextCurrent(window);
/* Loop until the user closes the window */
while (!glfwWindowShouldClose(window)) {
/* Swap front and back buffers */
glfwSwapBuffers(window);
/* Poll for and process events */
glfwPollEvents();
}
glfwTerminate();
return 0;
} catch (...) {
pypp::handle_fatal_exception();
return EXIT_FAILURE;
}
}