Commit ba509353 authored by Philip Trettner's avatar Philip Trettner

added viewport variants

parent 7d5dc5c7
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment