libobs: Add obs_render_main_texture

(Note: This commit also modifies UI and test)

This makes it so that main preview panes are rendered with the main
output texture rather than re-rendering the main view.  The view will
render all objects again, whereas the output texture will be a single
texture render of the same exact thing.

Also fixes some abnormal artifacting when scaling the main preview pane.
This commit is contained in:
jp9000
2018-01-01 18:33:44 -08:00
parent 2f577c1b71
commit 7f6cf97bd7
10 changed files with 51 additions and 12 deletions

View File

@@ -1430,6 +1430,32 @@ void obs_render_main_view(void)
obs_view_render(&obs->data.main_view);
}
void obs_render_main_texture(void)
{
struct obs_core_video *video = &obs->video;
gs_texture_t *tex;
gs_effect_t *effect;
gs_eparam_t *param;
int last_tex;
if (!obs) return;
last_tex = video->cur_texture == 0
? NUM_TEXTURES - 1
: video->cur_texture - 1;
if (!video->textures_rendered[last_tex])
return;
tex = video->render_textures[last_tex];
effect = obs_get_base_effect(OBS_EFFECT_DEFAULT);
param = gs_effect_get_param_by_name(effect, "image");
gs_effect_set_texture(param, tex);
while (gs_effect_loop(effect, "Draw"))
gs_draw_sprite(tex, 0, 0, 0);
}
void obs_set_master_volume(float volume)
{
struct calldata data = {0};