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 40 41 42 43 44 45 46
| #include <stdio.h> #include <GLFW/glfw3.h> #include "imgui.h"
static void glfw_error_callback(int error, const char* description) { fprintf(stderr, "Glfw Error %d: %s\n", error, description); }
int main(int, char**) { glfwSetErrorCallback(glfw_error_callback); if (!glfwInit()) return 1;
GLFWwindow* window = glfwCreateWindow(1280, 720, "GLFW Window", NULL, NULL); if (window == NULL) return 1;
glfwMakeContextCurrent(window); glfwSwapInterval(1);
while (!glfwWindowShouldClose(window)) { glfwPollEvents();
int display_w, display_h; glfwGetFramebufferSize(window, &display_w, &display_h); glViewport(0, 0, display_w, display_h); glClearColor(0.0f, 0.0f, 0.0f, 1.0f); glClear(GL_COLOR_BUFFER_BIT);
glfwMakeContextCurrent(window); glfwSwapBuffers(window); }
glfwDestroyWindow(window); glfwTerminate();
return 0; }
|