Advertisement
Guest User

Untitled

a guest
Feb 9th, 2016
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. #include <GL/glew.h>
  2. #include <GLFW/glfw3.h>
  3. #include <iostream>
  4.  
  5. int main(void) {
  6.  
  7.  
  8. // initialise the windows
  9. GLFWwindow *window;
  10.  
  11. if (!glfwInit()) {
  12.  
  13. return -1;
  14. }
  15.  
  16. // create a windows
  17.  
  18. window = glfwCreateWindow(640, 480, "Test", NULL, NULL);
  19. if (!window) {
  20. fprintf(stderr, "Failed to initialize GLFWn");
  21. glfwTerminate();
  22. return -1;
  23. }
  24.  
  25.  
  26. // make the window's current context
  27. glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
  28. // loop until the window close
  29.  
  30. while (!glfwWindowShouldClose(window)) {
  31. glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  32.  
  33. // swap back and front buffers
  34.  
  35. glfwSwapBuffers(window);
  36.  
  37.  
  38. // poll the events
  39.  
  40. glfwPollEvents();
  41. }
  42.  
  43. std::cout << "finished ";
  44. glfwTerminate();
  45.  
  46. return 0;
  47.  
  48. while (!glfwWindowShouldClose(window)) {
  49. glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  50. glClearColor(1, 1, 0, 0);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement