Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/gpu/intern/gpu_texture.c')
-rw-r--r--source/blender/gpu/intern/gpu_texture.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/source/blender/gpu/intern/gpu_texture.c b/source/blender/gpu/intern/gpu_texture.c
index 686a20d05a8..fd01ddf8597 100644
--- a/source/blender/gpu/intern/gpu_texture.c
+++ b/source/blender/gpu/intern/gpu_texture.c
@@ -1856,11 +1856,11 @@ void GPU_texture_mipmap_mode(GPUTexture *tex, bool use_mipmap, bool use_filter)
glTexParameteri(tex->target_base, GL_TEXTURE_MAG_FILTER, filter);
}
-void GPU_texture_wrap_mode(GPUTexture *tex, bool use_repeat)
+void GPU_texture_wrap_mode(GPUTexture *tex, bool use_repeat, bool use_clamp)
{
WARN_NOT_BOUND(tex);
- GLenum repeat = (use_repeat) ? GL_REPEAT : GL_CLAMP_TO_EDGE;
+ GLenum repeat = (use_repeat) ? GL_REPEAT : (use_clamp) ? GL_CLAMP_TO_EDGE : GL_CLAMP_TO_BORDER;
glActiveTexture(GL_TEXTURE0 + tex->number);
glTexParameteri(tex->target_base, GL_TEXTURE_WRAP_S, repeat);
@@ -1870,6 +1870,11 @@ void GPU_texture_wrap_mode(GPUTexture *tex, bool use_repeat)
if (tex->target_base == GL_TEXTURE_3D) {
glTexParameteri(tex->target_base, GL_TEXTURE_WRAP_R, repeat);
}
+
+ if (repeat == GL_CLAMP_TO_BORDER) {
+ const float black[] = {0.0f, 0.0f, 0.0f, 0.0f};
+ glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, black);
+ }
}
void GPU_texture_swizzle_channel_auto(GPUTexture *tex, int channels)