1 /*****************************************************************************
2 * renderer.h: OpenGL internal header
3 *****************************************************************************
4 * Copyright (C) 2016 VLC authors and VideoLAN
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_GL_RENDERER_H
22 #define VLC_GL_RENDERER_H
24 #include <vlc_common.h>
25 #include <vlc_codec.h>
26 #include <vlc_opengl.h>
27 #include <vlc_plugin.h>
30 #include "gl_common.h"
39 * OpenGL picture renderer
41 struct vlc_gl_renderer
43 /* Pointer to object gl, set by the caller */
46 /* Set by the caller */
47 const struct vlc_gl_api
*api
;
48 const opengl_vtable_t
*vt
; /* for convenience, same as &api->vt */
50 /* True to dump shaders, set by the caller */
53 /* GLSL version, set by the caller. 100 for GLSL ES, 120 for desktop GLSL */
54 unsigned glsl_version
;
55 /* Precision header, set by the caller. In OpenGLES, the fragment language
56 * has no default precision qualifier for floating point types. */
57 const char *glsl_precision_header
;
62 GLfloat ProjectionMatrix
[16];
63 GLfloat StereoMatrix
[3*3];
64 GLfloat ZoomMatrix
[16];
65 GLfloat ViewMatrix
[16];
70 GLint ProjectionMatrix
;
80 struct vlc_gl_sampler
*sampler
;
85 GLuint vertex_buffer_object
;
86 GLuint index_buffer_object
;
87 GLuint texture_buffer_object
;
94 float f_fovx
; /* f_fovx and f_fovy are linked but we keep both */
95 float f_fovy
; /* to avoid recalculating them when needed. */
96 float f_z
; /* Position of the camera on the shpere radius vector */
101 * Create a new renderer
103 * \param gl the GL context
104 * \param api the OpenGL API
105 * \param sampler the OpenGL sampler
106 * \param dump_shaders indicate if the shaders must be dumped in logs
108 struct vlc_gl_renderer
*
109 vlc_gl_renderer_New(vlc_gl_t
*gl
, const struct vlc_gl_api
*api
,
110 struct vlc_gl_sampler
*sampler
, bool dump_shaders
);
115 * \param renderer the renderer
118 vlc_gl_renderer_Delete(struct vlc_gl_renderer
*renderer
);
121 * Draw the prepared picture
123 * \param sr the renderer
126 vlc_gl_renderer_Draw(struct vlc_gl_renderer
*renderer
);
129 vlc_gl_renderer_SetViewpoint(struct vlc_gl_renderer
*renderer
,
130 const vlc_viewpoint_t
*p_vp
);
133 vlc_gl_renderer_SetWindowAspectRatio(struct vlc_gl_renderer
*renderer
,
136 #endif /* include-guard */