mirror of
https://github.com/love2d/love.git
synced 2026-08-15 15:51:12 +02:00
Cleaned up and simplified some graphics code.
--HG-- branch : minor
This commit is contained in:
@@ -531,32 +531,20 @@ void OpenGL::setTextureFilter(graphics::Texture::Filter &f)
|
||||
|
||||
void OpenGL::setTextureWrap(const graphics::Texture::Wrap &w)
|
||||
{
|
||||
GLint gs, gt;
|
||||
|
||||
switch (w.s)
|
||||
auto glWrapMode = [](Texture::WrapMode wmode) -> GLint
|
||||
{
|
||||
case Texture::WRAP_CLAMP:
|
||||
gs = GL_CLAMP_TO_EDGE;
|
||||
break;
|
||||
case Texture::WRAP_REPEAT:
|
||||
default:
|
||||
gs = GL_REPEAT;
|
||||
break;
|
||||
}
|
||||
switch (wmode)
|
||||
{
|
||||
case Texture::WRAP_CLAMP:
|
||||
return GL_CLAMP_TO_EDGE;
|
||||
case Texture::WRAP_REPEAT:
|
||||
default:
|
||||
return GL_REPEAT;
|
||||
}
|
||||
};
|
||||
|
||||
switch (w.t)
|
||||
{
|
||||
case Texture::WRAP_CLAMP:
|
||||
gt = GL_CLAMP_TO_EDGE;
|
||||
break;
|
||||
case Texture::WRAP_REPEAT:
|
||||
default:
|
||||
gt = GL_REPEAT;
|
||||
break;
|
||||
}
|
||||
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, gs);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, gt);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, glWrapMode(w.s));
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, glWrapMode(w.t));
|
||||
}
|
||||
|
||||
int OpenGL::getMaxTextureSize() const
|
||||
|
||||
Reference in New Issue
Block a user