void AppLocal::HandleVrModeChanges() { if ( nativeWindow != NULL && windowSurface == EGL_NO_SURFACE ) { CreateWindowSurface(); } if ( Resumed != false && nativeWindow != NULL ) { if ( OvrMobile == NULL ) { EnterVrMode(); } } else { if ( OvrMobile != NULL ) { LeaveVrMode(); } } if ( nativeWindow == NULL && windowSurface != EGL_NO_SURFACE ) { DestroyWindowSurface(); } }
void AppLocal::HandleVrModeChanges() { #if EXPLICIT_EGL_OBJECTS == 0 if ( nativeWindow != NULL && windowSurface == EGL_NO_SURFACE ) { Configure(); CreateWindowSurface(); } #endif if ( Resumed != false && nativeWindow != NULL ) { if ( OvrMobile == NULL ) { #if EXPLICIT_EGL_OBJECTS == 1 Configure(); #endif EnterVrMode(); } } else { if ( OvrMobile != NULL ) { LeaveVrMode(); } } #if EXPLICIT_EGL_OBJECTS == 0 if ( nativeWindow == NULL && windowSurface != EGL_NO_SURFACE ) { DestroyWindowSurface(); } #endif }
// TODO: Resizing bool VkContext::Init(Config config) { if (!glfwInit()) { std::cout << "Unable to initialize GLFW" << std::endl; return false; } if (!CreateInstance(config.windowTitle)) { std::cout << "Unable to create Vulkan instance" << std::endl; return false; } else { std::cout << "Created Vulkan instance" << std::endl; } if (!GetPhysicalDevice()) { std::cout << "Unable to get Vulkan physical device" << std::endl; return false; } else { std::cout << "Acquired Vulkan physical device" << std::endl; } if (!CreateWindowSurface(config.windowWidth, config.windowHeight, config.windowTitle)) { std::cout << "Unable to create window surfcace for Vulkan" << std::endl; return false; } else { std::cout << "Created Vulkan window surface" << std::endl; } if (!GetQueueFamilies()) { std::cout << "Unable to get Vulkan queue families" << std::endl; return false; } else { std::cout << "Acquired queue families" << std::endl; } if (!CreateDevice()) { std::cout << "Unable to create Vulkan device" << std::endl; return false; } else { std::cout << "Created Vulkan device" << std::endl; } #ifdef VOXL_DEBUG if (!SetupValidation()) { std::cout << "Unable to setup Vulkan validation" << std::endl; return false; } else { std::cout << "Setup Vulkan validation" << std::endl; } #endif if (!CreateSemaphores()) { std::cout << "Unable to create Vulkan semaphores" << std::endl; return false; } else { std::cout << "Created Vulkan semaphores" << std::endl; } if (!CreateSwapchain(config.windowWidth, config.windowHeight)) { std::cout << "Unable to create Vulkan swapchain" << std::endl; return false; } else { std::cout << "Created Vulkan swapchain" << std::endl; } if (!CreateCommandPool()) { std::cout << "Unable to create command pool" << std::endl; return false; } else { std::cout << "Created Vulkan command pool" << std::endl; } if (!CreateCommandBuffers()) { std::cout << "Unable to create command buffers" << std::endl; return false; } else { std::cout << "Created Vulkan command buffers" << std::endl; } std::cout << "Successfully initialized Vulkan" << std::endl; return true; }