Skip to content

Commit 27d84a5

Browse files
authored
Merge pull request #76 from inorichi/texture_blend_fix
Fix texture blending
2 parents 9c69339 + 5cd089b commit 27d84a5

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

lib_ass_media/src/main/java/io/github/peerless2012/ass/media/widget/AssSubtitleTextureView.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,7 @@ class AssSubtitleTextureView : TextureView, AssSubtitleRender, TextureView.Surfa
213213
uniform vec4 u_Color;
214214
void main() {
215215
float alpha = texture2D(u_Texture, v_TexCoord).a;
216-
gl_FragColor = u_Color * alpha;
217-
216+
gl_FragColor = vec4(u_Color.rgb, u_Color.a * alpha);
218217
}
219218
""".trimIndent()
220219

@@ -290,7 +289,7 @@ class AssSubtitleTextureView : TextureView, AssSubtitleRender, TextureView.Surfa
290289
// enable blend
291290
GLES20.glEnable(GLES20.GL_BLEND)
292291
// set blend mode
293-
GLES20.glBlendFunc(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE_MINUS_SRC_ALPHA)
292+
GLES20.glBlendFuncSeparate(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE_MINUS_SRC_ALPHA, GLES20.GL_ONE, GLES20.GL_ONE_MINUS_SRC_ALPHA)
294293
}
295294

296295
override fun onSurfaceChanged(width: Int, height: Int) {

0 commit comments

Comments
 (0)