浏览代码

libobs: Use alpha when rendering scenes

This is just in case a filter is applied to a scene, filters will turn
off the blending so it's necessary to set the blending.
jp9000 10 年之前
父节点
当前提交
4abae186ce
共有 1 个文件被更改,包括 5 次插入0 次删除
  1. 5 0
      libobs/obs-scene.c

+ 5 - 0
libobs/obs-scene.c

@@ -306,6 +306,9 @@ static void scene_video_render(void *data, gs_effect_t *effect)
 
 
 	item = scene->first_item;
 	item = scene->first_item;
 
 
+	gs_blend_state_push();
+	gs_blend_function(GS_BLEND_SRCALPHA, GS_BLEND_INVSRCALPHA);
+
 	while (item) {
 	while (item) {
 		if (obs_source_removed(item->source)) {
 		if (obs_source_removed(item->source)) {
 			struct obs_scene_item *del_item = item;
 			struct obs_scene_item *del_item = item;
@@ -326,6 +329,8 @@ static void scene_video_render(void *data, gs_effect_t *effect)
 		item = item->next;
 		item = item->next;
 	}
 	}
 
 
+	gs_blend_state_pop();
+
 	pthread_mutex_unlock(&scene->mutex);
 	pthread_mutex_unlock(&scene->mutex);
 
 
 	UNUSED_PARAMETER(effect);
 	UNUSED_PARAMETER(effect);