~ubuntu-dev/mplayer/ubuntu-feisty

« back to all changes in this revision

Viewing changes to libvo/gl_common.h

  • Committer: Reinhard Tartler
  • Date: 2006-07-08 08:45:33 UTC
  • Revision ID: siretart@tauware.de-20060708084533-dbc155bde7122e78
imported mplayer_0.99+1.0pre7try2+cvs20060117

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef __GL_COMMON_H__
 
2
#define __GL_COMMON_H__
 
3
 
 
4
#include "mp_msg.h"
 
5
#include "config.h"
 
6
 
 
7
#include <GL/gl.h>
 
8
#include "video_out.h"
 
9
 
 
10
#ifdef GL_WIN32
 
11
#include <windows.h>
 
12
#include <GL/glext.h>
 
13
#include "w32_common.h"
 
14
#else
 
15
#include <X11/Xlib.h>
 
16
#include <GL/glx.h>
 
17
#include "x11_common.h"
 
18
#endif
 
19
 
 
20
/**
 
21
 * \defgroup glextdefines OpenGL extension defines
 
22
 * 
 
23
 * conditionally define all extension defines used.
 
24
 * vendor specific extensions should be marked as such
 
25
 * (e.g. _NV), _ARB is not used to ease readability.
 
26
 * \{
 
27
 */
 
28
#ifndef GL_REGISTER_COMBINERS_NV
 
29
#define GL_REGISTER_COMBINERS_NV 0x8522
 
30
#endif
 
31
#ifndef GL_MAX_GENERAL_COMBINERS_NV
 
32
#define GL_MAX_GENERAL_COMBINERS_NV 0x854D
 
33
#endif
 
34
#ifndef GL_NUM_GENERAL_COMBINERS_NV
 
35
#define GL_NUM_GENERAL_COMBINERS_NV 0x854E
 
36
#endif
 
37
#ifndef GL_CONSTANT_COLOR0_NV
 
38
#define GL_CONSTANT_COLOR0_NV 0x852A
 
39
#endif
 
40
#ifndef GL_CONSTANT_COLOR1_NV
 
41
#define GL_CONSTANT_COLOR1_NV 0x852B
 
42
#endif
 
43
#ifndef GL_COMBINER0_NV
 
44
#define GL_COMBINER0_NV 0x8550
 
45
#endif
 
46
#ifndef GL_COMBINER1_NV
 
47
#define GL_COMBINER1_NV 0x8551
 
48
#endif
 
49
#ifndef GL_VARIABLE_A_NV
 
50
#define GL_VARIABLE_A_NV 0x8523
 
51
#endif
 
52
#ifndef GL_VARIABLE_B_NV
 
53
#define GL_VARIABLE_B_NV 0x8524
 
54
#endif
 
55
#ifndef GL_VARIABLE_C_NV
 
56
#define GL_VARIABLE_C_NV 0x8525
 
57
#endif
 
58
#ifndef GL_VARIABLE_D_NV
 
59
#define GL_VARIABLE_D_NV 0x8526
 
60
#endif
 
61
#ifndef GL_UNSIGNED_INVERT_NV
 
62
#define GL_UNSIGNED_INVERT_NV 0x8537
 
63
#endif
 
64
#ifndef GL_HALF_BIAS_NORMAL_NV
 
65
#define GL_HALF_BIAS_NORMAL_NV 0x853A
 
66
#endif
 
67
#ifndef GL_SIGNED_IDENTITY_NV
 
68
#define GL_SIGNED_IDENTITY_NV 0x853C
 
69
#endif
 
70
#ifndef GL_SCALE_BY_FOUR_NV
 
71
#define GL_SCALE_BY_FOUR_NV 0x853F
 
72
#endif
 
73
#ifndef GL_DISCARD_NV
 
74
#define GL_DISCARD_NV 0x8530
 
75
#endif
 
76
#ifndef GL_SPARE0_NV
 
