message: Updating the WindowingService to attempt multiple contexts
diff: @@ -13,25 +13,66 @@ namespace NovelRT::Windowing {
  }
  void WindowingService::initialiseWindow(int displayNumber, const std::string& windowTitle) {
  - glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
  - glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
  - glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_ES_API);
  - glfwWindowHint(GLFW_AUTO_ICONIFY, GLFW_FALSE);
  -
  GLFWmonitor* primaryMonitor = glfwGetPrimaryMonitor();
  const GLFWvidmode* displayData = glfwGetVideoMode(primaryMonitor);
  // create window
  float wData = displayData->width * 0.7f;
  float hData = displayData->height * 0.7f;
  +
  + _logger.logInfoLine("Attempting to create OpenGL ES v3.0 context using EGL API");
  +
  + glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_ES_API);
  + glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
  + glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
  + glfwWindowHint(GLFW_CONTEXT_CREATION_API, GLFW_EGL_CONTEXT_API);
  +
  auto window = glfwCreateWindow(wData, hData, _windowTitle.c_str(), nullptr, nullptr);
  +
  + if (window == nullptr)
  + {
  + _logger.logWarning("Failed to create OpenGL ES v3.0 context using EGL API");
  + _logger.logInfo("Attempting to create OpenGL ES v3.0 context using native API");
  +
  + glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_ES_API);
  + glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
  + glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
  + glfwWindowHint(GLFW_CONTEXT_CREATION_API, GLFW_NATIVE_CONTEXT_API);
  +
  + window = glfwCreateWindow(wData, hData, _windowTitle.c_str(), nullptr, nullptr);
  +
  + if (window == nullptr)
  + {
  + _logger.logWarning("Failed to create OpenGL ES v3.0 context using native API");
  + _logger.logInfo("Attempting to create OpenGL v4.3 forward-compatible core profile context using native API");
  +
  + glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_API);
  + glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
  + glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
  + glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GLFW_TRUE);
  + glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
  + glfwWindowHint(GLFW_CONTEXT_CREATION_API, GLFW_NATIVE_CONTEXT_API);
  +
  +#ifdef DEBUG
  + glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, GLFW_TRUE);
  +#endif
  +
  + window = glfwCreateWindow(wData, hData, _windowTitle.c_str(), nullptr, nullptr);
  +
  + if (window == nullptr)
  + {
  + _logger.logError("Failed to create OpenGL v4.3 context using native API");
  + throw std::runtime_error("Unable to continue! Window could not be created.");
  + }
  + }
  + }
  +
  + _logger.logInfo("Window succesfully created.");
  +
  glfwSetWindowAttrib(window, GLFW_RESIZABLE, GLFW_TRUE);
  glfwSetWindowAttrib(window, GLFW_VISIBLE, GLFW_TRUE);
  _window = std::unique_ptr<GLFWwindow, decltype(&glfwDestroyWindow)>(window, glfwDestroyWindow);
  - if (_window == nullptr) {
  - throw std::runtime_error("Unable to continue! Window could not be created.");
  - }
  glfwSetWindowUserPointer(_window.get(), reinterpret_cast<void*>(this));
  