From 69cbc0b5a2e0e63ee512deaa511641c9b8ed565a Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Tue, 4 Aug 2020 13:18:36 +1000 Subject: [PATCH] GL/Texture: Add wrap texture mode option --- src/common/gl/texture.cpp | 4 +++- src/common/gl/texture.h | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/common/gl/texture.cpp b/src/common/gl/texture.cpp index 20ce1fd6d..1f9aa4da5 100644 --- a/src/common/gl/texture.cpp +++ b/src/common/gl/texture.cpp @@ -22,7 +22,7 @@ Texture::~Texture() } 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(); @@ -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); 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_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); GLenum error = glGetError(); diff --git a/src/common/gl/texture.h b/src/common/gl/texture.h index 08bc9ea5a..531974c05 100644 --- a/src/common/gl/texture.h +++ b/src/common/gl/texture.h @@ -11,7 +11,7 @@ public: ~Texture(); 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(); void Destroy();