4 #include "engine/logger.h"
5 #include "engine/performance.h"
6 #include "engine/render.h"
9 #include "game/level.h"
10 #include "game/player.h"
12 int main(int argc, char** argv) {
13 glutInit(&argc, argv);
14 // glutInitContextVersion(4,5); TODO establish correct context
16 glutInitWindowSize(1280, 720);
18 glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH);
19 glutCreateWindow("shadowclad");
21 logInfo("OpenGL %s", (const char*) glGetString(GL_VERSION));
22 logInfo("GLSL %s", (const char*) glGetString(GL_SHADING_LANGUAGE_VERSION));
23 logInfo("%s", (const char*) glGetString(GL_RENDERER));
25 GLenum glewInitStatus = glewInit();
26 if (glewInitStatus != GLEW_OK) {
27 logError("GLEW init failed: %s", (const char*) glewGetErrorString(glewInitStatus));
30 logInfo("GLEW %s", (const char*) glewGetString(GLEW_VERSION));
32 if (GLXEW_EXT_swap_control) {
33 Display* display = glXGetCurrentDisplay();
34 GLXDrawable drawable = glXGetCurrentDrawable();
36 glXSwapIntervalEXT(display, drawable, 1);
39 logWarning("Drawable is not here ¯\\_(ツ)_/¯");
40 logWarning("Could not enable vsync (GLX_EXT_swap_control)");
43 else if (GLXEW_MESA_swap_control) {
44 glXSwapIntervalMESA(1);
45 logDebug("Vsync enabled with GLX_MESA_swap_control, swap interval %d", glXGetSwapIntervalMESA());
48 logWarning("Could not enable vsync (extensions not supported)");
51 GLint maxModelviewStackDepth;
52 glGetIntegerv(GL_MAX_MODELVIEW_STACK_DEPTH, &maxModelviewStackDepth);
53 logDebug("GL_MAX_MODELVIEW_STACK_DEPTH: %d", maxModelviewStackDepth);
55 glutDisplayFunc(renderFrame);
56 glutReshapeFunc(resizeStage);
57 //glutKeyboardFunc(key_pressed);
58 //glutMouseFunc(mouse_button_event);
59 //glutMotionFunc(mouse_motion_event);
62 //initPerformanceMetering();