39 lines
780 B
C++
Raw Normal View History

2018-11-27 16:16:23 +08:00
#include<GLFW/glfw3.h>
2018-11-27 15:43:32 +08:00
2018-11-27 16:16:23 +08:00
int main(void)
2018-11-27 15:43:32 +08:00
{
2018-11-27 16:16:23 +08:00
GLFWwindow* window;
/* Initialize the library */
if (!glfwInit())
return -1;
/* Create a windowed mode window and its OpenGL context */
window = glfwCreateWindow(640, 480, "Hello World", 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))
{
/* Render here */
glClear(GL_COLOR_BUFFER_BIT);
/* Swap front and back buffers */
glfwSwapBuffers(window);
/* Poll for and process events */
glfwPollEvents();
}
glfwTerminate();
2018-11-27 15:43:32 +08:00
return 0;
}