--- /dev/null
+#include "viewport.hpp"
+
+#include <GL/glew.h>
+#include <glm/gtc/matrix_transform.hpp>
+
+
+namespace tacos {
+
+Viewport::Viewport(int w, int h)
+: width(w)
+, height(h)
+, fov(0.78539816339744830961f) // π/4
+, aspect(float(w) / float(h))
+, near(0.1f)
+, far(100.0f)
+, perspective(glm::perspective(fov, aspect, near, far))
+, ortho(glm::ortho(0.0f, float(width), float(height), 0.0f, near, far)) {
+
+}
+
+void Viewport::Resize(int w, int h) noexcept {
+ width = w;
+ height = h;
+ aspect = float(width) / float(height);
+ perspective = glm::perspective(fov, aspect, near, far);
+ ortho = glm::ortho(0.0f, float(width), float(height), 0.0f, near, far);
+ glViewport(0, 0, width, height);
+}
+
+}