X-Git-Url: https://git.ucc.asn.au/?p=ipdf%2Fcode.git;a=blobdiff_plain;f=src%2Fscreen.cpp;fp=src%2Fscreen.cpp;h=0dbc4bc4209899b6a3e0288560db5d6c49df56ab;hp=16a3ab8aec29c55f9f059364d9d40faf5bbb4537;hb=f0b6c9b6b95fde134927c395afbfbbbc057868e6;hpb=d68c91a7a2a3a4b3a312a50cbab5a7539d4cd7d5;ds=sidebyside diff --git a/src/screen.cpp b/src/screen.cpp index 16a3ab8..0dbc4bc 100644 --- a/src/screen.cpp +++ b/src/screen.cpp @@ -45,28 +45,29 @@ Screen::Screen(bool visible) } SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3); - SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3); SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_DEBUG_FLAG); SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE); - + //SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); m_gl_context = SDL_GL_CreateContext(m_window); + //SDL_GL_SetSwapInterval(1); ogl_LoadFunctions(); // Why is this so horribly broken? if (ogl_IsVersionGEQ(3,2)) { - Fatal("We require OpenGL 3.3, but you have version %d.%d!",ogl_GetMajorVersion(), ogl_GetMinorVersion()); + Error("We require OpenGL 3.3, but you have version %d.%d!",ogl_GetMajorVersion(), ogl_GetMinorVersion()); } if (!SDL_GL_ExtensionSupported("GL_ARB_shading_language_420pack")) { - Fatal("Your system does not support the ARB_shading_language_420pack extension, which is required."); + Error("Your system does not support the ARB_shading_language_420pack extension, which is required."); } if (!SDL_GL_ExtensionSupported("GL_ARB_explicit_attrib_location")) { - Fatal("Your system does not support the ARB_explicit_attrib_location extension, which is required."); + Error("Your system does not support the ARB_explicit_attrib_location extension, which is required."); } m_frame_begin_time = SDL_GetPerformanceCounter(); @@ -227,8 +228,10 @@ void Screen::Present() { if (!Valid()) return; + if (m_debug_font_atlas) DebugFontFlush(); + m_last_frame_time = SDL_GetPerformanceCounter() - m_frame_begin_time; glEndQuery(GL_TIME_ELAPSED); SDL_GL_SwapWindow(m_window); @@ -238,6 +241,8 @@ void Screen::Present() m_last_frame_gpu_timer = m_frame_gpu_timer; glGenQueries(1, &m_frame_gpu_timer); glBeginQuery(GL_TIME_ELAPSED, m_frame_gpu_timer); + + } double Screen::GetLastFrameTimeGPU() const