77
#define GL_SPARE0_NV 0x852E
 
78
#endif
 
79
#ifndef GL_FRAGMENT_SHADER_ATI
 
80
#define GL_FRAGMENT_SHADER_ATI 0x8920
 
81
#endif
 
82
#ifndef GL_NUM_FRAGMENT_REGISTERS_ATI
 
83
#define GL_NUM_FRAGMENT_REGISTERS_ATI 0x896E
 
84
#endif
 
85
#ifndef GL_REG_0_ATI
 
86
#define GL_REG_0_ATI 0x8921
 
87
#endif
 
88
#ifndef GL_REG_1_ATI
 
89
#define GL_REG_1_ATI 0x8922
 
90
#endif
 
91
#ifndef GL_REG_2_ATI
 
92
#define GL_REG_2_ATI 0x8923
 
93
#endif
 
94
#ifndef GL_CON_0_ATI
 
95
#define GL_CON_0_ATI 0x8941
 
96
#endif
 
97
#ifndef GL_CON_1_ATI
 
98
#define GL_CON_1_ATI 0x8942
 
99
#endif
 
100
#ifndef GL_ADD_ATI
 
101
#define GL_ADD_ATI 0x8963
 
102
#endif
 
103
#ifndef GL_MUL_ATI
 
104
#define GL_MUL_ATI 0x8964
 
105
#endif
 
106
#ifndef GL_MAD_ATI
 
107
#define GL_MAD_ATI 0x8968
 
108
#endif
 
109
#ifndef GL_SWIZZLE_STR_ATI
 
110
#define GL_SWIZZLE_STR_ATI 0x8976
 
111
#endif
 
112
#ifndef GL_4X_BIT_ATI
 
113
#define GL_4X_BIT_ATI 2
 
114
#endif
 
115
#ifndef GL_BIAS_BIT_ATI
 
116
#define GL_BIAS_BIT_ATI 8
 
117
#endif
 
118
#ifndef GL_MAX_TEXTURE_UNITS
 
119
#define GL_MAX_TEXTURE_UNITS 0x84E2
 
120
#endif
 
121
#ifndef GL_TEXTURE0
 
122
#define GL_TEXTURE0 0x84C0
 
123
#endif
 
124
#ifndef GL_TEXTURE1
 
125
#define GL_TEXTURE1 0x84C1
 
126
#endif
 
127
#ifndef GL_TEXTURE2
 
128
#define GL_TEXTURE2 0x84C2
 
129
#endif
 
130
#ifndef GL_TEXTURE3
 
131
#define GL_TEXTURE3 0x84C3
 
132
#endif
 
133
#ifndef GL_TEXTURE_RECTANGLE
 
134
#define GL_TEXTURE_RECTANGLE 0x84F5
 
135
#endif
 
136
#ifndef GL_PIXEL_UNPACK_BUFFER
 
137
#define GL_PIXEL_UNPACK_BUFFER 0x88EC
 
138
#endif
 
139
#ifndef GL_STREAM_DRAW
 
140
#define GL_STREAM_DRAW 0x88E0
 
141
#endif
 
142
#ifndef GL_DYNAMIC_DRAW
 
143
#define GL_DYNAMIC_DRAW 0x88E8
 
144
#endif
 
145
#ifndef GL_WRITE_ONLY
 
146
#define GL_WRITE_ONLY 0x88B9
 
147
#endif
 
148
#ifndef GL_BGR
 
149
#define GL_BGR 0x80E0
 
150
#endif
 
151
#ifndef GL_BGRA
 
152
#define GL_BGRA 0x80E1
 
153
#endif
 
154
#ifndef GL_UNSIGNED_BYTE_3_3_2
 
155
#define GL_UNSIGNED_BYTE_3_3_2 0x8032
 
156
#endif
 
157
#ifndef GL_UNSIGNED_BYTE_2_3_3_REV
 
158
#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362
 
159
#endif
 
160
#ifndef GL_UNSIGNED_SHORT_5_6_5
 
161
#define GL_UNSIGNED_SHORT_5_6_5 0x8363
 
162
#endif
 
163
#ifndef GL_UNSIGNED_SHORT_5_6_5_REV
 
164
#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364
 
165
#endif
 
166
#ifndef GL_UNSIGNED_SHORT_5_5_5_1
 
167
#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
 
168
#endif
 
169
#ifndef GL_UNSIGNED_SHORT_1_5_5_5_REV
 
170
#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366
 
171
#endif
 
172
#ifndef GL_FRAGMENT_PROGRAM
 
173
#define GL_FRAGMENT_PROGRAM 0x8804
 
174
#endif
 
175
#ifndef GL_PROGRAM_FORMAT_ASCII
 
176
#define GL_PROGRAM_FORMAT_ASCII 0x8875
 
177
#endif
 
178
#ifndef GL_PROGRAM_ERROR_POSITION
 
179
#define GL_PROGRAM_ERROR_POSITION 0x864B
 
180
#endif
 
181
/** \} */ // end of glextdefines group
 
182
 
 
183
void glAdjustAlignment(int stride);
 
184
 
 
185
const char *glValName(GLint value);
 
186
 
 
187
int glFindFormat(uint32_t format, int *bpp, GLint *gl_texfmt,
 
188
                  GLenum *gl_format, GLenum *gl_type);
 
189
int glFmt2bpp(GLenum format, GLenum type);
 
190
void glCreateClearTex(GLenum target, GLenum fmt, GLint filter,
 
191
                      int w, int h, unsigned char val);
 
192
int glCreatePPMTex(GLenum target, GLenum fmt, GLint filter,
 
193
                   FILE *f, int *width, int *height, int *maxval);
 
194
void glUploadTex(GLenum target, GLenum format, GLenum type,
 
195
                 const void *data, int stride,
 
196
                 int x, int y, int w, int h, int slice);
 
197
void glDrawTex(GLfloat x, GLfloat y, GLfloat w, GLfloat h,
 
198
               GLfloat tx, GLfloat ty, GLfloat tw, GLfloat th,
 
199
               int sx, int sy, int rect_tex, int is_yv12, int flip);
 
200
 
 
201
/** \addtogroup glconversion
 
202
  * \{ */
 
203
//! do not use YUV conversion, this should always stay 0
 
204
#define YUV_CONVERSION_NONE 0
 
205
//! use nVidia specific register combiners for YUV conversion
 
206
#define YUV_CONVERSION_COMBINERS 1
 
207
//! use a fragment program for YUV conversion
 
208
#define YUV_CONVERSION_FRAGMENT 2
 
209
//! use a fragment program for YUV conversion with gamma using POW
 
210
#define YUV_CONVERSION_FRAGMENT_POW 3
 
211
//! use a fragment program with additional table lookup for YUV conversion
 
212
#define YUV_CONVERSION_FRAGMENT_LOOKUP 4
 
213
//! use ATI specific register combiners ("fragment program")
 
214
#define YUV_CONVERSION_COMBINERS_ATI 5
 
215
/** \} */
 
216
void glSetupYUVConversion(GLenum target, int type,
 
217
                          float brightness, float contrast,
 
218
                          float hue, float saturation,
 
219
                          float rgamma, float ggamma, float bgamma);
 
220
void inline glEnableYUVConversion(GLenum target, int type);
 
221
void inline glDisableYUVConversion(GLenum target, int type);
 
222
 
 
223
/** \addtogroup glcontext
 
224
  * \{ */
 
225
//! could not set new window, will continue drawing into the old one.
 
226
#define SET_WINDOW_FAILED -1
 
227
//! new window is set, could even transfer the OpenGL context.
 
228
#define SET_WINDOW_OK 0
 
229
//! new window is set, but the OpenGL context needs to be reinitialized.
 
230
#define SET_WINDOW_REINIT 1
 
231
/** \} */
 
