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 *****************************************************************************/
29 #include <vlc_common.h>
30 #include <vlc_picture_pool.h>
31 #include <vlc_opengl.h>
33 /* Change USE_OPENGL_ES value to set the OpenGL ES version (1, 2) you want to use
34 * A value of 0 will activate normal OpenGL */
36 # include <TargetConditionals.h>
37 # if !TARGET_OS_IPHONE
38 # define USE_OPENGL_ES 0
40 # include <OpenGL/gl.h>
41 # else /* Force ESv2 on iOS */
42 # define USE_OPENGL_ES 2
43 # include <OpenGLES/ES1/gl.h>
44 # include <OpenGLES/ES2/gl.h>
45 # include <OpenGLES/ES2/glext.h>
47 #else /* !defined (__APPLE__) */
48 # ifndef USE_OPENGL_ES
49 # define USE_OPENGL_ES 0
51 # if USE_OPENGL_ES == 2
52 # include <GLES2/gl2.h>
53 # elif USE_OPENGL_ES == 1
58 # undef glClientActiveTexture
59 # undef glActiveTexture
60 PFNGLACTIVETEXTUREPROC glActiveTexture;
61 PFNGLCLIENTACTIVETEXTUREPROC glClientActiveTexture;
67 static inline bool HasExtension(const char *apis, const char *api)
69 size_t apilen = strlen(api);
73 if (!strncmp(apis, api, apilen) && memchr(" ", apis[apilen], 2))
75 apis = strchr(apis, ' ');
80 typedef struct vout_display_opengl_t vout_display_opengl_t;
82 vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
83 const vlc_fourcc_t **subpicture_chromas,
85 void vout_display_opengl_Delete(vout_display_opengl_t *vgl);
87 picture_pool_t *vout_display_opengl_GetPool(vout_display_opengl_t *vgl, unsigned);
89 int vout_display_opengl_Prepare(vout_display_opengl_t *vgl,
90 picture_t *picture, subpicture_t *subpicture);
91 int vout_display_opengl_Display(vout_display_opengl_t *vgl,
92 const video_format_t *source);