]> git.sesse.net Git - vlc/blob - modules/video_output/opengl.h
Use _WIN32 rather than WIN32 (same for WIN64)
[vlc] / modules / video_output / opengl.h
1 /*****************************************************************************
2  * opengl.h: OpenGL vout_display helpers
3  *****************************************************************************
4  * Copyright (C) 2004-2013 VLC authors and VideoLAN
5  * Copyright (C) 2009 Laurent Aimar
6  *
7  * Authors: Laurent Aimar <fenrir _AT_ videolan _DOT_ org>
8  *          Rémi Denis-Courmont
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>
13  *
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.
18  *
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.
23  *
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  *****************************************************************************/
28
29 #include <vlc_common.h>
30 #include <vlc_picture_pool.h>
31 #include <vlc_opengl.h>
32
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 */
35 #ifdef __APPLE__
36 # include <TargetConditionals.h>
37 # if !TARGET_OS_IPHONE
38 #  define USE_OPENGL_ES 0
39 #  define MACOS_OPENGL
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>
46 # endif
47 #else /* !defined (__APPLE__) */
48 # ifndef USE_OPENGL_ES
49 #  define USE_OPENGL_ES 0
50 # endif
51 # if USE_OPENGL_ES == 2
52 #  include <GLES2/gl2.h>
53 # elif USE_OPENGL_ES == 1
54 #  include <GLES/gl.h>
55 # else
56 #  ifdef _WIN32
57 #   include <GL/glew.h>
58 #   undef glClientActiveTexture
59 #   undef glActiveTexture
60     PFNGLACTIVETEXTUREPROC glActiveTexture;
61     PFNGLCLIENTACTIVETEXTUREPROC glClientActiveTexture;
62 #  endif
63 #  include <GL/gl.h>
64 # endif
65 #endif
66
67 static inline bool HasExtension(const char *apis, const char *api)
68 {
69     size_t apilen = strlen(api);
70     while (apis) {
71         while (*apis == ' ')
72             apis++;
73         if (!strncmp(apis, api, apilen) && memchr(" ", apis[apilen], 2))
74             return true;
75         apis = strchr(apis, ' ');
76     }
77     return false;
78 }
79
80 typedef struct vout_display_opengl_t vout_display_opengl_t;
81
82 vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
83                                                const vlc_fourcc_t **subpicture_chromas,
84                                                vlc_gl_t *gl);
85 void vout_display_opengl_Delete(vout_display_opengl_t *vgl);
86
87 picture_pool_t *vout_display_opengl_GetPool(vout_display_opengl_t *vgl, unsigned);
88
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);