Skip to content

Commit

Permalink
libobs: Add function to get last main output texture
Browse files Browse the repository at this point in the history
Allows the ability to get the last rendered texture of the main output
view.
  • Loading branch information
jp9000 committed Apr 20, 2018
1 parent b4d6f1c commit 904ad9b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
17 changes: 17 additions & 0 deletions libobs/obs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1468,6 +1468,23 @@ void obs_render_main_texture(void)
gs_draw_sprite(tex, 0, 0, 0);
}

gs_texture_t *obs_get_main_texture(void)
{
struct obs_core_video *video = &obs->video;
int last_tex;

if (!obs) return NULL;

last_tex = video->cur_texture == 0
? NUM_TEXTURES - 1
: video->cur_texture - 1;

if (!video->textures_rendered[last_tex])
return NULL;

return video->render_textures[last_tex];
}

void obs_set_master_volume(float volume)
{
struct calldata data = {0};
Expand Down
4 changes: 4 additions & 0 deletions libobs/obs.h
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,10 @@ EXPORT void obs_render_main_view(void);
/** Renders the last main output texture */
EXPORT void obs_render_main_texture(void);

/** Returns the last main output texture. This can return NULL if the texture
* is unavailable. */
EXPORT gs_texture_t *obs_get_main_texture(void);

/** Sets the master user volume */
EXPORT void obs_set_master_volume(float volume);

Expand Down

0 comments on commit 904ad9b

Please sign in to comment.