]> git.sesse.net Git - vlc/blob - modules/video_output/opengl.h
Direct2D/3D does not need to clamp to display size.
[vlc] / modules / video_output / opengl.h
1 /*****************************************************************************
2  * opengl.h: OpenGL vout_display helpers
3  *****************************************************************************
4  * Copyright (C) 2004 the VideoLAN team
5  * Copyright (C) 2009 Laurent Aimar
6  *
7  * Authors: Cyril Deguet <asmax@videolan.org>
8  *          Gildas Bazin <gbazin@videolan.org>
9  *          Eric Petit <titer@m0k.org>
10  *          Cedric Cocquebert <cedric.cocquebert@supelec.fr>
11  *          Laurent Aimar <fenrir _AT_ videolan _DOT_ org>
12  *
13  * This program is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License as published by
15  * the Free Software Foundation; either version 2 of the License, or
16  * (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software
25  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
26  *****************************************************************************/
27
28 #include <vlc_common.h>
29 #include <vlc_picture_pool.h>
30 #include <vlc_opengl.h>
31
32 // Define USE_OPENGL_ES to the GL ES Version you want to select
33 #ifndef USE_OPENGL_ES
34 # define USE_OPENGL_ES 0
35 #endif
36
37 #define VLCGL_TEXTURE_COUNT 1
38
39 #if !defined (__APPLE__)
40 # if USE_OPENGL_ES == 2
41 #  include <GLES2/gl2.h>
42 # elif USE_OPENGL_ES == 1
43 #  include <GLES/gl.h>
44 # else
45 #  include <GL/gl.h>
46 # endif
47 #else
48 # if USE_OPENGL_ES == 2
49 #  include <OpenGLES/ES2/gl.h>
50 # elif USE_OPENGL_ES == 1
51 #  include <OpenGLES/ES1/gl.h>
52 # else
53 #  define MACOS_OPENGL
54 #  include <OpenGL/gl.h>
55 #  undef VLCGL_TEXTURE_COUNT
56 #  define VLCGL_TEXTURE_COUNT 2
57 # endif
58 #endif
59
60 typedef struct {
61     vlc_gl_t   *gl;
62
63     video_format_t fmt;
64
65     int        tex_pixel_size;
66     int        tex_width;
67     int        tex_height;
68
69     GLuint     texture[VLCGL_TEXTURE_COUNT];
70     uint8_t    *buffer[VLCGL_TEXTURE_COUNT];
71
72     picture_pool_t *pool;
73 } vout_display_opengl_t;
74
75 int vout_display_opengl_Init(vout_display_opengl_t *vgl,
76                              video_format_t *fmt, vlc_gl_t *gl);
77 void vout_display_opengl_Clean(vout_display_opengl_t *vgl);
78
79 int vout_display_opengl_ResetTextures(vout_display_opengl_t *vgl);
80 picture_pool_t *vout_display_opengl_GetPool(vout_display_opengl_t *vgl);
81
82 int vout_display_opengl_Prepare(vout_display_opengl_t *vgl,
83                                 picture_t *picture);
84 int vout_display_opengl_Display(vout_display_opengl_t *vgl,
85                                 const video_format_t *source);