232
 
 
233
#ifdef GL_WIN32
 
234
#define vo_check_events() vo_w32_check_events()
 
235
#define vo_fullscreen() vo_w32_fullscreen()
 
236
#define vo_ontop() vo_w32_ontop()
 
237
#define vo_uninit() vo_w32_uninit()
 
238
int setGlWindow(int *vinfo, HGLRC *context, HWND win);
 
239
void releaseGlContext(int *vinfo, HGLRC *context);
 
240
#else
 
241
#define vo_check_events() vo_x11_check_events(mDisplay)
 
242
#define vo_fullscreen() vo_x11_fullscreen()
 
243
#define vo_ontop() vo_x11_ontop()
 
244
#define vo_uninit() vo_x11_uninit()
 
245
int setGlWindow(XVisualInfo **vinfo, GLXContext *context, Window win);
 
246
void releaseGlContext(XVisualInfo **vinfo, GLXContext *context);
 
247
#endif
 
248
void swapGlBuffers();
 
249
 
 
250
extern void (APIENTRY *GenBuffers)(GLsizei, GLuint *);
 
251
extern void (APIENTRY *DeleteBuffers)(GLsizei, const GLuint *);
 
252
extern void (APIENTRY *BindBuffer)(GLenum, GLuint);
 
253
extern GLvoid* (APIENTRY *MapBuffer)(GLenum, GLenum); 
 
254
extern GLboolean (APIENTRY *UnmapBuffer)(GLenum);
 
255
extern void (APIENTRY *BufferData)(GLenum, intptr_t, const GLvoid *, GLenum);
 
256
extern void (APIENTRY *CombinerParameterfv)(GLenum, const GLfloat *);
 
257
extern void (APIENTRY *CombinerParameteri)(GLenum, GLint);
 
258
extern void (APIENTRY *CombinerInput)(GLenum, GLenum, GLenum, GLenum, GLenum,
 
259
                                      GLenum);
 
260
extern void (APIENTRY *CombinerOutput)(GLenum, GLenum, GLenum, GLenum, GLenum,
 
261
                                       GLenum, GLenum, GLboolean, GLboolean,
 
262
                                       GLboolean);
 
263
extern void (APIENTRY *BeginFragmentShader)(void);
 
264
extern void (APIENTRY *EndFragmentShader)(void);
 
265
extern void (APIENTRY *SampleMap)(GLuint, GLuint, GLenum);
 
266
extern void (APIENTRY *ColorFragmentOp2)(GLenum, GLuint, GLuint, GLuint, GLuint,
 
267
                                         GLuint, GLuint, GLuint, GLuint, GLuint);
 
268
extern void (APIENTRY *ColorFragmentOp3)(GLenum, GLuint, GLuint, GLuint, GLuint,
 
269
                                         GLuint, GLuint, GLuint, GLuint, GLuint,
 
270
                                         GLuint, GLuint, GLuint);
 
271
extern void (APIENTRY *SetFragmentShaderConstant)(GLuint, const GLfloat *);
 
272
extern void (APIENTRY *ActiveTexture)(GLenum);
 
273
extern void (APIENTRY *BindTexture)(GLenum, GLuint);
 
274
extern void (APIENTRY *MultiTexCoord2f)(GLenum, GLfloat, GLfloat);
 
275
extern void (APIENTRY *GenPrograms)(GLsizei, GLuint *);
 
276
extern void (APIENTRY *DeletePrograms)(GLsizei, const GLuint *);
 
277
extern void (APIENTRY *BindProgram)(GLenum, GLuint);
 
278
extern void (APIENTRY *ProgramString)(GLenum, GLenum, GLsizei, const GLvoid *);
 
279
extern void (APIENTRY *ProgramEnvParameter4f)(GLenum, GLuint, GLfloat, GLfloat,
 
280
                                              GLfloat, GLfloat);
 
281
extern int (APIENTRY *SwapInterval)(int);
 
282
 
 
283
#endif