open window

This commit is contained in:
ktyl 2023-03-18 22:13:52 +00:00
parent 0200d4dca8
commit bd26428d91
3 changed files with 51 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
vulkan-test

13
Makefile Normal file
View File

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

37
src/main.cpp Normal file
View File

@ -0,0 +1,37 @@
#define GLFW_INCLUDE_VULKAN
#include <GLFW/glfw3.h>
#define GLM_FORCE_RADIANS
#define GLM_FORCE_DEPth_ZERO_TO_ONE
#include <glm/vec4.hpp>
#include <glm/mat4x4.hpp>
#include <iostream>
int main()
{
glfwInit();
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
GLFWwindow* window = glfwCreateWindow(800, 600, "Vulkan window", nullptr, nullptr);
uint32_t extensionCount = 0;
vkEnumerateInstanceExtensionProperties(nullptr, &extensionCount, nullptr);
std::cout << extensionCount << " extensions supported\n";
glm::mat4 matrix;
glm::vec4 vec;
auto test = matrix * vec;
while (!glfwWindowShouldClose(window))
{
glfwPollEvents();
}
glfwDestroyWindow(window);
glfwTerminate();
return 0;
}