opengl: expose npot support in gl_api
[vlc.git] / modules / video_output / opengl / sub_renderer.h
blob7b027a937b65676ba315d54c54e568a25e1f0c98
1 /*****************************************************************************
2 * sub_renderer.h
3 *****************************************************************************
4 * Copyright (C) 2020 Videolabs
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation; either version 2.1 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
19 *****************************************************************************/
21 #ifndef VLC_SUB_RENDERER_H
22 #define VLC_SUB_RENDERER_H
24 #ifdef HAVE_CONFIG_H
25 # include "config.h"
26 #endif
28 #include <vlc_common.h>
29 #include <vlc_opengl.h>
31 #include "gl_api.h"
32 #include "gl_common.h"
34 /**
35 * A subpictures renderer handles the rendering of RGB subpictures.
37 struct vlc_gl_sub_renderer;
39 /**
40 * Create a new subpictures renderer
42 * \param gl the GL context
43 * \param api the OpenGL API
44 * \param supports_npot indicate if the implementation supports non-power-of-2
45 * texture size
47 struct vlc_gl_sub_renderer *
48 vlc_gl_sub_renderer_New(vlc_gl_t *gl, const struct vlc_gl_api *api);
50 /**
51 * Delete a subpictures renderer
53 * \param sr the renderer
55 void
56 vlc_gl_sub_renderer_Delete(struct vlc_gl_sub_renderer *sr);
58 /**
59 * Prepare the fragment shader
61 * Concretely, it allocates OpenGL textures if necessary and uploads the
62 * picture.
64 * \param sr the renderer
65 * \param subpicture the subpicture to render
67 int
68 vlc_gl_sub_renderer_Prepare(struct vlc_gl_sub_renderer *sr,
69 subpicture_t *subpicture);
71 /**
72 * Draw the prepared subpicture
74 * \param sr the renderer
76 int
77 vlc_gl_sub_renderer_Draw(struct vlc_gl_sub_renderer *sr);
79 #endif