浏览代码

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.
jp9000 11 年之前
父节点
当前提交
0bec267e40
共有 1 个文件被更改,包括 6 次插入2 次删除
  1. 6 2
      libobs-opengl/gl-subsystem.c

+ 6 - 2
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)