Sampler::Sampler ( unsigned int wrapModeS , unsigned int wrapModeT , unsigned int wrapModeR , unsigned int minFilter , unsigned int magFilter ) : id( createGLSampler() ) { bind( Texture< 0 >::SETUP_UNIT ); setWrapModeS( wrapModeS ); setWrapModeT( wrapModeT ); setWrapModeR( wrapModeR ); setMinFilter( minFilter ); setMagFilter( magFilter ); }
// TODO set texture unit upfront Texture2D::Texture2D(GLsizei width, GLsizei height, GLuint mipmapLevels) { glEnable(GL_TEXTURE_2D); m_width = width; m_height = height; m_mipmapLevels = 8; glGenTextures(1, &m_TBO); bind(); glTexStorage2D(GL_TEXTURE_2D, m_mipmapLevels, GL_RGBA32F, m_width, m_height); if(m_mipmapLevels > 0) { setMagFilter(GL_LINEAR_MIPMAP_LINEAR); setMinFilter(GL_LINEAR_MIPMAP_LINEAR); } else { setMagFilter(GL_LINEAR); setMinFilter(GL_LINEAR); } setWrapModeS(GL_REPEAT); setWrapModeT(GL_REPEAT); }
//-------------------------------------------------------------------------------------------------- /// Sets wrap mode for both S and T //-------------------------------------------------------------------------------------------------- void Sampler::setWrapMode(WrapMode wrapMode) { setWrapModeS(wrapMode); setWrapModeT(wrapMode); }