4 //#include "debugutil.h"
7 #include "performance.h"
11 int main(int argc, char** argv) {
12 glutInit(&argc, argv);
13 // glutInitContextVersion(4,5); TODO establish correct context
15 glutInitWindowSize(800, 600);
17 glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH);
18 glutCreateWindow(NULL);
20 // glutSetWindowTitle(getGlInfoString());
21 glutSetWindowTitle("shadowclad");
23 logInfo("OpenGL %s", (const char*) glGetString(GL_VERSION));
24 logInfo("GLSL %s", (const char*) glGetString(GL_SHADING_LANGUAGE_VERSION));
25 logInfo("%s", (const char*) glGetString(GL_RENDERER));
27 GLenum glewInitStatus = glewInit();
28 if (glewInitStatus != GLEW_OK) {
29 logError("GLEW init failed: %s", (const char*) glewGetErrorString(glewInitStatus));
32 logInfo("GLEW %s", (const char*) glewGetString(GLEW_VERSION));
34 if (GLXEW_EXT_swap_control) {
35 Display* display = glXGetCurrentDisplay();
36 GLXDrawable drawable = glXGetCurrentDrawable();
38 glXSwapIntervalEXT(display, drawable, 1);
41 logWarning("Drawable is not here ¯\\_(ツ)_/¯");
42 logWarning("Could not enable vsync (GLX_EXT_swap_control)");
45 else if (GLXEW_MESA_swap_control) {
46 glXSwapIntervalMESA(1);
47 log("Vsync enabled with GLX_MESA_swap_control, swap interval %d", glXGetSwapIntervalMESA());
50 logWarning("Could not enable vsync (extensions not supported)");
53 glutDisplayFunc(renderScene);
54 glutReshapeFunc(resizeStage);
55 //glutKeyboardFunc(key_pressed);
56 //glutMouseFunc(mouse_button_event);
57 //glutMotionFunc(mouse_motion_event);
60 //initPerformanceMetering();