24 lines
654 B
C++
24 lines
654 B
C++
#include "Sampler.h"
|
|
|
|
namespace charcoal
|
|
{
|
|
Sampler::Sampler(Wrap wrap_s, Wrap wrap_t, MagFilter magnification_filter, MinFilter minification_filter)
|
|
{
|
|
glGenSamplers(1, &m_sampler);
|
|
|
|
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);
|
|
}
|
|
} |