Basic skeleton! A window is drawn...

parents
#Macros
SHELL = /bin/bash
DATE = $(shell date)
VULKAN_SDK_PATH = /home/sofus/subhome/binaries/vulkan_sdk/VulkanSDK/1.0.61.1/x86_64
#Project Dirs
SRCDIR = src
INCDIR = inc
OBJDIR = obj
BINDIR = bin
#Flags
TARGET = learn
LIBS = -L$(VULKAN_SDK_PATH)/lib `pkg-config --static --libs glfw3` -lvulkan
CXXFLAGS = -Wall -fopenmp -I$(VULKAN_SDK_PATH)/include -std=c++14
CXX = g++
LINKER = g++
LFLAGS = -Wall -I$(INCDIR) $(LIBS)
#Internal Vars
SOURCES := $(wildcard $(SRCDIR)/*.cpp)
INCLUDES := $(wildcard $(SRCDIR)/*.h)
OBJECTS := $(SOURCES:$(SRCDIR)/%.cpp=$(OBJDIR)/%.o)
#Main Rules
$(BINDIR)/$(TARGET): $(OBJECTS)
@$(LINKER) $(OBJECTS) $(LFLAGS) -o $@
@echo "Successfully linked "$@" at "$(shell date)
$(OBJECTS): $(OBJDIR)/%.o : $(SRCDIR)/%.cpp
@echo $(OBJECTS)
@$(CXX) $(CXXFLAGS) -c $< -o $@
.PHONY: clean
clean:
-rm -f obj/* bin/*
install:
@echo "Not Yet Implemented"
#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" << std::endl;
glm::mat4 matrix;
glm::vec4 vec;
auto test = matrix * vec;
while(!glfwWindowShouldClose(window)) {
glfwPollEvents();
}
glfwDestroyWindow(window);
glfwTerminate();
return 0;
}
#define GLFW_INCLUDE_VULKAN //Let GLFW include Vulkan.
#include <GLFW/glfw3.h>
#include <iostream>
#include <stdexcept>
#include <functional>
const int WINDOW_WIDTH = 800;
const int WINDOW_HEIGHT = 600;
class HelloTriangleApplication {
public :
void run() {
initWindow();
initVulkan();
mainLoop();
cleanup();
}
private :
GLFWwindow* window; //Pointer to the GLFW window.
void initWindow() {
glfwInit(); //Start it up.
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API); //Tell it to not use OpenGL.
glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE); //Don't real with resizing for now.
window = glfwCreateWindow(WINDOW_WIDTH, WINDOW_HEIGHT, "Vulkan Learning!", nullptr, nullptr); //Make the window!
}
void initVulkan() {
}
void mainLoop() {
while (!glfwWindowShouldClose(window)) {
glfwPollEvents(); //Loops and checks for events until the window should close.
}
}
void cleanup() {
glfwDestroyWindow(window); //Kill the window.
glfwTerminate(); //Shut it down!
}
};
int main() {
HelloTriangleApplication app;
try {
app.run();
} catch (const std::runtime_error &e) {
std::cerr << e.what() << std::endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment