| 373 | //------------------------------------------------------------------------------ |
| 374 | |
| 375 | void LuxCoreApp::RunApp(luxcore::RenderState *startState, luxcore::Film *startFilm) { |
| 376 | //-------------------------------------------------------------------------- |
| 377 | // Initialize GLFW |
| 378 | //-------------------------------------------------------------------------- |
| 379 | |
| 380 | // It is important to initialize OpenGL before OpenCL |
| 381 | // (required in case of OpenGL/OpenCL inter-operability) |
| 382 | |
| 383 | glfwSetErrorCallback(GLFWErrorCallback); |
| 384 | if (!glfwInit()) |
| 385 | exit(EXIT_FAILURE); |
| 386 | |
| 387 | #ifdef __APPLE__ |
| 388 | // working around a glf bug which sets wrong default depth |
| 389 | glfwWindowHint(GLFW_DEPTH_BITS, 32); |
| 390 | #else |
| 391 | glfwWindowHint(GLFW_DEPTH_BITS, 0); |
| 392 | glfwWindowHint(GLFW_ALPHA_BITS, 0); |
| 393 | #endif |
| 394 | |
| 395 | //-------------------------------------------------------------------------- |
| 396 | // Create the window |
| 397 | //-------------------------------------------------------------------------- |
| 398 | |
| 399 | // Decide the window size |
| 400 | unsigned int windowWidth, windowHeight; |
| 401 | if (config) { |
| 402 | if (optFullScreen) { |
| 403 | GLFWmonitor *monitor = glfwGetPrimaryMonitor(); |
| 404 | const GLFWvidmode *mode = glfwGetVideoMode(monitor); |
| 405 | |
| 406 | windowWidth = mode->width; |
| 407 | windowHeight = mode->height; |
| 408 | |
| 409 | targetFilmWidth = windowWidth / 2; |
| 410 | targetFilmHeight = windowHeight / 2; |
| 411 | config->Parse(Properties() << |
| 412 | Property("film.width")(targetFilmWidth) << |
| 413 | Property("film.height")(targetFilmHeight)); |
| 414 | } else { |
| 415 | config->GetFilmSize(&windowWidth, &windowHeight, NULL); |
| 416 | targetFilmWidth = windowWidth; |
| 417 | targetFilmHeight = windowHeight; |
| 418 | } |
| 419 | } else { |
| 420 | GLFWmonitor *monitor = glfwGetPrimaryMonitor(); |
| 421 | const GLFWvidmode *mode = glfwGetVideoMode(monitor); |
| 422 | |
| 423 | if (optFullScreen) { |
| 424 | windowWidth = mode->width; |
| 425 | windowHeight = mode->height; |
| 426 | } else { |
| 427 | windowWidth = mode->width / 2; |
| 428 | windowHeight = mode->height / 2; |
| 429 | } |
| 430 | |
| 431 | targetFilmWidth = windowWidth; |
| 432 | targetFilmHeight = windowHeight; |
no test coverage detected