10 #include "opengl/opengl.h"
11 #include "vulkan/vk.h"
13 /* static functions */
16 static void cleanup();
17 static void display();
20 static void key_clbk(GLFWwindow *win, int key, int scancode, int action, int mods);
22 /* global variables */
29 int main(int argc, char **argv)
31 for(int i=0; i<argc; ++i) {
32 if(strcmp(argv[i], "-opengl") == 0) {
34 printf("Backend: OpenGL.\n");
36 else if(strcmp(argv[i], "-vulkan") == 0) {
38 printf("Backend: Vulkan.\n");
41 printf("No backend specified. Using OpenGL.\n");
46 fprintf(stderr, "Failed to initialize program.\n");
50 glfwSetKeyCallback(win, key_clbk);
52 while(!glfwWindowShouldClose(win)) {
74 if(!scene.load("data/spot/spot_control_mesh.obj")) {
75 fprintf(stderr, "Failed to load scene.\n");
79 for(size_t i=0; i<scene.objects.size(); ++i) {
80 printf("object: %d\n", (int)i);
81 printf("mesh: %s\n", scene.objects[i]->mesh->name.c_str());
82 printf("material: %s\n", scene.objects[i]->material->name.c_str());
83 printf("transform:\n");
84 scene.objects[i]->transform.print();
99 static void key_clbk(GLFWwindow *win, int key, int scancode, int action, int mods)
101 if(key == GLFW_KEY_ESCAPE && action == GLFW_PRESS) {
102 glfwSetWindowShouldClose(win, GLFW_TRUE);
106 static void display()