| 851 | }; |
| 852 | |
| 853 | OpenGLDepthPacketProcessor::OpenGLDepthPacketProcessor(void *parent_opengl_context_ptr, bool debug) |
| 854 | { |
| 855 | GLFWwindow* parent_window = (GLFWwindow *)parent_opengl_context_ptr; |
| 856 | |
| 857 | GLFWerrorfun prev_func = glfwSetErrorCallback(&OpenGLDepthPacketProcessorImpl::glfwErrorCallback); |
| 858 | if (prev_func) |
| 859 | glfwSetErrorCallback(prev_func); |
| 860 | |
| 861 | // init glfw - if already initialized nothing happens |
| 862 | if (glfwInit() == GL_FALSE) |
| 863 | { |
| 864 | LOG_ERROR << "Failed to initialize GLFW."; |
| 865 | exit(-1); |
| 866 | } |
| 867 | |
| 868 | // setup context |
| 869 | glfwDefaultWindowHints(); |
| 870 | glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); |
| 871 | #ifdef __APPLE__ |
| 872 | glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2); |
| 873 | glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); |
| 874 | glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); |
| 875 | #else |
| 876 | glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1); |
| 877 | glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_ANY_PROFILE); |
| 878 | #endif |
| 879 | glfwWindowHint(GLFW_VISIBLE, debug ? GL_TRUE : GL_FALSE); |
| 880 | |
| 881 | GLFWwindow* window = glfwCreateWindow(1024, 848, "OpenGLDepthPacketProcessor", 0, parent_window); |
| 882 | |
| 883 | if (window == NULL) |
| 884 | { |
| 885 | LOG_ERROR << "Failed to create opengl window."; |
| 886 | exit(-1); |
| 887 | } |
| 888 | |
| 889 | impl_ = new OpenGLDepthPacketProcessorImpl(window, debug); |
| 890 | impl_->initialize(); |
| 891 | } |
| 892 | |
| 893 | OpenGLDepthPacketProcessor::~OpenGLDepthPacketProcessor() |
| 894 | { |
nothing calls this directly
no test coverage detected