summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--main/app.cpp1
-rw-r--r--main/camera.cpp2
-rw-r--r--main/main.cpp2
-rw-r--r--shaders/tile-shader.vert4
4 files changed, 6 insertions, 3 deletions
diff --git a/main/app.cpp b/main/app.cpp
index 89d680de..b0acda2e 100644
--- a/main/app.cpp
+++ b/main/app.cpp
@@ -15,6 +15,7 @@ app::app(const Arguments& arguments):
}
{
reset_camera_offset();
+ update_window_scale(windowSize());
timeline.start();
}
diff --git a/main/camera.cpp b/main/camera.cpp
index c9fb0391..2887d02f 100644
--- a/main/camera.cpp
+++ b/main/camera.cpp
@@ -1,4 +1,5 @@
#include "app.hpp"
+#include <Magnum/GL/DefaultFramebuffer.h>
namespace Magnum::Examples {
@@ -34,6 +35,7 @@ void app::update_window_scale(Vector2i sz)
void app::viewportEvent(Platform::Sdl2Application::ViewportEvent& event)
{
update_window_scale(event.windowSize());
+ GL::defaultFramebuffer.setViewport({{}, event.windowSize()});
}
} // namespace Magnum::Examples
diff --git a/main/main.cpp b/main/main.cpp
index 431bbefd..cf03516b 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -34,7 +34,7 @@ void app::drawEvent() {
GL::Renderer::setDepthFunction(GL::Renderer::DepthFunction::Never);
#endif
- update_window_scale(windowSize());
+ //update_window_scale(windowSize());
{
float dt = timeline.previousFrameDuration();
update(dt);
diff --git a/shaders/tile-shader.vert b/shaders/tile-shader.vert
index 122b08f7..33837e83 100644
--- a/shaders/tile-shader.vert
+++ b/shaders/tile-shader.vert
@@ -10,7 +10,7 @@ noperspective out vec2 frag_texcoords;
void main() {
frag_texcoords = texcoords;
- float cx = 2/scale.x, cy = 2/scale.y;
+ float cx = 2/scale.x, cy = 2/(scale.y*4./3.);
float x = -position.y, y = -position.x, z = position.z;
- gl_Position = vec4((x-y+offset.x)*cx, (x+y+z*2)*cx*0.75-offset.y*cx, 0, 1);
+ gl_Position = vec4((x-y+offset.x)*cx, (x+y+z*2)*cy*0.75-offset.y*cy, 0, 1);
}