MCPcopy Create free account
hub / github.com/Overv/VulkanTutorial / HelloTriangleApplication

Class HelloTriangleApplication

code/19_vertex_buffer.cpp:105–1045  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

103};
104
105class HelloTriangleApplication {
106public:
107 void run() {
108 initWindow();
109 initVulkan();
110 mainLoop();
111 cleanup();
112 }
113
114private:
115 GLFWwindow* window;
116
117 VkInstance instance;
118 VkDebugUtilsMessengerEXT debugMessenger;
119 VkSurfaceKHR surface;
120
121 VkPhysicalDevice physicalDevice = VK_NULL_HANDLE;
122 VkDevice device;
123
124 VkQueue graphicsQueue;
125 VkQueue presentQueue;
126
127 VkSwapchainKHR swapChain;
128 std::vector<VkImage> swapChainImages;
129 VkFormat swapChainImageFormat;
130 VkExtent2D swapChainExtent;
131 std::vector<VkImageView> swapChainImageViews;
132 std::vector<VkFramebuffer> swapChainFramebuffers;
133
134 VkRenderPass renderPass;
135 VkPipelineLayout pipelineLayout;
136 VkPipeline graphicsPipeline;
137
138 VkCommandPool commandPool;
139
140 VkBuffer vertexBuffer;
141 VkDeviceMemory vertexBufferMemory;
142
143 std::vector<VkCommandBuffer> commandBuffers;
144
145 std::vector<VkSemaphore> imageAvailableSemaphores;
146 std::vector<VkSemaphore> renderFinishedSemaphores;
147 std::vector<VkFence> inFlightFences;
148 uint32_t currentFrame = 0;
149
150 bool framebufferResized = false;
151
152 void initWindow() {
153 glfwInit();
154
155 glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
156
157 window = glfwCreateWindow(WIDTH, HEIGHT, "Vulkan", nullptr, nullptr);
158 glfwSetWindowUserPointer(window, this);
159 glfwSetFramebufferSizeCallback(window, framebufferResizeCallback);
160 }
161
162 static void framebufferResizeCallback(GLFWwindow* window, int width, int height) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected