charcoal/OpenGLEngine/Sampler.cpp

24 lines
654 B
C++
Raw Normal View History

#include "Sampler.h"
namespace charcoal
{
Sampler::Sampler(Wrap wrap_s, Wrap wrap_t, MagFilter magnification_filter, MinFilter minification_filter)
{
glGenSamplers(1, &m_sampler);
2018-09-16 00:43:29 +00:00
glSamplerParameteri(m_sampler, GL_TEXTURE_WRAP_S, (GLenum)wrap_s);
glSamplerParameteri(m_sampler, GL_TEXTURE_WRAP_T, (GLenum)wrap_t);
glSamplerParameteri(m_sampler, GL_TEXTURE_MAG_FILTER, (GLenum)magnification_filter);
glSamplerParameteri(m_sampler, GL_TEXTURE_MIN_FILTER, (GLenum)minification_filter);
}
Sampler::~Sampler()
{
glDeleteSamplers(1, &m_sampler);
}
void Sampler::bind(GLuint texture_unit)
{
glBindSampler(texture_unit, m_sampler);
}
}