diff --git a/src/glow/common/scoped_gl.hh b/src/glow/common/scoped_gl.hh index 966544730f4abce6f8929e11fa308dc33902037b..91311b81a6fe68461387e1906335ec7e56140c22 100644 --- a/src/glow/common/scoped_gl.hh +++ b/src/glow/common/scoped_gl.hh @@ -8,6 +8,9 @@ #include <glow/gl.hh> #include <typed-geometry/types/color.hh> +#include <typed-geometry/types/objects/aabb.hh> +#include <typed-geometry/types/pos.hh> +#include <typed-geometry/types/size.hh> #include <initializer_list> @@ -384,6 +387,14 @@ struct viewport GLint prevView[4]; + viewport(tg::iaabb2 bounds_inclusive) + : viewport(bounds_inclusive.min.x, + bounds_inclusive.min.y, + bounds_inclusive.max.x - bounds_inclusive.min.x + 1, + bounds_inclusive.max.y - bounds_inclusive.min.y + 1) + { + } + viewport(tg::ipos2 offset, tg::isize2 size) : viewport(offset.x, offset.y, size.width, size.height) {} viewport(int x, int y, int w, int h) { glGetIntegerv(GL_VIEWPORT, prevView);