GL/Texture: Add wrap texture mode option
This commit is contained in:
parent
3df1670809
commit
69cbc0b5a2
|
@ -22,7 +22,7 @@ Texture::~Texture()
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Texture::Create(u32 width, u32 height, GLenum internal_format, GLenum format, GLenum type, const void* data,
|
bool Texture::Create(u32 width, u32 height, GLenum internal_format, GLenum format, GLenum type, const void* data,
|
||||||
bool linear_filter)
|
bool linear_filter, bool wrap)
|
||||||
{
|
{
|
||||||
glGetError();
|
glGetError();
|
||||||
|
|
||||||
|
@ -32,6 +32,8 @@ bool Texture::Create(u32 width, u32 height, GLenum internal_format, GLenum forma
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, internal_format, width, height, 0, format, type, data);
|
glTexImage2D(GL_TEXTURE_2D, 0, internal_format, width, height, 0, format, type, data);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, linear_filter ? GL_LINEAR : GL_NEAREST);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, linear_filter ? GL_LINEAR : GL_NEAREST);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, linear_filter ? GL_LINEAR : GL_NEAREST);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, linear_filter ? GL_LINEAR : GL_NEAREST);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, wrap ? GL_REPEAT : GL_CLAMP_TO_EDGE);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrap ? GL_REPEAT : GL_CLAMP_TO_EDGE);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 1);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 1);
|
||||||
|
|
||||||
GLenum error = glGetError();
|
GLenum error = glGetError();
|
||||||
|
|
|
@ -11,7 +11,7 @@ public:
|
||||||
~Texture();
|
~Texture();
|
||||||
|
|
||||||
bool Create(u32 width, u32 height, GLenum internal_format, GLenum format, GLenum type, const void* data = nullptr,
|
bool Create(u32 width, u32 height, GLenum internal_format, GLenum format, GLenum type, const void* data = nullptr,
|
||||||
bool linear_filter = false);
|
bool linear_filter = false, bool wrap = false);
|
||||||
bool CreateFramebuffer();
|
bool CreateFramebuffer();
|
||||||
|
|
||||||
void Destroy();
|
void Destroy();
|
||||||
|
|
Loading…
Reference in New Issue