Mercurial > mplayer.hg
annotate libvo/gl_common.h @ 36065:070c711825ea
Don't allow the URL dialog to be user-shrinkable.
Remove the policy and use the default.
author | ib |
---|---|
date | Thu, 04 Apr 2013 19:18:11 +0000 |
parents | 3be8afb83629 |
children | 55bd3eed6c9a |
rev | line source |
---|---|
28446
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28070
diff
changeset
|
1 /* |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28070
diff
changeset
|
2 * This file is part of MPlayer. |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28070
diff
changeset
|
3 * |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28070
diff
changeset
|
4 * MPlayer is free software; you can redistribute it and/or modify |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28070
diff
changeset
|
5 * it under the terms of the GNU General Public License as published by |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28070
diff
changeset
|
6 * the Free Software Foundation; either version 2 of the License, or |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28070
diff
changeset
|
7 * (at your option) any later version. |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28070
diff
changeset
|
8 * |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28070
diff
changeset
|
9 * MPlayer is distributed in the hope that it will be useful, |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28070
diff
changeset
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28070
diff
changeset
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28070
diff
changeset
|
12 * GNU General Public License for more details. |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28070
diff
changeset
|
13 * |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28070
diff
changeset
|
14 * You should have received a copy of the GNU General Public License along |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28070
diff
changeset
|
15 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28070
diff
changeset
|
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
31309
1a35ec7c45e0
Dual-license gl_common and vo_gl under the LGPL v2.1 or later as
reimar
parents:
31065
diff
changeset
|
17 * |
1a35ec7c45e0
Dual-license gl_common and vo_gl under the LGPL v2.1 or later as
reimar
parents:
31065
diff
changeset
|
18 * You can alternatively redistribute this file and/or |
1a35ec7c45e0
Dual-license gl_common and vo_gl under the LGPL v2.1 or later as
reimar
parents:
31065
diff
changeset
|
19 * modify it under the terms of the GNU Lesser General Public |
1a35ec7c45e0
Dual-license gl_common and vo_gl under the LGPL v2.1 or later as
reimar
parents:
31065
diff
changeset
|
20 * License as published by the Free Software Foundation; either |
1a35ec7c45e0
Dual-license gl_common and vo_gl under the LGPL v2.1 or later as
reimar
parents:
31065
diff
changeset
|
21 * version 2.1 of the License, or (at your option) any later version. |
28446
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28070
diff
changeset
|
22 */ |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28070
diff
changeset
|
23 |
26029 | 24 #ifndef MPLAYER_GL_COMMON_H |
25 #define MPLAYER_GL_COMMON_H | |
13653
799f81d3cb19
added gl_common for code used by both vo_gl.c and vo_gl2.c.
reimar
parents:
diff
changeset
|
26 |
26162
0585db9f5b32
Add missing header #includes to fix 'make checkheaders'.
diego
parents:
26029
diff
changeset
|
27 #include <stdio.h> |
26163
f3e72d1a2329
This header uses parts of stdint.h, so #include it.
diego
parents:
26162
diff
changeset
|
28 #include <stdint.h> |
26162
0585db9f5b32
Add missing header #includes to fix 'make checkheaders'.
diego
parents:
26029
diff
changeset
|
29 |
26203 | 30 #include "config.h" |
13843 | 31 #include "video_out.h" |
30108
0898adc64a6f
Extract functions to generate yuv->rgb matrices and lookup tables into a
reimar
parents:
30107
diff
changeset
|
32 #include "csputils.h" |
13843 | 33 |
30023 | 34 #ifdef CONFIG_GL_WIN32 |
14142
f0c1ee83b216
Improving gl2 under windows, moving some functionality to gl_common
reimar
parents:
14078
diff
changeset
|
35 #include <windows.h> |
f0c1ee83b216
Improving gl2 under windows, moving some functionality to gl_common
reimar
parents:
14078
diff
changeset
|
36 #include "w32_common.h" |
29938
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
37 #endif |
30023 | 38 #ifdef CONFIG_GL_X11 |
13843 | 39 #include <X11/Xlib.h> |
40 #include <GL/glx.h> | |
41 #include "x11_common.h" | |
42 #endif | |
34338 | 43 #ifdef CONFIG_GL_EGL_X11 |
44 #include <EGL/egl.h> | |
45 #include "x11_common.h" | |
46 #endif | |
35089
a87c434ecaa3
Allow compiling -vo gl with OSX backend even if X11 and SDL are not available.
reimar
parents:
35087
diff
changeset
|
47 #ifdef CONFIG_GL_OSX |
35087 | 48 #include "osx_common.h" |
35811 | 49 #include <OpenGL/gl.h> |
35889 | 50 #elif defined(CONFIG_GL_EGL_ANDROID) |
51 #include <EGL/egl.h> | |
52 #include <GLES/gl.h> | |
35089
a87c434ecaa3
Allow compiling -vo gl with OSX backend even if X11 and SDL are not available.
reimar
parents:
35087
diff
changeset
|
53 #else |
a87c434ecaa3
Allow compiling -vo gl with OSX backend even if X11 and SDL are not available.
reimar
parents:
35087
diff
changeset
|
54 #include <GL/gl.h> |
35087 | 55 #endif |
13653
799f81d3cb19
added gl_common for code used by both vo_gl.c and vo_gl2.c.
reimar
parents:
diff
changeset
|
56 |
35886
4921bccc0968
Split out defines for compatibility between different GL headers.
reimar
parents:
35811
diff
changeset
|
57 #include "gl_compat.h" |
16099 | 58 |
13653
799f81d3cb19
added gl_common for code used by both vo_gl.c and vo_gl2.c.
reimar
parents:
diff
changeset
|
59 void glAdjustAlignment(int stride); |
799f81d3cb19
added gl_common for code used by both vo_gl.c and vo_gl2.c.
reimar
parents:
diff
changeset
|
60 |
14078
c4033dcb986f
More similar code from gl and gl2 moved to gl_common
reimar
parents:
13921
diff
changeset
|
61 const char *glValName(GLint value); |
c4033dcb986f
More similar code from gl and gl2 moved to gl_common
reimar
parents:
13921
diff
changeset
|
62 |
16879
6ea220b10e8e
More consistent and sane types. Also avoids some gcc 4 warnings.
reimar
parents:
16625
diff
changeset
|
63 int glFindFormat(uint32_t format, int *bpp, GLint *gl_texfmt, |
14078
c4033dcb986f
More similar code from gl and gl2 moved to gl_common
reimar
parents:
13921
diff
changeset
|
64 GLenum *gl_format, GLenum *gl_type); |
16117 | 65 int glFmt2bpp(GLenum format, GLenum type); |
27621
53b5cf466361
Change glCreateClearTex to use the same host data format as later uploads.
reimar
parents:
27306
diff
changeset
|
66 void glCreateClearTex(GLenum target, GLenum fmt, GLenum format, GLenum type, GLint filter, |
16460 | 67 int w, int h, unsigned char val); |
16592 | 68 int glCreatePPMTex(GLenum target, GLenum fmt, GLint filter, |
69 FILE *f, int *width, int *height, int *maxval); | |
16117 | 70 void glUploadTex(GLenum target, GLenum format, GLenum type, |
21201 | 71 const void *dataptr, int stride, |
16117 | 72 int x, int y, int w, int h, int slice); |
16214
ede5b4afd262
Helper function for drawing texture and general cleanup of vo_gl2.c
reimar
parents:
16117
diff
changeset
|
73 void glDrawTex(GLfloat x, GLfloat y, GLfloat w, GLfloat h, |
ede5b4afd262
Helper function for drawing texture and general cleanup of vo_gl2.c
reimar
parents:
16117
diff
changeset
|
74 GLfloat tx, GLfloat ty, GLfloat tw, GLfloat th, |
34983
0034a2bf7b42
Support interleaving the two frame halves from a 3D video
reimar
parents:
34973
diff
changeset
|
75 int sx, int sy, int rect_tex, int is_yv12, int flip, |
0034a2bf7b42
Support interleaving the two frame halves from a 3D video
reimar
parents:
34973
diff
changeset
|
76 int use_stipple); |
18653
5af43a16abc3
loadGPUProgram function to load fragment program with error checking and statistics
reimar
parents:
18622
diff
changeset
|
77 int loadGPUProgram(GLenum target, char *prog); |
16488
3191dcb27a12
hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
16460
diff
changeset
|
78 |
16595
b3a9fb41f475
fix/improve code doxumentation. Also group gl_common functions in several
reimar
parents:
16592
diff
changeset
|
79 /** \addtogroup glconversion |
b3a9fb41f475
fix/improve code doxumentation. Also group gl_common functions in several
reimar
parents:
16592
diff
changeset
|
80 * \{ */ |
16488
3191dcb27a12
hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
16460
diff
changeset
|
81 //! do not use YUV conversion, this should always stay 0 |
3191dcb27a12
hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
16460
diff
changeset
|
82 #define YUV_CONVERSION_NONE 0 |
3191dcb27a12
hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
16460
diff
changeset
|
83 //! use nVidia specific register combiners for YUV conversion |
3191dcb27a12
hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
16460
diff
changeset
|
84 #define YUV_CONVERSION_COMBINERS 1 |
3191dcb27a12
hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
16460
diff
changeset
|
85 //! use a fragment program for YUV conversion |
3191dcb27a12
hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
16460
diff
changeset
|
86 #define YUV_CONVERSION_FRAGMENT 2 |
3191dcb27a12
hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
16460
diff
changeset
|
87 //! use a fragment program for YUV conversion with gamma using POW |
3191dcb27a12
hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
16460
diff
changeset
|
88 #define YUV_CONVERSION_FRAGMENT_POW 3 |
3191dcb27a12
hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
16460
diff
changeset
|
89 //! use a fragment program with additional table lookup for YUV conversion |
3191dcb27a12
hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
16460
diff
changeset
|
90 #define YUV_CONVERSION_FRAGMENT_LOOKUP 4 |
16625 | 91 //! use ATI specific register combiners ("fragment program") |
92 #define YUV_CONVERSION_COMBINERS_ATI 5 | |
18655
6aa0b26d584b
Add yuv to rgb conversion using a 3D lookup texture
reimar
parents:
18653
diff
changeset
|
93 //! use a fragment program with 3D table lookup for YUV conversion |
6aa0b26d584b
Add yuv to rgb conversion using a 3D lookup texture
reimar
parents:
18653
diff
changeset
|
94 #define YUV_CONVERSION_FRAGMENT_LOOKUP3D 6 |
30951
e76a4f6bfc8d
Implement OpenGL-based YUV to RGB version for Radeon 9200 class
reimar
parents:
30945
diff
changeset
|
95 //! use ATI specific "text" register combiners ("fragment program") |
e76a4f6bfc8d
Implement OpenGL-based YUV to RGB version for Radeon 9200 class
reimar
parents:
30945
diff
changeset
|
96 #define YUV_CONVERSION_TEXT_FRAGMENT 7 |
18619
106a0c366002
Reworked YUV2RGB fragment program setup in preparation for upcoming patches
reimar
parents:
18578
diff
changeset
|
97 //! use normal bilinear scaling for textures |
106a0c366002
Reworked YUV2RGB fragment program setup in preparation for upcoming patches
reimar
parents:
18578
diff
changeset
|
98 #define YUV_SCALER_BILIN 0 |
18622 | 99 //! use higher quality bicubic scaling for textures |
100 #define YUV_SCALER_BICUB 1 | |
22491 | 101 //! use cubic scaling in X and normal linear scaling in Y direction |
102 #define YUV_SCALER_BICUB_X 2 | |
24318
e6e8bf060dae
Add a bicubic scaler that needs a lot more instruction but no
reimar
parents:
23689
diff
changeset
|
103 //! use cubic scaling without additional lookup texture |
e6e8bf060dae
Add a bicubic scaler that needs a lot more instruction but no
reimar
parents:
23689
diff
changeset
|
104 #define YUV_SCALER_BICUB_NOTEX 3 |
25729
9a96fd14d1c5
Add experimental unsharp-mask OpenGL scaler. Certainly not yet perfect.
reimar
parents:
25535
diff
changeset
|
105 #define YUV_SCALER_UNSHARP 4 |
25758 | 106 #define YUV_SCALER_UNSHARP2 5 |
18619
106a0c366002
Reworked YUV2RGB fragment program setup in preparation for upcoming patches
reimar
parents:
18578
diff
changeset
|
107 //! mask for conversion type |
106a0c366002
Reworked YUV2RGB fragment program setup in preparation for upcoming patches
reimar
parents:
18578
diff
changeset
|
108 #define YUV_CONVERSION_MASK 0xF |
106a0c366002
Reworked YUV2RGB fragment program setup in preparation for upcoming patches
reimar
parents:
18578
diff
changeset
|
109 //! mask for scaler type |
106a0c366002
Reworked YUV2RGB fragment program setup in preparation for upcoming patches
reimar
parents:
18578
diff
changeset
|
110 #define YUV_SCALER_MASK 0xF |
106a0c366002
Reworked YUV2RGB fragment program setup in preparation for upcoming patches
reimar
parents:
18578
diff
changeset
|
111 //! shift value for luminance scaler type |
106a0c366002
Reworked YUV2RGB fragment program setup in preparation for upcoming patches
reimar
parents:
18578
diff
changeset
|
112 #define YUV_LUM_SCALER_SHIFT 8 |
106a0c366002
Reworked YUV2RGB fragment program setup in preparation for upcoming patches
reimar
parents:
18578
diff
changeset
|
113 //! shift value for chrominance scaler type |
106a0c366002
Reworked YUV2RGB fragment program setup in preparation for upcoming patches
reimar
parents:
18578
diff
changeset
|
114 #define YUV_CHROM_SCALER_SHIFT 12 |
106a0c366002
Reworked YUV2RGB fragment program setup in preparation for upcoming patches
reimar
parents:
18578
diff
changeset
|
115 //! extract conversion out of type |
31675 | 116 #define YUV_CONVERSION(t) ((t) & YUV_CONVERSION_MASK) |
18619
106a0c366002
Reworked YUV2RGB fragment program setup in preparation for upcoming patches
reimar
parents:
18578
diff
changeset
|
117 //! extract luminance scaler out of type |
31675 | 118 #define YUV_LUM_SCALER(t) (((t) >> YUV_LUM_SCALER_SHIFT) & YUV_SCALER_MASK) |
18619
106a0c366002
Reworked YUV2RGB fragment program setup in preparation for upcoming patches
reimar
parents:
18578
diff
changeset
|
119 //! extract chrominance scaler out of type |
31675 | 120 #define YUV_CHROM_SCALER(t) (((t) >> YUV_CHROM_SCALER_SHIFT) & YUV_SCALER_MASK) |
31676
a0a48c62bb8c
Helper macros to build the yuv conversion type number.
reimar
parents:
31675
diff
changeset
|
121 #define SET_YUV_CONVERSION(c) ((c) & YUV_CONVERSION_MASK) |
a0a48c62bb8c
Helper macros to build the yuv conversion type number.
reimar
parents:
31675
diff
changeset
|
122 #define SET_YUV_LUM_SCALER(s) (((s) & YUV_SCALER_MASK) << YUV_LUM_SCALER_SHIFT) |
a0a48c62bb8c
Helper macros to build the yuv conversion type number.
reimar
parents:
31675
diff
changeset
|
123 #define SET_YUV_CHROM_SCALER(s) (((s) & YUV_SCALER_MASK) << YUV_CHROM_SCALER_SHIFT) |
33414 | 124 //! returns whether the yuv conversion supports large brightness range etc. |
125 static inline int glYUVLargeRange(int conv) | |
126 { | |
127 switch (conv) | |
128 { | |
129 case YUV_CONVERSION_NONE: | |
130 case YUV_CONVERSION_COMBINERS: | |
131 case YUV_CONVERSION_COMBINERS_ATI: | |
132 case YUV_CONVERSION_FRAGMENT_LOOKUP3D: | |
133 case YUV_CONVERSION_TEXT_FRAGMENT: | |
134 return 0; | |
135 } | |
136 return 1; | |
137 } | |
34983
0034a2bf7b42
Support interleaving the two frame halves from a 3D video
reimar
parents:
34973
diff
changeset
|
138 |
0034a2bf7b42
Support interleaving the two frame halves from a 3D video
reimar
parents:
34973
diff
changeset
|
139 static inline int glYUVSupportsAlphaTex(int conv) |
0034a2bf7b42
Support interleaving the two frame halves from a 3D video
reimar
parents:
34973
diff
changeset
|
140 { |
0034a2bf7b42
Support interleaving the two frame halves from a 3D video
reimar
parents:
34973
diff
changeset
|
141 switch (conv) |
0034a2bf7b42
Support interleaving the two frame halves from a 3D video
reimar
parents:
34973
diff
changeset
|
142 { |
0034a2bf7b42
Support interleaving the two frame halves from a 3D video
reimar
parents:
34973
diff
changeset
|
143 case YUV_CONVERSION_COMBINERS: |
0034a2bf7b42
Support interleaving the two frame halves from a 3D video
reimar
parents:
34973
diff
changeset
|
144 case YUV_CONVERSION_COMBINERS_ATI: |
0034a2bf7b42
Support interleaving the two frame halves from a 3D video
reimar
parents:
34973
diff
changeset
|
145 case YUV_CONVERSION_TEXT_FRAGMENT: |
0034a2bf7b42
Support interleaving the two frame halves from a 3D video
reimar
parents:
34973
diff
changeset
|
146 return 0; |
0034a2bf7b42
Support interleaving the two frame halves from a 3D video
reimar
parents:
34973
diff
changeset
|
147 } |
0034a2bf7b42
Support interleaving the two frame halves from a 3D video
reimar
parents:
34973
diff
changeset
|
148 return 1; |
0034a2bf7b42
Support interleaving the two frame halves from a 3D video
reimar
parents:
34973
diff
changeset
|
149 } |
16595
b3a9fb41f475
fix/improve code doxumentation. Also group gl_common functions in several
reimar
parents:
16592
diff
changeset
|
150 /** \} */ |
30107
11e3ee8cd05e
Put the colourspace-related variables into a separate struct to ease
reimar
parents:
30097
diff
changeset
|
151 |
11e3ee8cd05e
Put the colourspace-related variables into a separate struct to ease
reimar
parents:
30097
diff
changeset
|
152 typedef struct { |
11e3ee8cd05e
Put the colourspace-related variables into a separate struct to ease
reimar
parents:
30097
diff
changeset
|
153 GLenum target; |
11e3ee8cd05e
Put the colourspace-related variables into a separate struct to ease
reimar
parents:
30097
diff
changeset
|
154 int type; |
11e3ee8cd05e
Put the colourspace-related variables into a separate struct to ease
reimar
parents:
30097
diff
changeset
|
155 struct mp_csp_params csp_params; |
26835 | 156 int texw; |
157 int texh; | |
30097 | 158 int chrom_texw; |
159 int chrom_texh; | |
26836
ba086caf1230
Add a filter strength parameter for blurring/sharpening scalers.
reimar
parents:
26835
diff
changeset
|
160 float filter_strength; |
33927 | 161 float noise_strength; |
34983
0034a2bf7b42
Support interleaving the two frame halves from a 3D video
reimar
parents:
34973
diff
changeset
|
162 int has_alpha_tex; |
26835 | 163 } gl_conversion_params_t; |
164 | |
30964
a5c6b37b3af6
Factor out the YUV->RGB conversion auto-selection and also
reimar
parents:
30951
diff
changeset
|
165 int glAutodetectYUVConversion(void); |
26835 | 166 void glSetupYUVConversion(gl_conversion_params_t *params); |
18175
01ca8a5fb8a6
minor fixes: get rid of pointless inline attributes and some additional checks
reimar
parents:
17688
diff
changeset
|
167 void glEnableYUVConversion(GLenum target, int type); |
01ca8a5fb8a6
minor fixes: get rid of pointless inline attributes and some additional checks
reimar
parents:
17688
diff
changeset
|
168 void glDisableYUVConversion(GLenum target, int type); |
14078
c4033dcb986f
More similar code from gl and gl2 moved to gl_common
reimar
parents:
13921
diff
changeset
|
169 |
34375 | 170 #define GL_3D_SWAP 32 |
31567 | 171 #define GL_3D_RED_CYAN 1 |
172 #define GL_3D_GREEN_MAGENTA 2 | |
173 #define GL_3D_QUADBUFFER 3 | |
34983
0034a2bf7b42
Support interleaving the two frame halves from a 3D video
reimar
parents:
34973
diff
changeset
|
174 #define GL_3D_STIPPLE 4 |
31567 | 175 |
34983
0034a2bf7b42
Support interleaving the two frame halves from a 3D video
reimar
parents:
34973
diff
changeset
|
176 void glSetupAlphaStippleTex(unsigned pattern); |
31567 | 177 void glEnable3DLeft(int type); |
178 void glEnable3DRight(int type); | |
179 void glDisable3D(int type); | |
180 | |
16595
b3a9fb41f475
fix/improve code doxumentation. Also group gl_common functions in several
reimar
parents:
16592
diff
changeset
|
181 /** \addtogroup glcontext |
b3a9fb41f475
fix/improve code doxumentation. Also group gl_common functions in several
reimar
parents:
16592
diff
changeset
|
182 * \{ */ |
13843 | 183 //! could not set new window, will continue drawing into the old one. |
184 #define SET_WINDOW_FAILED -1 | |
185 //! new window is set, could even transfer the OpenGL context. | |
186 #define SET_WINDOW_OK 0 | |
187 //! new window is set, but the OpenGL context needs to be reinitialized. | |
188 #define SET_WINDOW_REINIT 1 | |
16595
b3a9fb41f475
fix/improve code doxumentation. Also group gl_common functions in several
reimar
parents:
16592
diff
changeset
|
189 /** \} */ |
13843 | 190 |
29938
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
191 enum MPGLType { |
34350
27dead7f2593
Add a suboption to allow forcing use of e.g. OpenGL ES to -vo gl.
reimar
parents:
34338
diff
changeset
|
192 GLTYPE_AUTO = -1, |
29938
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
193 GLTYPE_W32, |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
194 GLTYPE_X11, |
31020
529614f44431
First steps to support -vo gl with SDL-based Window handling.
reimar
parents:
30985
diff
changeset
|
195 GLTYPE_SDL, |
34338 | 196 GLTYPE_EGL_X11, |
35087 | 197 GLTYPE_OSX, |
35889 | 198 GLTYPE_EGL_ANDROID, |
34350
27dead7f2593
Add a suboption to allow forcing use of e.g. OpenGL ES to -vo gl.
reimar
parents:
34338
diff
changeset
|
199 GLTYPE_COUNT |
29938
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
200 }; |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
201 |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
202 typedef struct MPGLContext { |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
203 enum MPGLType type; |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
204 union { |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
205 int w32; |
30023 | 206 #ifdef CONFIG_GL_X11 |
29938
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
207 XVisualInfo *x11; |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
208 #endif |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
209 } vinfo; |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
210 union { |
30023 | 211 #ifdef CONFIG_GL_WIN32 |
29938
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
212 HGLRC w32; |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
213 #endif |
30023 | 214 #ifdef CONFIG_GL_X11 |
29938
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
215 GLXContext x11; |
13653
799f81d3cb19
added gl_common for code used by both vo_gl.c and vo_gl2.c.
reimar
parents:
diff
changeset
|
216 #endif |
35889 | 217 #if defined(CONFIG_GL_EGL_X11) || defined(CONFIG_GL_EGL_ANDROID) |
34338 | 218 EGLContext egl; |
219 #endif | |
29938
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
220 } context; |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
221 int (*setGlWindow)(struct MPGLContext *); |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
222 void (*releaseGlContext)(struct MPGLContext *); |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
223 void (*swapGlBuffers)(struct MPGLContext *); |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
224 void (*update_xinerama_info)(void); |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
225 void (*border)(void); |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
226 int (*check_events)(void); |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
227 void (*fullscreen)(void); |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
228 void (*ontop)(void); |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
229 } MPGLContext; |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
230 |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
231 int init_mpglcontext(MPGLContext *ctx, enum MPGLType type); |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
232 void uninit_mpglcontext(MPGLContext *ctx); |
13843 | 233 |
34841 | 234 extern GLenum (GLAPIENTRY *mpglGetError)(void); |
30945
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
235 extern void (GLAPIENTRY *mpglBegin)(GLenum); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
236 extern void (GLAPIENTRY *mpglEnd)(void); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
237 extern void (GLAPIENTRY *mpglViewport)(GLint, GLint, GLsizei, GLsizei); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
238 extern void (GLAPIENTRY *mpglMatrixMode)(GLenum); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
239 extern void (GLAPIENTRY *mpglLoadIdentity)(void); |
34337
f8c523d09e5e
Use glLoadMatrixf. This makes it easier to support OpenGL ES.
reimar
parents:
34174
diff
changeset
|
240 extern void (GLAPIENTRY *mpglLoadMatrixf)(float *); |
30945
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
241 extern void (GLAPIENTRY *mpglPushMatrix)(void); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
242 extern void (GLAPIENTRY *mpglPopMatrix)(void); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
243 extern void (GLAPIENTRY *mpglClear)(GLbitfield); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
244 extern GLuint (GLAPIENTRY *mpglGenLists)(GLsizei); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
245 extern void (GLAPIENTRY *mpglDeleteLists)(GLuint, GLsizei); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
246 extern void (GLAPIENTRY *mpglNewList)(GLuint, GLenum); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
247 extern void (GLAPIENTRY *mpglEndList)(void); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
248 extern void (GLAPIENTRY *mpglCallList)(GLuint); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
249 extern void (GLAPIENTRY *mpglCallLists)(GLsizei, GLenum, const GLvoid *); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
250 extern void (GLAPIENTRY *mpglGenTextures)(GLsizei, GLuint *); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
251 extern void (GLAPIENTRY *mpglDeleteTextures)(GLsizei, const GLuint *); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
252 extern void (GLAPIENTRY *mpglTexEnvf)(GLenum, GLenum, GLfloat); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
253 extern void (GLAPIENTRY *mpglTexEnvi)(GLenum, GLenum, GLint); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
254 extern void (GLAPIENTRY *mpglColor4ub)(GLubyte, GLubyte, GLubyte, GLubyte); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
255 extern void (GLAPIENTRY *mpglColor4f)(GLfloat, GLfloat, GLfloat, GLfloat); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
256 extern void (GLAPIENTRY *mpglClearColor)(GLclampf, GLclampf, GLclampf, GLclampf); |
35890 | 257 extern void (GLAPIENTRY *mpglClearDepth)(double); |
30945
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
258 extern void (GLAPIENTRY *mpglDepthFunc)(GLenum); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
259 extern void (GLAPIENTRY *mpglEnable)(GLenum); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
260 extern void (GLAPIENTRY *mpglDisable)(GLenum); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
261 extern const GLubyte *(GLAPIENTRY *mpglGetString)(GLenum); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
262 extern void (GLAPIENTRY *mpglDrawBuffer)(GLenum); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
263 extern void (GLAPIENTRY *mpglDepthMask)(GLboolean); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
264 extern void (GLAPIENTRY *mpglBlendFunc)(GLenum, GLenum); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
265 extern void (GLAPIENTRY *mpglFlush)(void); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
266 extern void (GLAPIENTRY *mpglFinish)(void); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
267 extern void (GLAPIENTRY *mpglPixelStorei)(GLenum, GLint); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
268 extern void (GLAPIENTRY *mpglTexImage1D)(GLenum, GLint, GLint, GLsizei, GLint, GLenum, GLenum, const GLvoid *); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
269 extern void (GLAPIENTRY *mpglTexImage2D)(GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
270 extern void (GLAPIENTRY *mpglTexSubImage2D)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
271 extern void (GLAPIENTRY *mpglTexParameteri)(GLenum, GLenum, GLint); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
272 extern void (GLAPIENTRY *mpglTexParameterf)(GLenum, GLenum, GLfloat); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
273 extern void (GLAPIENTRY *mpglTexParameterfv)(GLenum, GLenum, const GLfloat *); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
274 extern void (GLAPIENTRY *mpglTexCoord2f)(GLfloat, GLfloat); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
275 extern void (GLAPIENTRY *mpglVertex2f)(GLfloat, GLfloat); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
276 extern void (GLAPIENTRY *mpglVertex3f)(GLfloat, GLfloat, GLfloat); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
277 extern void (GLAPIENTRY *mpglNormal3f)(GLfloat, GLfloat, GLfloat); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
278 extern void (GLAPIENTRY *mpglLightfv)(GLenum, GLenum, const GLfloat *); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
279 extern void (GLAPIENTRY *mpglColorMaterial)(GLenum, GLenum); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
280 extern void (GLAPIENTRY *mpglShadeModel)(GLenum); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
281 extern void (GLAPIENTRY *mpglGetIntegerv)(GLenum, GLint *); |
31567 | 282 extern void (GLAPIENTRY *mpglColorMask)(GLboolean, GLboolean, GLboolean, GLboolean); |
29939
319b62d55feb
Pass all OpenGL functions through a function pointer indirection.
reimar
parents:
29938
diff
changeset
|
283 |
30945
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
284 extern void (GLAPIENTRY *mpglGenBuffers)(GLsizei, GLuint *); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
285 extern void (GLAPIENTRY *mpglDeleteBuffers)(GLsizei, const GLuint *); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
286 extern void (GLAPIENTRY *mpglBindBuffer)(GLenum, GLuint); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
287 extern GLvoid* (GLAPIENTRY *mpglMapBuffer)(GLenum, GLenum); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
288 extern GLboolean (GLAPIENTRY *mpglUnmapBuffer)(GLenum); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
289 extern void (GLAPIENTRY *mpglBufferData)(GLenum, intptr_t, const GLvoid *, GLenum); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
290 extern void (GLAPIENTRY *mpglCombinerParameterfv)(GLenum, const GLfloat *); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
291 extern void (GLAPIENTRY *mpglCombinerParameteri)(GLenum, GLint); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
292 extern void (GLAPIENTRY *mpglCombinerInput)(GLenum, GLenum, GLenum, GLenum, GLenum, |
16099 | 293 GLenum); |
30945
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
294 extern void (GLAPIENTRY *mpglCombinerOutput)(GLenum, GLenum, GLenum, GLenum, GLenum, |
16099 | 295 GLenum, GLenum, GLboolean, GLboolean, |
296 GLboolean); | |
30945
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
297 extern void (GLAPIENTRY *mpglBeginFragmentShader)(void); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
298 extern void (GLAPIENTRY *mpglEndFragmentShader)(void); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
299 extern void (GLAPIENTRY *mpglSampleMap)(GLuint, GLuint, GLenum); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
300 extern void (GLAPIENTRY *mpglColorFragmentOp2)(GLenum, GLuint, GLuint, GLuint, GLuint, |
16625 | 301 GLuint, GLuint, GLuint, GLuint, GLuint); |
30945
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
302 extern void (GLAPIENTRY *mpglColorFragmentOp3)(GLenum, GLuint, GLuint, GLuint, GLuint, |
16625 | 303 GLuint, GLuint, GLuint, GLuint, GLuint, |
304 GLuint, GLuint, GLuint); | |
30945
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
305 extern void (GLAPIENTRY *mpglSetFragmentShaderConstant)(GLuint, const GLfloat *); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
306 extern void (GLAPIENTRY *mpglActiveTexture)(GLenum); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
307 extern void (GLAPIENTRY *mpglBindTexture)(GLenum, GLuint); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
308 extern void (GLAPIENTRY *mpglMultiTexCoord2f)(GLenum, GLfloat, GLfloat); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
309 extern void (GLAPIENTRY *mpglGenPrograms)(GLsizei, GLuint *); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
310 extern void (GLAPIENTRY *mpglDeletePrograms)(GLsizei, const GLuint *); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
311 extern void (GLAPIENTRY *mpglBindProgram)(GLenum, GLuint); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
312 extern void (GLAPIENTRY *mpglProgramString)(GLenum, GLenum, GLsizei, const GLvoid *); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
313 extern void (GLAPIENTRY *mpglProgramEnvParameter4f)(GLenum, GLuint, GLfloat, GLfloat, |
16099 | 314 GLfloat, GLfloat); |
30945
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
315 extern int (GLAPIENTRY *mpglSwapInterval)(int); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
316 extern void (GLAPIENTRY *mpglTexImage3D)(GLenum, GLint, GLenum, GLsizei, GLsizei, |
18578 | 317 GLsizei, GLint, GLenum, GLenum, const GLvoid *); |
30945
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
318 extern void* (GLAPIENTRY *mpglAllocateMemoryMESA)(void *, int, size_t, float, float, float); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
319 extern void (GLAPIENTRY *mpglFreeMemoryMESA)(void *, int, void *); |
16099 | 320 |
26029 | 321 #endif /* MPLAYER_GL_COMMON_H */ |