Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <GLFW/glfw3.h>
- #include <stdio.h>
- #define STR(x) #x
- #define SHOW_DEFINE(x) printf("%s=%s\n", #x, STR(x))
- int main(void)
- {
- GLFWwindow* window;
- /* Initialize the library */
- if (!glfwInit())
- return -1;
- SHOW_DEFINE(GLFW_VERSION_MAJOR);
- SHOW_DEFINE(GLFW_VERSION_MINOR);
- SHOW_DEFINE(GLFW_VERSION_REVISION);
- glfwWindowHint(GLFW_VISIBLE, 0);
- glfwWindowHint(GLFW_RESIZABLE, 1);
- printf("Creating window:\n");
- /* Create a windowed mode window and its OpenGL context */
- window = glfwCreateWindow(300, 300, "Hello World", NULL, NULL);
- if (!window)
- {
- glfwTerminate();
- printf("Failed to create window\n");
- return -1;
- }
- printf("Window created\n");
- glfwShowWindow(window);
- /* Make the window's context current */
- glfwMakeContextCurrent(window);
- printf("Made context current\n");
- /* Loop until the user closes the window */
- while (!glfwWindowShouldClose(window))
- {
- /* Render here */
- /* Swap front and back buffers */
- glfwSwapBuffers(window);
- /* Poll for and process events */
- glfwPollEvents();
- }
- printf("exit...\n");
- glfwTerminate();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement