AllenYuan

window - create window - glfw

Apr 21st, 2020
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.59 KB | None | 0 0
  1. // play the game
  2. int main(int argc, char* argv[])
  3. {
  4.   // on error, print errors to console
  5.   glfwSetErrorCallback(error_callback);
  6.  
  7.   // initialize glfw. if it fails, exit the program.
  8.   if(!glfwInit())
  9.   {
  10.     return -1;
  11.   }
  12.  
  13.   // create a 640x480 window titled "Space Invaders"
  14.   GLFWwindow* window = glfwCreateWindow(640, 480, "Space Invaders", NULL, NULL);
  15.   // window doesn't render => close the program
  16.   if(!window)
  17.   {
  18.     glfwTerminate();
  19.     return -1;
  20.   }
  21.   // bind OpenGL calls to this window (allows us to draw on this window)
  22.   glfwMakeContextCurrent(window);
  23.  
  24. //...
Advertisement
Add Comment
Please, Sign In to add comment