background_window.cpp 784 B

12345678910111213141516171819202122232425
  1. #include "background_window.h"
  2. #include <iostream>
  3. IGL_INLINE bool igl::opengl::glfw::background_window(GLFWwindow* & window)
  4. {
  5. if(!glfwInit()) return false;
  6. glfwSetErrorCallback([](int id,const char* m){std::cerr<<m<<std::endl;});
  7. glfwWindowHint(GLFW_SAMPLES, 4);
  8. // Use 3.2 core profile
  9. glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
  10. glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
  11. glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
  12. glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
  13. // Use background window
  14. glfwWindowHint(GLFW_VISIBLE, GL_FALSE);
  15. window = glfwCreateWindow(1, 1,"", NULL, NULL);
  16. if(!window) return false;
  17. glfwMakeContextCurrent(window);
  18. return true;
  19. }
  20. #ifdef IGL_STATIC_LIBRARY
  21. // Explicit template instantiation
  22. #endif