Trying to play with Vulkan GUI

This commit is contained in:
ganome 2024-08-25 11:29:09 -06:00
parent 66672ff1c3
commit 455c25abb8
Signed by untrusted user who does not match committer: Ganome
GPG Key ID: 944DE53336D81B83
4 changed files with 76 additions and 0 deletions

2
.gitignore vendored
View File

@ -23,3 +23,5 @@
cpp/vscode/helloworld
cpp/vulkan/vulkantest/VulkanTest
cpp/ANSI/W1/Day1/1.1/helloworld
cpp/vulkan/HelloTriangle/HelloTriangle

View File

@ -0,0 +1,13 @@
CFLAGS = -std=c++17 -O2
LDFLAGS = -lglfw -lvulkan -ldl -lpthread -lX11 -lXxf86vm -lXrandr -lXi
HelloTriangle: main.cpp
g++ $(CFLAGS) -o HelloTriangle main.cpp $(LDFLAGS)
.PHONY: test clean
test: HelloTriangle
./HelloTriangle
clean:
rm -f HelloTriangle

View File

@ -0,0 +1,53 @@
#define GLFW_INCLUDE_VULKAN
#include <GLFW/glfw3.h>
#include <vulkan/vulkan.h>
#include <iostream>
#include <stdexcept>
#include <cstdlib>
class HelloTriangleApplication {
public:
void run() {
initWindow();
initVulkan();
mainLoop();
cleanup();
}
private:
void initWindow() {
glfwInit();
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE);
GLFWwindow* window;
window = glfwCreateWindow(800, 600, "Vulkan", nullptr, nullptr);
}
void initVulkan() {
}
void mainLoop() {
}
void cleanup() {
}
};
int main() {
HelloTriangleApplication app;
try {
app.run();
} catch (const std::exception& e) {
std::cerr << e.what() << std::endl;
return EXIT_FAILURE;
}
// std::cout << "Success!!!";
return EXIT_SUCCESS;
}

View File

@ -3,3 +3,11 @@ LDFLAGS = -lglfw -lvulkan -ldl -lpthread -lX11 -lXxf86vm -lXrandr -lXi
VulkanTest: main.cpp
g++ $(CFLAGS) -o VulkanTest main.cpp $(LDFLAGS)
.PHONY: test clean
test: VulkanTest
./VulkanTest
clean:
rm -f VulkanTest