diff --git a/a.out b/a.out index 7eb2079..eb167c7 100755 Binary files a/a.out and b/a.out differ diff --git a/first_app.cpp b/first_app.cpp index b9b15c5..e6e9177 100644 --- a/first_app.cpp +++ b/first_app.cpp @@ -17,6 +17,7 @@ namespace cve { void FirstApp::run() { while (!cveWindow.shouldClose()) { glfwPollEvents(); + drawFrame(); } } void FirstApp::createPipelineLayout() { @@ -91,5 +92,17 @@ namespace cve { } } } - void FirstApp::drawFrame() {}; + void FirstApp::drawFrame() { + uint32_t imageIndex; + auto result = cveSwapChain.acquireNextImage(&imageIndex); + + if (result != VK_SUCCESS && result != VK_SUBOPTIMAL_KHR) { + throw std::runtime_error("Failed to acquire swap chain image!"); + } + + result = cveSwapChain.submitCommandBuffers(&commandBuffers[imageIndex], &imageIndex); + if (result != VK_SUCCESS) { + throw std::runtime_error("Failed to present swap chain image!"); + } + } }