General structure
在上一节中,我们创建了一个正确配置、可运行的的Vulkan应用程序,并使用测试代码进行了测试。本节中我们从头开始,使用如下代码构建一个基于GLFW的Vulkan应用程序原型框架的雏形。
#include <vulkan/vulkan.h>#include <iostream>#include <stdexcept>#include <functional>class HelloTriangleApplication {public: void run() {
initVulkan();
mainLoop();
cleanup();
}private: void initVulkan() {
} void mainLoop() {
} void cleanup() {
}
};int main() {
HelloTriangleApplication app; try {
app.run();
} catch (const std::runtime_error& e) {
std::cerr << e.what() << std::endl; return EXIT_FAILURE;
} return EXIT_SUCCESS;
}


