13 #include "w32_common.h"
17 #include "x11_common.h"
20 // workaround for some gl.h headers
23 #define APIENTRY GLAPIENTRY
24 #elif defined(GL_WIN32)
25 #define APIENTRY __stdcall
32 * \defgroup glextdefines OpenGL extension defines
34 * conditionally define all extension defines used.
35 * vendor specific extensions should be marked as such
36 * (e.g. _NV), _ARB is not used to ease readability.
39 #ifndef GL_REGISTER_COMBINERS_NV
40 #define GL_REGISTER_COMBINERS_NV 0x8522
42 #ifndef GL_MAX_GENERAL_COMBINERS_NV
43 #define GL_MAX_GENERAL_COMBINERS_NV 0x854D
45 #ifndef GL_NUM_GENERAL_COMBINERS_NV
46 #define GL_NUM_GENERAL_COMBINERS_NV 0x854E
48 #ifndef GL_CONSTANT_COLOR0_NV
49 #define GL_CONSTANT_COLOR0_NV 0x852A
51 #ifndef GL_CONSTANT_COLOR1_NV
52 #define GL_CONSTANT_COLOR1_NV 0x852B
54 #ifndef GL_COMBINER0_NV
55 #define GL_COMBINER0_NV 0x8550
57 #ifndef GL_COMBINER1_NV
58 #define GL_COMBINER1_NV 0x8551
60 #ifndef GL_VARIABLE_A_NV
61 #define GL_VARIABLE_A_NV 0x8523
63 #ifndef GL_VARIABLE_B_NV
64 #define GL_VARIABLE_B_NV 0x8524
66 #ifndef GL_VARIABLE_C_NV
67 #define GL_VARIABLE_C_NV 0x8525
69 #ifndef GL_VARIABLE_D_NV
70 #define GL_VARIABLE_D_NV 0x8526
72 #ifndef GL_UNSIGNED_INVERT_NV
73 #define GL_UNSIGNED_INVERT_NV 0x8537
75 #ifndef GL_HALF_BIAS_NORMAL_NV
76 #define GL_HALF_BIAS_NORMAL_NV 0x853A
78 #ifndef GL_SIGNED_IDENTITY_NV
79 #define GL_SIGNED_IDENTITY_NV 0x853C
81 #ifndef GL_SCALE_BY_FOUR_NV
82 #define GL_SCALE_BY_FOUR_NV 0x853F
85 #define GL_DISCARD_NV 0x8530
88 #define GL_SPARE0_NV 0x852E
90 #ifndef GL_FRAGMENT_SHADER_ATI
91 #define GL_FRAGMENT_SHADER_ATI 0x8920
93 #ifndef GL_NUM_FRAGMENT_REGISTERS_ATI
94 #define GL_NUM_FRAGMENT_REGISTERS_ATI 0x896E
97 #define GL_REG_0_ATI 0x8921
100 #define GL_REG_1_ATI 0x8922
103 #define GL_REG_2_ATI 0x8923
106 #define GL_CON_0_ATI 0x8941
109 #define GL_CON_1_ATI 0x8942
112 #define GL_ADD_ATI 0x8963
115 #define GL_MUL_ATI 0x8964
118 #define GL_MAD_ATI 0x8968
120 #ifndef GL_SWIZZLE_STR_ATI
121 #define GL_SWIZZLE_STR_ATI 0x8976
123 #ifndef GL_4X_BIT_ATI
124 #define GL_4X_BIT_ATI 2
126 #ifndef GL_BIAS_BIT_ATI
127 #define GL_BIAS_BIT_ATI 8
129 #ifndef GL_MAX_TEXTURE_UNITS
130 #define GL_MAX_TEXTURE_UNITS 0x84E2
133 #define GL_TEXTURE0 0x84C0
136 #define GL_TEXTURE1 0x84C1
139 #define GL_TEXTURE2 0x84C2
142 #define GL_TEXTURE3 0x84C3
144 #ifndef GL_TEXTURE_RECTANGLE
145 #define GL_TEXTURE_RECTANGLE 0x84F5
147 #ifndef GL_PIXEL_UNPACK_BUFFER
148 #define GL_PIXEL_UNPACK_BUFFER 0x88EC
150 #ifndef GL_STREAM_DRAW
151 #define GL_STREAM_DRAW 0x88E0
153 #ifndef GL_DYNAMIC_DRAW
154 #define GL_DYNAMIC_DRAW 0x88E8
156 #ifndef GL_WRITE_ONLY
157 #define GL_WRITE_ONLY 0x88B9
160 #define GL_BGR 0x80E0
163 #define GL_BGRA 0x80E1
165 #ifndef GL_UNSIGNED_BYTE_3_3_2
166 #define GL_UNSIGNED_BYTE_3_3_2 0x8032
168 #ifndef GL_UNSIGNED_BYTE_2_3_3_REV
169 #define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362
171 #ifndef GL_UNSIGNED_SHORT_5_6_5
172 #define GL_UNSIGNED_SHORT_5_6_5 0x8363
174 #ifndef GL_UNSIGNED_SHORT_5_6_5_REV
175 #define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364
177 #ifndef GL_UNSIGNED_SHORT_5_5_5_1
178 #define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
180 #ifndef GL_UNSIGNED_SHORT_1_5_5_5_REV
181 #define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366
184 #define GL_RGB32F 0x8815
186 #ifndef GL_FLOAT_RGB32_NV
187 #define GL_FLOAT_RGB32_NV 0x8889
189 #ifndef GL_FRAGMENT_PROGRAM
190 #define GL_FRAGMENT_PROGRAM 0x8804
192 #ifndef GL_PROGRAM_FORMAT_ASCII
193 #define GL_PROGRAM_FORMAT_ASCII 0x8875
195 #ifndef GL_PROGRAM_ERROR_POSITION
196 #define GL_PROGRAM_ERROR_POSITION 0x864B
198 #ifndef GL_PROGRAM_ERROR_STRING
199 #define GL_PROGRAM_ERROR_STRING 0x8874
201 /** \} */ // end of glextdefines group
203 void glAdjustAlignment(int stride
);
205 const char *glValName(GLint value
);
207 int glFindFormat(uint32_t format
, int *bpp
, GLint
*gl_texfmt
,
208 GLenum
*gl_format
, GLenum
*gl_type
);
209 int glFmt2bpp(GLenum format
, GLenum type
);
210 void glCreateClearTex(GLenum target
, GLenum fmt
, GLint filter
,
211 int w
, int h
, unsigned char val
);
212 int glCreatePPMTex(GLenum target
, GLenum fmt
, GLint filter
,
213 FILE *f
, int *width
, int *height
, int *maxval
);
214 void glUploadTex(GLenum target
, GLenum format
, GLenum type
,
215 const void *dataptr
, int stride
,
216 int x
, int y
, int w
, int h
, int slice
);
217 void glDrawTex(GLfloat x
, GLfloat y
, GLfloat w
, GLfloat h
,
218 GLfloat tx
, GLfloat ty
, GLfloat tw
, GLfloat th
,
219 int sx
, int sy
, int rect_tex
, int is_yv12
, int flip
);
220 int loadGPUProgram(GLenum target
, char *prog
);
222 /** \addtogroup glconversion
224 //! do not use YUV conversion, this should always stay 0
225 #define YUV_CONVERSION_NONE 0
226 //! use nVidia specific register combiners for YUV conversion
227 #define YUV_CONVERSION_COMBINERS 1
228 //! use a fragment program for YUV conversion
229 #define YUV_CONVERSION_FRAGMENT 2
230 //! use a fragment program for YUV conversion with gamma using POW
231 #define YUV_CONVERSION_FRAGMENT_POW 3
232 //! use a fragment program with additional table lookup for YUV conversion
233 #define YUV_CONVERSION_FRAGMENT_LOOKUP 4
234 //! use ATI specific register combiners ("fragment program")
235 #define YUV_CONVERSION_COMBINERS_ATI 5
236 //! use a fragment program with 3D table lookup for YUV conversion
237 #define YUV_CONVERSION_FRAGMENT_LOOKUP3D 6
238 //! use normal bilinear scaling for textures
239 #define YUV_SCALER_BILIN 0
240 //! use higher quality bicubic scaling for textures
241 #define YUV_SCALER_BICUB 1
242 //! use cubic scaling in X and normal linear scaling in Y direction
243 #define YUV_SCALER_BICUB_X 2
244 //! use cubic scaling without additional lookup texture
245 #define YUV_SCALER_BICUB_NOTEX 3
246 //! mask for conversion type
247 #define YUV_CONVERSION_MASK 0xF
248 //! mask for scaler type
249 #define YUV_SCALER_MASK 0xF
250 //! shift value for luminance scaler type
251 #define YUV_LUM_SCALER_SHIFT 8
252 //! shift value for chrominance scaler type
253 #define YUV_CHROM_SCALER_SHIFT 12
254 //! extract conversion out of type
255 #define YUV_CONVERSION(t) (t & YUV_CONVERSION_MASK)
256 //! extract luminance scaler out of type
257 #define YUV_LUM_SCALER(t) ((t >> YUV_LUM_SCALER_SHIFT) & YUV_SCALER_MASK)
258 //! extract chrominance scaler out of type
259 #define YUV_CHROM_SCALER(t) ((t >> YUV_CHROM_SCALER_SHIFT) & YUV_SCALER_MASK)
261 void glSetupYUVConversion(GLenum target
, int type
,
262 float brightness
, float contrast
,
263 float hue
, float saturation
,
264 float rgamma
, float ggamma
, float bgamma
,
266 void glEnableYUVConversion(GLenum target
, int type
);
267 void glDisableYUVConversion(GLenum target
, int type
);
269 /** \addtogroup glcontext
271 //! could not set new window, will continue drawing into the old one.
272 #define SET_WINDOW_FAILED -1
273 //! new window is set, could even transfer the OpenGL context.
274 #define SET_WINDOW_OK 0
275 //! new window is set, but the OpenGL context needs to be reinitialized.
276 #define SET_WINDOW_REINIT 1
280 #define vo_check_events() vo_w32_check_events()
281 #define vo_fullscreen() vo_w32_fullscreen()
282 #define vo_ontop() vo_w32_ontop()
283 #define vo_uninit() vo_w32_uninit()
284 int setGlWindow(int *vinfo
, HGLRC
*context
, HWND win
);
285 void releaseGlContext(int *vinfo
, HGLRC
*context
);
287 #define vo_check_events() vo_x11_check_events(mDisplay)
288 #define vo_fullscreen() vo_x11_fullscreen()
289 #define vo_ontop() vo_x11_ontop()
290 #define vo_uninit() vo_x11_uninit()
291 int setGlWindow(XVisualInfo
**vinfo
, GLXContext
*context
, Window win
);
292 void releaseGlContext(XVisualInfo
**vinfo
, GLXContext
*context
);
294 void swapGlBuffers(void);
296 extern void (APIENTRY
*GenBuffers
)(GLsizei
, GLuint
*);
297 extern void (APIENTRY
*DeleteBuffers
)(GLsizei
, const GLuint
*);
298 extern void (APIENTRY
*BindBuffer
)(GLenum
, GLuint
);
299 extern GLvoid
* (APIENTRY
*MapBuffer
)(GLenum
, GLenum
);
300 extern GLboolean (APIENTRY
*UnmapBuffer
)(GLenum
);
301 extern void (APIENTRY
*BufferData
)(GLenum
, intptr_t, const GLvoid
*, GLenum
);
302 extern void (APIENTRY
*CombinerParameterfv
)(GLenum
, const GLfloat
*);
303 extern void (APIENTRY
*CombinerParameteri
)(GLenum
, GLint
);
304 extern void (APIENTRY
*CombinerInput
)(GLenum
, GLenum
, GLenum
, GLenum
, GLenum
,
306 extern void (APIENTRY
*CombinerOutput
)(GLenum
, GLenum
, GLenum
, GLenum
, GLenum
,
307 GLenum
, GLenum
, GLboolean
, GLboolean
,
309 extern void (APIENTRY
*BeginFragmentShader
)(void);
310 extern void (APIENTRY
*EndFragmentShader
)(void);
311 extern void (APIENTRY
*SampleMap
)(GLuint
, GLuint
, GLenum
);
312 extern void (APIENTRY
*ColorFragmentOp2
)(GLenum
, GLuint
, GLuint
, GLuint
, GLuint
,
313 GLuint
, GLuint
, GLuint
, GLuint
, GLuint
);
314 extern void (APIENTRY
*ColorFragmentOp3
)(GLenum
, GLuint
, GLuint
, GLuint
, GLuint
,
315 GLuint
, GLuint
, GLuint
, GLuint
, GLuint
,
316 GLuint
, GLuint
, GLuint
);
317 extern void (APIENTRY
*SetFragmentShaderConstant
)(GLuint
, const GLfloat
*);
318 extern void (APIENTRY
*ActiveTexture
)(GLenum
);
319 extern void (APIENTRY
*BindTexture
)(GLenum
, GLuint
);
320 extern void (APIENTRY
*MultiTexCoord2f
)(GLenum
, GLfloat
, GLfloat
);
321 extern void (APIENTRY
*GenPrograms
)(GLsizei
, GLuint
*);
322 extern void (APIENTRY
*DeletePrograms
)(GLsizei
, const GLuint
*);
323 extern void (APIENTRY
*BindProgram
)(GLenum
, GLuint
);
324 extern void (APIENTRY
*ProgramString
)(GLenum
, GLenum
, GLsizei
, const GLvoid
*);
325 extern void (APIENTRY
*ProgramEnvParameter4f
)(GLenum
, GLuint
, GLfloat
, GLfloat
,
327 extern int (APIENTRY
*SwapInterval
)(int);
328 extern void (APIENTRY
*TexImage3D
)(GLenum
, GLint
, GLenum
, GLsizei
, GLsizei
,
329 GLsizei
, GLint
, GLenum
, GLenum
, const GLvoid
*);
331 #endif /* GL_COMMON_H */