1 /*****************************************************************************
2 * opengl.h: OpenGL vout_display helpers
3 *****************************************************************************
4 * Copyright (C) 2004-2013 VLC authors and VideoLAN
5 * Copyright (C) 2009 Laurent Aimar
7 * Authors: Laurent Aimar <fenrir _AT_ videolan _DOT_ org>
9 * Jean-Baptiste Kempf <jb@videolan.org>
10 * Ilkka Ollakka <ileoo@videolan.org>
11 * Felix Paul Kühne <fkuehne at videolan dot org>
12 * Rafaël Carré <funman@videolanorg>
14 * This program is free software; you can redistribute it and/or modify it
15 * under the terms of the GNU Lesser General Public License as published by
16 * the Free Software Foundation; either version 2.1 of the License, or
17 * (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU Lesser General Public License for more details.
24 * You should have received a copy of the GNU Lesser General Public License
25 * along with this program; if not, write to the Free Software Foundation,
26 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
27 *****************************************************************************/
32 #include <vlc_common.h>
33 #include <vlc_picture_pool.h>
34 #include <vlc_opengl.h>
36 /* Change USE_OPENGL_ES value to set the OpenGL ES version (1, 2) you want to use
37 * A value of 0 will activate normal OpenGL */
39 # include <TargetConditionals.h>
40 # if !TARGET_OS_IPHONE
41 # define USE_OPENGL_ES 0
43 # include <OpenGL/gl.h>
44 # else /* Force ESv2 on iOS */
45 # define USE_OPENGL_ES 2
46 # include <OpenGLES/ES1/gl.h>
47 # include <OpenGLES/ES2/gl.h>
48 # include <OpenGLES/ES2/glext.h>
50 #else /* !defined (__APPLE__) */
51 # ifndef USE_OPENGL_ES
52 # define USE_OPENGL_ES 0
54 # if USE_OPENGL_ES == 2
55 # include <GLES2/gl2.h>
56 # elif USE_OPENGL_ES == 1
61 # undef glClientActiveTexture
62 # undef glActiveTexture
63 PFNGLACTIVETEXTUREPROC glActiveTexture
;
64 PFNGLCLIENTACTIVETEXTUREPROC glClientActiveTexture
;
70 static const vlc_fourcc_t gl_subpicture_chromas
[] = {
75 static inline bool HasExtension(const char *apis
, const char *api
)
77 size_t apilen
= strlen(api
);
81 if (!strncmp(apis
, api
, apilen
) && memchr(" ", apis
[apilen
], 2))
83 apis
= strchr(apis
, ' ');
88 void orientationTransformMatrix(GLfloat matrix
[static 16], video_orientation_t orientation
);
90 typedef struct vout_display_opengl_t vout_display_opengl_t
;
92 vout_display_opengl_t
*vout_display_opengl_New(video_format_t
*fmt
,
93 const vlc_fourcc_t
**subpicture_chromas
,
95 void vout_display_opengl_Delete(vout_display_opengl_t
*vgl
);
97 picture_pool_t
*vout_display_opengl_GetPool(vout_display_opengl_t
*vgl
, unsigned);
99 int vout_display_opengl_Prepare(vout_display_opengl_t
*vgl
,
100 picture_t
*picture
, subpicture_t
*subpicture
);
101 int vout_display_opengl_Display(vout_display_opengl_t
*vgl
,
102 const video_format_t
*source
);