From 0bec267e40c1991cba8c08b4a602e3b69ddf34e8 Mon Sep 17 00:00:00 2001 From: jp9000 Date: Tue, 15 Apr 2014 12:19:20 -0700 Subject: [PATCH] OpenGL: Fix swizzle code again for alpha textures My prior code was incorrect; I mixed up the two parameters, the GL_TEXTURE_SWIZZLE_* parameter specifies the target channel, and the value itself specifies the source channel., If that makes sense. --- libobs-opengl/gl-subsystem.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libobs-opengl/gl-subsystem.c b/libobs-opengl/gl-subsystem.c index 6376ac541..4b8722b1b 100644 --- a/libobs-opengl/gl-subsystem.c +++ b/libobs-opengl/gl-subsystem.c @@ -322,8 +322,12 @@ static void strip_mipmap_filter(GLint *filter) static inline void apply_swizzle(struct gs_texture *tex) { - if (tex->format == GS_A8) - gl_tex_param_i(tex->gl_target, GL_TEXTURE_SWIZZLE_R, GL_ALPHA); + if (tex->format == GS_A8) { + gl_tex_param_i(tex->gl_target, GL_TEXTURE_SWIZZLE_R, GL_ONE); + gl_tex_param_i(tex->gl_target, GL_TEXTURE_SWIZZLE_G, GL_ONE); + gl_tex_param_i(tex->gl_target, GL_TEXTURE_SWIZZLE_B, GL_ONE); + gl_tex_param_i(tex->gl_target, GL_TEXTURE_SWIZZLE_A, GL_RED); + } } static bool load_texture_sampler(texture_t tex, samplerstate_t ss)