Support multisample renderbuffers
This commit is contained in:
parent
52bb516d5c
commit
f8846e8c06
2 changed files with 20 additions and 0 deletions
|
|
@ -5,6 +5,7 @@
|
|||
#include <psemek/geom/vector.hpp>
|
||||
|
||||
#include <cstddef>
|
||||
#include <optional>
|
||||
|
||||
namespace psemek::gfx
|
||||
{
|
||||
|
|
@ -36,7 +37,10 @@ namespace psemek::gfx
|
|||
std::size_t width() const { return size_[0]; }
|
||||
std::size_t height() const { return size_[1]; }
|
||||
|
||||
std::optional<int> samples() const { return samples_; }
|
||||
|
||||
void storage(GLenum internal_format, geom::vector<std::size_t, 2> const & size);
|
||||
void storage(GLenum internal_format, geom::vector<std::size_t, 2> const & size, int samples);
|
||||
|
||||
template <typename Pixel>
|
||||
void storage(geom::vector<std::size_t, 2> const & size)
|
||||
|
|
@ -44,9 +48,16 @@ namespace psemek::gfx
|
|||
storage(pixel_traits<Pixel>::internal_format, size);
|
||||
}
|
||||
|
||||
template <typename Pixel>
|
||||
void storage(geom::vector<std::size_t, 2> const & size, int samples)
|
||||
{
|
||||
storage(pixel_traits<Pixel>::internal_format, size, samples);
|
||||
}
|
||||
|
||||
private:
|
||||
GLuint id_ = 0;
|
||||
geom::vector<std::size_t, 2> size_ = {0, 0};
|
||||
std::optional<int> samples_ = std::nullopt;
|
||||
|
||||
explicit renderbuffer(std::nullptr_t);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -52,6 +52,15 @@ namespace psemek::gfx
|
|||
bind();
|
||||
gl::RenderbufferStorage(target, internal_format, size[0], size[1]);
|
||||
size_ = size;
|
||||
samples_ = std::nullopt;
|
||||
}
|
||||
|
||||
void renderbuffer::storage(GLenum internal_format, geom::vector<std::size_t, 2> const & size, int samples)
|
||||
{
|
||||
bind();
|
||||
gl::RenderbufferStorageMultisample(target, samples, internal_format, size[0], size[1]);
|
||||
size_ = size;
|
||||
samples_ = samples;
|
||||
}
|
||||
|
||||
renderbuffer::renderbuffer(std::nullptr_t)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue