1 #include <assimp/version.h>
3 #include <GLFW/glfw3.h>
5 #include "engine/logger.h"
6 #include "engine/performance.h"
7 #include "engine/render.h"
10 #include "game/input.h"
11 #include "game/level.h"
12 #include "game/player.h"
14 void onGlfwError(int error, const char* description);
16 int main(/*int argc, char** argv*/) {
17 logInfo("Assimp %u.%u", aiGetVersionMajor(), aiGetVersionMinor());
18 logInfo("GLEW %s", (const char*) glewGetString(GLEW_VERSION));
19 logInfo("GLFW %s", glfwGetVersionString());
21 glfwSetErrorCallback(onGlfwError);
24 logError("GLFW init failed");
27 // glutInitContextVersion(4,5); TODO establish correct context
28 // glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
29 // glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 5);
31 GLFWwindow* window = glfwCreateWindow(1280, 720, "shadowclad", NULL, NULL);
33 logError("Window or context creation failed");
38 glfwMakeContextCurrent(window);
40 logInfo("OpenGL %s", (const char*) glGetString(GL_VERSION));
41 logInfo("GLSL %s", (const char*) glGetString(GL_SHADING_LANGUAGE_VERSION));
42 logInfo("%s", (const char*) glGetString(GL_RENDERER));
44 GLenum glewInitStatus = glewInit();
45 if (glewInitStatus != GLEW_OK) {
46 logError("GLEW init failed: %s", (const char*) glewGetErrorString(glewInitStatus));
50 logInfo("Setting swap interval to 1");
54 glfwGetFramebufferSize(window, &width, &height);
55 resizeStage(window, width, height);
57 glfwSetFramebufferSizeCallback(window, resizeStage);
58 glfwSetKeyCallback(window, onKeyboardEvent);
61 //initPerformanceMetering();
66 float lastTime = glfwGetTime();
69 while (!glfwWindowShouldClose(window)) {
70 float time = glfwGetTime();
71 delta = time - lastTime;
83 void onGlfwError(int error, const char* description) {
84 logError("GLFW error: %s", description);