Unify texture configuration.
This commit is contained in:
@@ -34,3 +34,18 @@ void Texture::bind(GLenum target) const
|
||||
{
|
||||
glBindTexture(target, id);
|
||||
}
|
||||
|
||||
void Texture::configure(GLenum target) const
|
||||
{
|
||||
bind(target);
|
||||
const float color[] = {1, 0, 1}; // Background color for textures.
|
||||
|
||||
// Set up (lack of) repetition
|
||||
glTexParameteri(target, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_BORDER);
|
||||
glTexParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
|
||||
glTexParameterfv(target, GL_TEXTURE_BORDER_COLOR, color);
|
||||
|
||||
// Set up texture scaling
|
||||
glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST); // Use mipmapping for scaling down
|
||||
glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); // Use nearest pixel when scaling up.
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user