-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Example
Snowiiii edited this page Dec 23, 2021
·
1 revision
The library is initialized with glfwInit, which returns GLFW_FALSE if an error occurred.
if (!glfwInit()) {
// Handle initialization failure
return -1;
}glfwGetVersionString();Before your application exits, you should terminate the GLFW library if it has been initialized.
glfwTerminate(); GLFWwindow* window;
window = glfwCreateWindow(640, 480, "Hello World", NULL, NULL);
if (!window)
{
glfwTerminate();
return -1;
}
/* Make the window's context current */
glfwMakeContextCurrent(window); while (!glfwWindowShouldClose(window))
{
/* Render here */
glClear(GL_COLOR_BUFFER_BIT);
/* Swap front and back buffers */
glfwSwapBuffers(window);
/* Poll for and process events */
glfwPollEvents();
}glfwDestroyWindow(window);