Skip to content

Commit c3be3c3

Browse files
committed
No more perspective stretching
1 parent cecf092 commit c3be3c3

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/psmoveconfigtool/Renderer.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -321,9 +321,15 @@ void Renderer::renderUIBegin()
321321
}
322322

323323
// Setup display size (every frame to accommodate for window resizing)
324-
int w, h;
325-
SDL_GetWindowSize(m_window, &w, &h);
326-
io.DisplaySize = ImVec2((float)w, (float)h);
324+
int w, h;
325+
SDL_GetWindowSize(m_window, &w, &h);
326+
ImVec2 windowSize = ImVec2((float)w, (float)h);
327+
io.DisplaySize = windowSize;
328+
329+
// Change the perspective aspect ratio
330+
if (windowSize.x > k_real_epsilon && windowSize.y > k_real_epsilon)
331+
setProjectionMatrix(
332+
glm::perspective(k_camera_vfov, windowSize.x / windowSize.y, k_camera_z_near, k_camera_z_far));
327333

328334
// Setup time step
329335
Uint32 time = SDL_GetTicks();

0 commit comments

Comments
 (0)