From 1635f59f28454908411d6f41ba11a04f84cf9668 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 18 Feb 2022 12:30:41 +0100 Subject: set proper viewport size --- main.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.cpp b/main.cpp index f9daa3be..c4796f3a 100644 --- a/main.cpp +++ b/main.cpp @@ -95,7 +95,9 @@ atlas_texture application::make_atlas(const std::string& file, Vector2i dims) Matrix4x4 application::make_projection(Vector3 offset) { auto m = glm::mat4{1}; - m = glm::ortho(-256, 256, -256, 256, -512, 512); + auto size = windowSize(); + float x = size[0]*.5f, y = size[1]*.5f, w = 4*sqrt(x*x+y*y); + m = glm::ortho(-x, x, -y, y, -w, w); m = glm::translate(m, { offset[0], -offset[1], offset[2] }); m = glm::scale(m, { 1.f, 0.6f, 1.f }); m = glm::rotate(m, glm::radians(-45.f), glm::vec3(1.0f, 0.0f, 0.0f)); -- cgit v1.2.3