Trying to play with Vulkan GUI
This commit is contained in:
parent
66672ff1c3
commit
455c25abb8
2
.gitignore
vendored
2
.gitignore
vendored
@ -23,3 +23,5 @@
|
||||
|
||||
cpp/vscode/helloworld
|
||||
cpp/vulkan/vulkantest/VulkanTest
|
||||
cpp/ANSI/W1/Day1/1.1/helloworld
|
||||
cpp/vulkan/HelloTriangle/HelloTriangle
|
||||
|
||||
13
cpp/vulkan/HelloTriangle/Makefile
Normal file
13
cpp/vulkan/HelloTriangle/Makefile
Normal 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
|
||||
53
cpp/vulkan/HelloTriangle/main.cpp
Normal file
53
cpp/vulkan/HelloTriangle/main.cpp
Normal 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;
|
||||
}
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user