hyporo-cpp/source/hpr/gpu/viewport.hpp

45 lines
533 B
C++
Raw Normal View History

2023-01-11 14:46:49 +05:00
#pragma once
#include "../math/vector.hpp"
#ifndef __gl_h_
#include <glad/glad.h>
#endif
namespace hpr::gpu
{
class Viewport
{
protected:
vec2 p_pos;
vec2 p_size;
public:
inline
Viewport() :
p_pos {0.f, 0.f},
p_size {0.f, 0.f}
{}
inline
Viewport(const vec2& pos, const vec2& size) :
p_pos {pos},
p_size {size}
{}
virtual
~Viewport() = default;
inline
void set()
{
glViewport(p_pos[0], p_pos[1], p_size[0], p_size[1]);
}
};
}