diff --git a/libobs/obs-internal.h b/libobs/obs-internal.h index 66fa8ede7843f32e521b3ccc89f6493487ba71d9..33e3a96cfa531ec9963f027d6b614ed98a71386f 100644 --- a/libobs/obs-internal.h +++ b/libobs/obs-internal.h @@ -257,6 +257,8 @@ struct obs_core_video { uint32_t base_height; float color_matrix[16]; enum obs_scale_type scale_type; + + gs_texture_t *transparent_texture; }; struct obs_core_audio { diff --git a/libobs/obs.c b/libobs/obs.c index 0257f73e8ace025ee055142aa8d29311264c03b7..6e16e9998f9a2883013c5fcfed5374e5b92511a5 100644 --- a/libobs/obs.c +++ b/libobs/obs.c @@ -218,6 +218,8 @@ static bool obs_init_textures(struct obs_video_info *ovi) static int obs_init_graphics(struct obs_video_info *ovi) { struct obs_core_video *video = &obs->video; + uint8_t transparent_tex_data[2*2*4] = {0}; + const uint8_t *transparent_tex = transparent_tex_data; bool success = true; int errorcode; @@ -278,6 +280,9 @@ static int obs_init_graphics(struct obs_video_info *ovi) NULL); bfree(filename); + obs->video.transparent_texture = gs_texture_create(2, 2, GS_RGBA, 1, + &transparent_tex, 0); + if (!video->default_effect) success = false; if (gs_get_device_type() == GS_DEVICE_OPENGL) { @@ -290,6 +295,8 @@ static int obs_init_graphics(struct obs_video_info *ovi) success = false; if (!video->conversion_effect) success = false; + if (!video->transparent_texture) + success = false; gs_leave_context(); return success ? OBS_VIDEO_SUCCESS : OBS_VIDEO_FAIL; @@ -432,6 +439,8 @@ static void obs_free_graphics(void) if (video->graphics) { gs_enter_context(video->graphics); + gs_texture_destroy(video->transparent_texture); + gs_effect_destroy(video->default_effect); gs_effect_destroy(video->default_rect_effect); gs_effect_destroy(video->opaque_effect);