Advertisement
Guest User

Untitled

a guest
Nov 21st, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <GLEW\GL\glew.h>
  4. #include <GLFW\glfw3.h>
  5.  
  6. int main(void)
  7. {
  8. if (!glfwInit())
  9. {
  10. fprintf(stderr, "GLFW error");
  11. return -1;
  12. }
  13.  
  14. glfwWindowHint(GLFW_SAMPLES, 4);
  15. glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
  16. glfwWindowHint(GLFW_VERSION_MINOR, 0);
  17. glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
  18.  
  19. GLFWwindow* window;
  20. window = glfwCreateWindow(
  21. 512,
  22. 512,
  23. "Hello World",
  24. NULL, NULL);
  25. if (window == NULL)
  26. {
  27. fprintf(stderr, "Window failed.");
  28. glfwTerminate();
  29. return -1;
  30. }
  31. glfwMakeContextCurrent(window);
  32.  
  33. glfwSetInputMode(window, GLFW_STICKY_KEYS, GL_TRUE);
  34.  
  35. do
  36. {
  37. glfwSwapBuffers(window);
  38. glfwPollEvents();
  39. } while (glfwGetKey(window, GLFW_KEY_ESCAPE) != GLFW_PRESS &&
  40. glfwWindowShouldClose(window) == 0);
  41.  
  42. glfwTerminate();
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement