diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2022-02-18 12:30:41 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2022-02-18 12:30:41 +0100 |
commit | 1635f59f28454908411d6f41ba11a04f84cf9668 (patch) | |
tree | 3176c8333f08053262c466c7383fd6b1ec95401c | |
parent | 714390250377d88376b7336900b9806cdcefc23a (diff) |
set proper viewport size
-rw-r--r-- | main.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -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<float>(-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<float>(-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)); |