AllenYuan

window - game loop - render

Apr 21st, 2020
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.61 KB | None | 0 0
  1. //...
  2.   // set the buffer clear color to red (rgba code)
  3.   glClearColor(1.0, 0.0, 0.0, 1.0);
  4.   // persist the window until user closes it
  5.   while (!glfwWindowShouldClose(window))
  6.   {
  7.     // 'buffer' means an image which can be displayed on the screen
  8.     // OpenGL has a 'front buffer' which is displayed on the screen and a 'back buffer'
  9.     // which is used for drawing.
  10.  
  11.     // every tick, clear the front buffer and swap in the back buffer
  12.     glClear(GL_COLOR_BUFFER_BIT);
  13.     glfwSwapBuffers(window);
  14.     // process pending events (for example, clicking the close button)
  15.     glfwPollEvents();
  16.   }
  17. //...
Advertisement
Add Comment
Please, Sign In to add comment