gl_common: slightly change win32 GL 3 context creation
[mplayer.git] / libvo / gl_common.h
blobef394f82d5ea740e8aec7435386f489268f153a3
1 /*
2 * This file is part of MPlayer.
4 * MPlayer is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * MPlayer is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 * You can alternatively redistribute this file and/or
19 * modify it under the terms of the GNU Lesser General Public
20 * License as published by the Free Software Foundation; either
21 * version 2.1 of the License, or (at your option) any later version.
24 #ifndef MPLAYER_GL_COMMON_H
25 #define MPLAYER_GL_COMMON_H
27 #include <stdio.h>
28 #include <stdint.h>
30 #include "config.h"
31 #include "mp_msg.h"
33 #include "video_out.h"
34 #include "csputils.h"
36 #ifdef CONFIG_GL_WIN32
37 #include <windows.h>
38 #include "w32_common.h"
39 #endif
40 #ifdef CONFIG_GL_X11
41 #include <X11/Xlib.h>
42 #include <GL/glx.h>
43 #include "x11_common.h"
44 // This old-vo wrapper macro would conflict with the struct member
45 #undef update_xinerama_info
46 #endif
48 #if defined(CONFIG_GL_COCOA) && !defined(CONFIG_GL_X11)
49 #include <OpenGL/gl.h>
50 #else
51 #include <GL/gl.h>
52 #endif
54 #ifdef CONFIG_GL_WIN32
55 #include <GL/glext.h>
56 #endif
58 // workaround for some gl.h headers
59 #ifndef GLAPIENTRY
60 #ifdef APIENTRY
61 #define GLAPIENTRY APIENTRY
62 #elif defined(CONFIG_GL_WIN32)
63 #define GLAPIENTRY __stdcall
64 #else
65 #define GLAPIENTRY
66 #endif
67 #endif
69 /**
70 * \defgroup glextdefines OpenGL extension defines
72 * conditionally define all extension defines used.
73 * vendor specific extensions should be marked as such
74 * (e.g. _NV), _ARB is not used to ease readability.
75 * \{
77 #ifndef GL_TEXTURE_3D
78 #define GL_TEXTURE_3D 0x806F
79 #endif
80 #ifndef GL_TEXTURE_WRAP_R
81 #define GL_TEXTURE_WRAP_R 0x8072
82 #endif
83 #ifndef GL_CLAMP_TO_EDGE
84 #define GL_CLAMP_TO_EDGE 0x812F
85 #endif
86 #ifndef GL_GENERATE_MIPMAP
87 #define GL_GENERATE_MIPMAP 0x8191
88 #endif
89 #ifndef GL_TEXT_FRAGMENT_SHADER_ATI
90 #define GL_TEXT_FRAGMENT_SHADER_ATI 0x8200
91 #endif
92 #ifndef GL_FRAGMENT_SHADER_ATI
93 #define GL_FRAGMENT_SHADER_ATI 0x8920
94 #endif
95 #ifndef GL_NUM_FRAGMENT_REGISTERS_ATI
96 #define GL_NUM_FRAGMENT_REGISTERS_ATI 0x896E
97 #endif
98 #ifndef GL_REG_0_ATI
99 #define GL_REG_0_ATI 0x8921
100 #endif
101 #ifndef GL_REG_1_ATI
102 #define GL_REG_1_ATI 0x8922
103 #endif
104 #ifndef GL_REG_2_ATI
105 #define GL_REG_2_ATI 0x8923
106 #endif
107 #ifndef GL_CON_0_ATI
108 #define GL_CON_0_ATI 0x8941
109 #endif
110 #ifndef GL_CON_1_ATI
111 #define GL_CON_1_ATI 0x8942
112 #endif
113 #ifndef GL_CON_2_ATI
114 #define GL_CON_2_ATI 0x8943
115 #endif
116 #ifndef GL_CON_3_ATI
117 #define GL_CON_3_ATI 0x8944
118 #endif
119 #ifndef GL_ADD_ATI
120 #define GL_ADD_ATI 0x8963
121 #endif
122 #ifndef GL_MUL_ATI
123 #define GL_MUL_ATI 0x8964
124 #endif
125 #ifndef GL_MAD_ATI
126 #define GL_MAD_ATI 0x8968
127 #endif
128 #ifndef GL_SWIZZLE_STR_ATI
129 #define GL_SWIZZLE_STR_ATI 0x8976
130 #endif
131 #ifndef GL_4X_BIT_ATI
132 #define GL_4X_BIT_ATI 2
133 #endif
134 #ifndef GL_8X_BIT_ATI
135 #define GL_8X_BIT_ATI 4
136 #endif
137 #ifndef GL_BIAS_BIT_ATI
138 #define GL_BIAS_BIT_ATI 8
139 #endif
140 #ifndef GL_MAX_TEXTURE_UNITS
141 #define GL_MAX_TEXTURE_UNITS 0x84E2
142 #endif
143 #ifndef GL_TEXTURE0
144 #define GL_TEXTURE0 0x84C0
145 #endif
146 #ifndef GL_TEXTURE1
147 #define GL_TEXTURE1 0x84C1
148 #endif
149 #ifndef GL_TEXTURE2
150 #define GL_TEXTURE2 0x84C2
151 #endif
152 #ifndef GL_TEXTURE3
153 #define GL_TEXTURE3 0x84C3
154 #endif
155 #ifndef GL_TEXTURE_RECTANGLE
156 #define GL_TEXTURE_RECTANGLE 0x84F5
157 #endif
158 #ifndef GL_PIXEL_UNPACK_BUFFER
159 #define GL_PIXEL_UNPACK_BUFFER 0x88EC
160 #endif
161 #ifndef GL_STREAM_DRAW
162 #define GL_STREAM_DRAW 0x88E0
163 #endif
164 #ifndef GL_DYNAMIC_DRAW
165 #define GL_DYNAMIC_DRAW 0x88E8
166 #endif
167 #ifndef GL_WRITE_ONLY
168 #define GL_WRITE_ONLY 0x88B9
169 #endif
170 #ifndef GL_BGR
171 #define GL_BGR 0x80E0
172 #endif
173 #ifndef GL_BGRA
174 #define GL_BGRA 0x80E1
175 #endif
176 #ifndef GL_UNSIGNED_BYTE_3_3_2
177 #define GL_UNSIGNED_BYTE_3_3_2 0x8032
178 #endif
179 #ifndef GL_UNSIGNED_BYTE_2_3_3_REV
180 #define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362
181 #endif
182 #ifndef GL_UNSIGNED_SHORT_4_4_4_4
183 #define GL_UNSIGNED_SHORT_4_4_4_4 0x8033
184 #endif
185 #ifndef GL_UNSIGNED_SHORT_4_4_4_4_REV
186 #define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365
187 #endif
188 #ifndef GL_UNSIGNED_SHORT_5_6_5
189 #define GL_UNSIGNED_SHORT_5_6_5 0x8363
190 #endif
191 #ifndef GL_UNSIGNED_INT_8_8_8_8
192 #define GL_UNSIGNED_INT_8_8_8_8 0x8035
193 #endif
194 #ifndef GL_UNSIGNED_INT_8_8_8_8_REV
195 #define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367
196 #endif
197 #ifndef GL_UNSIGNED_SHORT_5_6_5_REV
198 #define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364
199 #endif
200 #ifndef GL_UNSIGNED_INT_10_10_10_2
201 #define GL_UNSIGNED_INT_10_10_10_2 0x8036
202 #endif
203 #ifndef GL_UNSIGNED_INT_2_10_10_10_REV
204 #define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368
205 #endif
206 #ifndef GL_UNSIGNED_SHORT_5_5_5_1
207 #define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
208 #endif
209 #ifndef GL_UNSIGNED_SHORT_1_5_5_5_REV
210 #define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366
211 #endif
212 #ifndef GL_UNSIGNED_SHORT_8_8
213 #define GL_UNSIGNED_SHORT_8_8 0x85BA
214 #endif
215 #ifndef GL_UNSIGNED_SHORT_8_8_REV
216 #define GL_UNSIGNED_SHORT_8_8_REV 0x85BB
217 #endif
218 #ifndef GL_YCBCR_MESA
219 #define GL_YCBCR_MESA 0x8757
220 #endif
221 #ifndef GL_RGB32F
222 #define GL_RGB32F 0x8815
223 #endif
224 #ifndef GL_FLOAT_RGB32_NV
225 #define GL_FLOAT_RGB32_NV 0x8889
226 #endif
227 #ifndef GL_LUMINANCE16
228 #define GL_LUMINANCE16 0x8042
229 #endif
230 #ifndef GL_R16
231 #define GL_R16 0x822A
232 #endif
233 #ifndef GL_UNPACK_CLIENT_STORAGE_APPLE
234 #define GL_UNPACK_CLIENT_STORAGE_APPLE 0x85B2
235 #endif
236 #ifndef GL_FRAGMENT_PROGRAM
237 #define GL_FRAGMENT_PROGRAM 0x8804
238 #endif
239 #ifndef GL_PROGRAM_FORMAT_ASCII
240 #define GL_PROGRAM_FORMAT_ASCII 0x8875
241 #endif
242 #ifndef GL_PROGRAM_ERROR_POSITION
243 #define GL_PROGRAM_ERROR_POSITION 0x864B
244 #endif
245 #ifndef GL_MAX_TEXTURE_IMAGE_UNITS
246 #define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872
247 #endif
248 #ifndef GL_PROGRAM_ERROR_STRING
249 #define GL_PROGRAM_ERROR_STRING 0x8874
250 #endif
251 /** \} */ // end of glextdefines group
253 struct GL;
254 typedef struct GL GL;
256 void glAdjustAlignment(GL *gl, int stride);
258 const char *glValName(GLint value);
260 int glFindFormat(uint32_t format, int have_texture_rg, int *bpp,
261 GLint *gl_texfmt, GLenum *gl_format, GLenum *gl_type);
262 int glFmt2bpp(GLenum format, GLenum type);
263 void glCreateClearTex(GL *gl, GLenum target, GLenum fmt, GLenum format,
264 GLenum type, GLint filter, int w, int h,
265 unsigned char val);
266 int glCreatePPMTex(GL *gl, GLenum target, GLenum fmt, GLint filter,
267 FILE *f, int *width, int *height, int *maxval);
268 void glUploadTex(GL *gl, GLenum target, GLenum format, GLenum type,
269 const void *dataptr, int stride,
270 int x, int y, int w, int h, int slice);
271 void glDownloadTex(GL *gl, GLenum target, GLenum format, GLenum type,
272 void *dataptr, int stride);
273 void glDrawTex(GL *gl, GLfloat x, GLfloat y, GLfloat w, GLfloat h,
274 GLfloat tx, GLfloat ty, GLfloat tw, GLfloat th,
275 int sx, int sy, int rect_tex, int is_yv12, int flip);
276 int loadGPUProgram(GL *gl, GLenum target, char *prog);
277 void glCheckError(GL *gl, const char *info);
279 /** \addtogroup glconversion
280 * \{ */
281 //! do not use YUV conversion, this should always stay 0
282 #define YUV_CONVERSION_NONE 0
283 //! use nVidia specific register combiners for YUV conversion
284 //! implementation has been removed
285 #define YUV_CONVERSION_COMBINERS 1
286 //! use a fragment program for YUV conversion
287 #define YUV_CONVERSION_FRAGMENT 2
288 //! use a fragment program for YUV conversion with gamma using POW
289 #define YUV_CONVERSION_FRAGMENT_POW 3
290 //! use a fragment program with additional table lookup for YUV conversion
291 #define YUV_CONVERSION_FRAGMENT_LOOKUP 4
292 //! use ATI specific register combiners ("fragment program")
293 #define YUV_CONVERSION_COMBINERS_ATI 5
294 //! use a fragment program with 3D table lookup for YUV conversion
295 #define YUV_CONVERSION_FRAGMENT_LOOKUP3D 6
296 //! use ATI specific "text" register combiners ("fragment program")
297 #define YUV_CONVERSION_TEXT_FRAGMENT 7
298 //! use normal bilinear scaling for textures
299 #define YUV_SCALER_BILIN 0
300 //! use higher quality bicubic scaling for textures
301 #define YUV_SCALER_BICUB 1
302 //! use cubic scaling in X and normal linear scaling in Y direction
303 #define YUV_SCALER_BICUB_X 2
304 //! use cubic scaling without additional lookup texture
305 #define YUV_SCALER_BICUB_NOTEX 3
306 #define YUV_SCALER_UNSHARP 4
307 #define YUV_SCALER_UNSHARP2 5
308 //! mask for conversion type
309 #define YUV_CONVERSION_MASK 0xF
310 //! mask for scaler type
311 #define YUV_SCALER_MASK 0xF
312 //! shift value for luminance scaler type
313 #define YUV_LUM_SCALER_SHIFT 8
314 //! shift value for chrominance scaler type
315 #define YUV_CHROM_SCALER_SHIFT 12
316 //! extract conversion out of type
317 #define YUV_CONVERSION(t) ((t) & YUV_CONVERSION_MASK)
318 //! extract luminance scaler out of type
319 #define YUV_LUM_SCALER(t) (((t) >> YUV_LUM_SCALER_SHIFT) & YUV_SCALER_MASK)
320 //! extract chrominance scaler out of type
321 #define YUV_CHROM_SCALER(t) (((t) >> YUV_CHROM_SCALER_SHIFT) & YUV_SCALER_MASK)
322 #define SET_YUV_CONVERSION(c) ((c) & YUV_CONVERSION_MASK)
323 #define SET_YUV_LUM_SCALER(s) (((s) & YUV_SCALER_MASK) << YUV_LUM_SCALER_SHIFT)
324 #define SET_YUV_CHROM_SCALER(s) (((s) & YUV_SCALER_MASK) << YUV_CHROM_SCALER_SHIFT)
325 //! returns whether the yuv conversion supports large brightness range etc.
326 static inline int glYUVLargeRange(int conv)
328 switch (conv) {
329 case YUV_CONVERSION_NONE:
330 case YUV_CONVERSION_COMBINERS_ATI:
331 case YUV_CONVERSION_FRAGMENT_LOOKUP3D:
332 case YUV_CONVERSION_TEXT_FRAGMENT:
333 return 0;
335 return 1;
337 /** \} */
339 typedef struct {
340 GLenum target;
341 int type;
342 struct mp_csp_params csp_params;
343 int texw;
344 int texh;
345 int chrom_texw;
346 int chrom_texh;
347 float filter_strength;
348 float noise_strength;
349 } gl_conversion_params_t;
351 int glAutodetectYUVConversion(GL *gl);
352 void glSetupYUVConversion(GL *gl, gl_conversion_params_t *params);
353 void glEnableYUVConversion(GL *gl, GLenum target, int type);
354 void glDisableYUVConversion(GL *gl, GLenum target, int type);
356 #define GL_3D_RED_CYAN 1
357 #define GL_3D_GREEN_MAGENTA 2
358 #define GL_3D_QUADBUFFER 3
360 void glEnable3DLeft(GL *gl, int type);
361 void glEnable3DRight(GL *gl, int type);
362 void glDisable3D(GL *gl, int type);
364 /** \addtogroup glcontext
365 * \{ */
366 //! could not set new window, will continue drawing into the old one.
367 #define SET_WINDOW_FAILED -1
368 //! new window is set, could even transfer the OpenGL context.
369 #define SET_WINDOW_OK 0
370 //! new window is set, but the OpenGL context needs to be reinitialized.
371 #define SET_WINDOW_REINIT 1
372 /** \} */
374 enum MPGLType {
375 GLTYPE_AUTO,
376 GLTYPE_COCOA,
377 GLTYPE_W32,
378 GLTYPE_X11,
379 GLTYPE_SDL,
382 enum {
383 MPGLFLAG_DEBUG = 1,
386 #define MPGL_VER(major, minor) (((major) << 16) | (minor))
387 #define MPGL_VER_GET_MAJOR(ver) ((ver) >> 16)
388 #define MPGL_VER_GET_MINOR(ver) ((ver) & ((1 << 16) - 1))
390 typedef struct MPGLContext {
391 GL *gl;
392 enum MPGLType type;
393 struct vo *vo;
394 // Bit size of each component in the created framebuffer. 0 if unknown.
395 int depth_r, depth_g, depth_b;
396 union {
397 int w32;
398 #ifdef CONFIG_GL_X11
399 XVisualInfo *x11;
400 #endif
401 } vinfo;
402 union {
403 #ifdef CONFIG_GL_WIN32
404 HGLRC w32;
405 #endif
406 #ifdef CONFIG_GL_X11
407 GLXContext x11;
408 #endif
409 } context;
410 int (*create_window)(struct MPGLContext *ctx, uint32_t d_width,
411 uint32_t d_height, uint32_t flags);
412 int (*setGlWindow)(struct MPGLContext *);
413 void (*releaseGlContext)(struct MPGLContext *);
414 void (*swapGlBuffers)(struct MPGLContext *);
415 int (*check_events)(struct vo *vo);
416 void (*fullscreen)(struct vo *vo);
417 // only available if GL3 context creation is supported
418 // gl_flags: bitfield of MPGLFLAG_* constants
419 // gl_version: requested OpenGL version number (use MPGL_VER())
420 // return value is one of the SET_WINDOW_* constants
421 int (*create_window_gl3)(struct MPGLContext *ctx, int gl_flags,
422 int gl_version, uint32_t d_width,
423 uint32_t d_height, uint32_t flags);
424 // optional
425 void (*ontop)(struct vo *vo);
426 void (*border)(struct vo *vo);
427 void (*update_xinerama_info)(struct vo *vo);
428 } MPGLContext;
430 int mpgl_find_backend(const char *name);
432 MPGLContext *init_mpglcontext(enum MPGLType type, struct vo *vo);
433 void uninit_mpglcontext(MPGLContext *ctx);
435 // calls create_window_gl3 or create_window+setGlWindow
436 int create_mpglcontext(struct MPGLContext *ctx, int gl_flags, int gl_version,
437 uint32_t d_width, uint32_t d_height, uint32_t flags);
439 //function pointers loaded from the OpenGL library
440 struct GL {
441 void (GLAPIENTRY *Begin)(GLenum);
442 void (GLAPIENTRY *End)(void);
443 void (GLAPIENTRY *Viewport)(GLint, GLint, GLsizei, GLsizei);
444 void (GLAPIENTRY *MatrixMode)(GLenum);
445 void (GLAPIENTRY *LoadIdentity)(void);
446 void (GLAPIENTRY *Translated)(double, double, double);
447 void (GLAPIENTRY *Scaled)(double, double, double);
448 void (GLAPIENTRY *Ortho)(double, double, double, double, double,double);
449 void (GLAPIENTRY *PushMatrix)(void);
450 void (GLAPIENTRY *PopMatrix)(void);
451 void (GLAPIENTRY *Clear)(GLbitfield);
452 GLuint (GLAPIENTRY *GenLists)(GLsizei);
453 void (GLAPIENTRY *DeleteLists)(GLuint, GLsizei);
454 void (GLAPIENTRY *NewList)(GLuint, GLenum);
455 void (GLAPIENTRY *EndList)(void);
456 void (GLAPIENTRY *CallList)(GLuint);
457 void (GLAPIENTRY *CallLists)(GLsizei, GLenum, const GLvoid *);
458 void (GLAPIENTRY *GenTextures)(GLsizei, GLuint *);
459 void (GLAPIENTRY *DeleteTextures)(GLsizei, const GLuint *);
460 void (GLAPIENTRY *TexEnvi)(GLenum, GLenum, GLint);
461 void (GLAPIENTRY *Color4ub)(GLubyte, GLubyte, GLubyte, GLubyte);
462 void (GLAPIENTRY *Color4f)(GLfloat, GLfloat, GLfloat, GLfloat);
463 void (GLAPIENTRY *ClearColor)(GLclampf, GLclampf, GLclampf, GLclampf);
464 void (GLAPIENTRY *Enable)(GLenum);
465 void (GLAPIENTRY *Disable)(GLenum);
466 const GLubyte *(GLAPIENTRY * GetString)(GLenum);
467 void (GLAPIENTRY *DrawBuffer)(GLenum);
468 void (GLAPIENTRY *DepthMask)(GLboolean);
469 void (GLAPIENTRY *BlendFunc)(GLenum, GLenum);
470 void (GLAPIENTRY *Flush)(void);
471 void (GLAPIENTRY *Finish)(void);
472 void (GLAPIENTRY *PixelStorei)(GLenum, GLint);
473 void (GLAPIENTRY *TexImage1D)(GLenum, GLint, GLint, GLsizei, GLint,
474 GLenum, GLenum, const GLvoid *);
475 void (GLAPIENTRY *TexImage2D)(GLenum, GLint, GLint, GLsizei, GLsizei,
476 GLint, GLenum, GLenum, const GLvoid *);
477 void (GLAPIENTRY *TexSubImage2D)(GLenum, GLint, GLint, GLint,
478 GLsizei, GLsizei, GLenum, GLenum,
479 const GLvoid *);
480 void (GLAPIENTRY *GetTexImage)(GLenum, GLint, GLenum, GLenum, GLvoid *);
481 void (GLAPIENTRY *TexParameteri)(GLenum, GLenum, GLint);
482 void (GLAPIENTRY *TexParameterf)(GLenum, GLenum, GLfloat);
483 void (GLAPIENTRY *TexParameterfv)(GLenum, GLenum, const GLfloat *);
484 void (GLAPIENTRY *TexCoord2f)(GLfloat, GLfloat);
485 void (GLAPIENTRY *TexCoord2fv)(const GLfloat *);
486 void (GLAPIENTRY *Vertex2f)(GLfloat, GLfloat);
487 void (GLAPIENTRY *GetIntegerv)(GLenum, GLint *);
488 void (GLAPIENTRY *GetBooleanv)(GLenum, GLboolean *);
489 void (GLAPIENTRY *ColorMask)(GLboolean, GLboolean, GLboolean, GLboolean);
490 void (GLAPIENTRY *ReadPixels)(GLint, GLint, GLsizei, GLsizei, GLenum,
491 GLenum, GLvoid *);
492 void (GLAPIENTRY *ReadBuffer)(GLenum);
493 void (GLAPIENTRY *VertexPointer)(GLint, GLenum, GLsizei, const GLvoid *);
494 void (GLAPIENTRY *ColorPointer)(GLint, GLenum, GLsizei, const GLvoid *);
495 void (GLAPIENTRY *TexCoordPointer)(GLint, GLenum, GLsizei, const GLvoid *);
496 void (GLAPIENTRY *DrawArrays)(GLenum, GLint, GLsizei);
497 void (GLAPIENTRY *EnableClientState)(GLenum);
498 void (GLAPIENTRY *DisableClientState)(GLenum);
499 GLenum (GLAPIENTRY *GetError)(void);
502 // OpenGL extension functions
503 void (GLAPIENTRY *GenBuffers)(GLsizei, GLuint *);
504 void (GLAPIENTRY *DeleteBuffers)(GLsizei, const GLuint *);
505 void (GLAPIENTRY *BindBuffer)(GLenum, GLuint);
506 GLvoid * (GLAPIENTRY * MapBuffer)(GLenum, GLenum);
507 GLboolean (GLAPIENTRY *UnmapBuffer)(GLenum);
508 void (GLAPIENTRY *BufferData)(GLenum, intptr_t, const GLvoid *, GLenum);
509 void (GLAPIENTRY *ActiveTexture)(GLenum);
510 void (GLAPIENTRY *BindTexture)(GLenum, GLuint);
511 void (GLAPIENTRY *MultiTexCoord2f)(GLenum, GLfloat, GLfloat);
512 void (GLAPIENTRY *GenPrograms)(GLsizei, GLuint *);
513 void (GLAPIENTRY *DeletePrograms)(GLsizei, const GLuint *);
514 void (GLAPIENTRY *BindProgram)(GLenum, GLuint);
515 void (GLAPIENTRY *ProgramString)(GLenum, GLenum, GLsizei, const GLvoid *);
516 void (GLAPIENTRY *GetProgramivARB)(GLenum, GLenum, GLint *);
517 void (GLAPIENTRY *ProgramEnvParameter4f)(GLenum, GLuint, GLfloat, GLfloat,
518 GLfloat, GLfloat);
519 int (GLAPIENTRY *SwapInterval)(int);
520 void (GLAPIENTRY *TexImage3D)(GLenum, GLint, GLenum, GLsizei, GLsizei,
521 GLsizei, GLint, GLenum, GLenum,
522 const GLvoid *);
524 // ancient ATI extensions
525 void (GLAPIENTRY *BeginFragmentShader)(void);
526 void (GLAPIENTRY *EndFragmentShader)(void);
527 void (GLAPIENTRY *SampleMap)(GLuint, GLuint, GLenum);
528 void (GLAPIENTRY *ColorFragmentOp2)(GLenum, GLuint, GLuint, GLuint, GLuint,
529 GLuint, GLuint, GLuint, GLuint, GLuint);
530 void (GLAPIENTRY *ColorFragmentOp3)(GLenum, GLuint, GLuint, GLuint, GLuint,
531 GLuint, GLuint, GLuint, GLuint, GLuint,
532 GLuint, GLuint, GLuint);
533 void (GLAPIENTRY *SetFragmentShaderConstant)(GLuint, const GLfloat *);
536 // GL 3, possibly in GL 2.x as well in form of extensions
537 void (GLAPIENTRY *GenVertexArrays)(GLsizei, GLuint *);
538 void (GLAPIENTRY *BindVertexArray)(GLuint);
539 GLint (GLAPIENTRY *GetAttribLocation)(GLuint, const GLchar *);
540 void (GLAPIENTRY *EnableVertexAttribArray)(GLuint);
541 void (GLAPIENTRY *DisableVertexAttribArray)(GLuint);
542 void (GLAPIENTRY *VertexAttribPointer)(GLuint, GLint, GLenum, GLboolean,
543 GLsizei, const GLvoid *);
544 void (GLAPIENTRY *DeleteVertexArrays)(GLsizei, const GLuint *);
545 void (GLAPIENTRY *UseProgram)(GLuint);
546 GLint (GLAPIENTRY *GetUniformLocation)(GLuint, const GLchar *);
547 void (GLAPIENTRY *CompileShader)(GLuint);
548 GLuint (GLAPIENTRY *CreateProgram)(void);
549 GLuint (GLAPIENTRY *CreateShader)(GLenum);
550 void (GLAPIENTRY *ShaderSource)(GLuint, GLsizei, const GLchar **,
551 const GLint *);
552 void (GLAPIENTRY *LinkProgram)(GLuint);
553 void (GLAPIENTRY *AttachShader)(GLuint, GLuint);
554 void (GLAPIENTRY *DeleteShader)(GLuint);
555 void (GLAPIENTRY *DeleteProgram)(GLuint);
556 void (GLAPIENTRY *GetShaderInfoLog)(GLuint, GLsizei, GLsizei *, GLchar *);
557 void (GLAPIENTRY *GetShaderiv)(GLuint, GLenum, GLint *);
558 void (GLAPIENTRY *GetProgramInfoLog)(GLuint, GLsizei, GLsizei *, GLchar *);
559 void (GLAPIENTRY *GetProgramiv)(GLenum, GLenum, GLint *);
560 const GLubyte* (GLAPIENTRY *GetStringi)(GLenum, GLuint);
561 void (GLAPIENTRY *BindAttribLocation)(GLuint, GLuint, const GLchar *);
562 void (GLAPIENTRY *BindFramebuffer)(GLenum, GLuint);
563 void (GLAPIENTRY *GenFramebuffers)(GLsizei, GLuint *);
564 void (GLAPIENTRY *DeleteFramebuffers)(GLsizei, const GLuint *);
565 GLenum (GLAPIENTRY *CheckFramebufferStatus)(GLenum);
566 void (GLAPIENTRY *FramebufferTexture2D)(GLenum, GLenum, GLenum, GLuint,
567 GLint);
569 void (GLAPIENTRY *Uniform1f)(GLint, GLfloat);
570 void (GLAPIENTRY *Uniform3f)(GLint, GLfloat, GLfloat, GLfloat);
571 void (GLAPIENTRY *Uniform1i)(GLint, GLint);
572 void (GLAPIENTRY *UniformMatrix3fv)(GLint, GLsizei, GLboolean,
573 const GLfloat *);
574 void (GLAPIENTRY *UniformMatrix4x3fv)(GLint, GLsizei, GLboolean,
575 const GLfloat *);
579 #if defined(CONFIG_GL_WIN32) && !defined(WGL_CONTEXT_MAJOR_VERSION_ARB)
580 /* these are supposed to be defined in wingdi.h but mingw's is too old */
581 /* only the bits actually used by mplayer are defined */
582 /* reference: http://www.opengl.org/registry/specs/ARB/wgl_create_context.txt */
584 #define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091
585 #define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092
586 #define WGL_CONTEXT_FLAGS_ARB 0x2094
587 #define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126
588 #define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002
589 #define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
590 #endif
592 #endif /* MPLAYER_GL_COMMON_H */