07/src/main.cpp

55 lines
1.3 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include "vk.h"
#include <iostream>
void vkInit();
int main(int argc, char* argv[]) {
// Инициализация GLFW
glfwInit();
// Проверка доступности Vulkan
if (glfwVulkanSupported())
{
// объект класса-обертки Vulkan API
Vulkan vulkan;
// Отключим создание контекста
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
// Отключим возможность изменения размеров окна
glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE);
// Создание окна
GLFWwindow* window = glfwCreateWindow(800, 600, "Vulkan window", nullptr, nullptr);
// Инициализация Vulkan API
vulkan.init(window);
// Жизненный цикл
while(!glfwWindowShouldClose(window)) {
// Обработка событий
glfwPollEvents();
vulkan.renderFrame();
}
// Уничтожение окна
glfwDestroyWindow(window);
// Завершение работы с Vulkan
vulkan.destroy();
}
else
std::cout << "There is no Vulkan Supported\n";
// Завершение работы с GLFW
glfwTerminate();
return 0;
}