Automatically updating DisplayFrameBufferScale by reading the OpenGL drawable size and comparing with the window size. This fixed dear imgui which was rendering only to 1/4 of my window.

This commit is contained in:
Nick Gravelyn 2016-01-20 06:06:31 -08:00 committed by ocornut
parent aecf5d12e6
commit a9b0abe493

View File

@ -240,6 +240,10 @@ void ImGui_ImplSdl_NewFrame(SDL_Window *window)
SDL_GetWindowSize(window, &w, &h); SDL_GetWindowSize(window, &w, &h);
io.DisplaySize = ImVec2((float)w, (float)h); io.DisplaySize = ImVec2((float)w, (float)h);
int glW, glH;
SDL_GL_GetDrawableSize(window, &glW, &glH);
io.DisplayFramebufferScale = ImVec2(glW / io.DisplaySize.x, glH / io.DisplaySize.y);
// Setup time step // Setup time step
Uint32 time = SDL_GetTicks(); Uint32 time = SDL_GetTicks();
double current_time = time / 1000.0; double current_time = time / 1000.0;