annotate libvo/gl_common.h @ 16303:a87c6cf3fe52

Fix texture format variable types. Internal format is GLint, others are GLenum
author reimar
date Thu, 25 Aug 2005 12:45:57 +0000
parents d5374d07492a
children ec7036dedee4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13653
799f81d3cb19 added gl_common for code used by both vo_gl.c and vo_gl2.c.
reimar
parents:
diff changeset
1 #ifndef __GL_COMMON_H__
799f81d3cb19 added gl_common for code used by both vo_gl.c and vo_gl2.c.
reimar
parents:
diff changeset
2 #define __GL_COMMON_H__
799f81d3cb19 added gl_common for code used by both vo_gl.c and vo_gl2.c.
reimar
parents:
diff changeset
3
13843
3f28d2a56758 fullscreen fixes and GUI support for vo_gl
reimar
parents: 13653
diff changeset
4 #include "mp_msg.h"
3f28d2a56758 fullscreen fixes and GUI support for vo_gl
reimar
parents: 13653
diff changeset
5 #include "config.h"
3f28d2a56758 fullscreen fixes and GUI support for vo_gl
reimar
parents: 13653
diff changeset
6
13653
799f81d3cb19 added gl_common for code used by both vo_gl.c and vo_gl2.c.
reimar
parents:
diff changeset
7 #include <GL/gl.h>
13843
3f28d2a56758 fullscreen fixes and GUI support for vo_gl
reimar
parents: 13653
diff changeset
8 #include "video_out.h"
3f28d2a56758 fullscreen fixes and GUI support for vo_gl
reimar
parents: 13653
diff changeset
9
14142
f0c1ee83b216 Improving gl2 under windows, moving some functionality to gl_common
reimar
parents: 14078
diff changeset
10 #ifdef GL_WIN32
f0c1ee83b216 Improving gl2 under windows, moving some functionality to gl_common
reimar
parents: 14078
diff changeset
11 #include <windows.h>
f0c1ee83b216 Improving gl2 under windows, moving some functionality to gl_common
reimar
parents: 14078
diff changeset
12 #include <GL/glext.h>
f0c1ee83b216 Improving gl2 under windows, moving some functionality to gl_common
reimar
parents: 14078
diff changeset
13 #include "w32_common.h"
f0c1ee83b216 Improving gl2 under windows, moving some functionality to gl_common
reimar
parents: 14078
diff changeset
14 #else
13843
3f28d2a56758 fullscreen fixes and GUI support for vo_gl
reimar
parents: 13653
diff changeset
15 #include <X11/Xlib.h>
3f28d2a56758 fullscreen fixes and GUI support for vo_gl
reimar
parents: 13653
diff changeset
16 #include <GL/glx.h>
3f28d2a56758 fullscreen fixes and GUI support for vo_gl
reimar
parents: 13653
diff changeset
17 #include "x11_common.h"
3f28d2a56758 fullscreen fixes and GUI support for vo_gl
reimar
parents: 13653
diff changeset
18 #endif
13653
799f81d3cb19 added gl_common for code used by both vo_gl.c and vo_gl2.c.
reimar
parents:
diff changeset
19
16099
629c54dc7e0d support for rectangular and streaming textures.
reimar
parents: 14142
diff changeset
20 #ifndef GL_TEXTURE_RECTANGLE
629c54dc7e0d support for rectangular and streaming textures.
reimar
parents: 14142
diff changeset
21 #define GL_TEXTURE_RECTANGLE 0x84F5
629c54dc7e0d support for rectangular and streaming textures.
reimar
parents: 14142
diff changeset
22 #endif
629c54dc7e0d support for rectangular and streaming textures.
reimar
parents: 14142
diff changeset
23 #ifndef GL_PIXEL_UNPACK_BUFFER
629c54dc7e0d support for rectangular and streaming textures.
reimar
parents: 14142
diff changeset
24 #define GL_PIXEL_UNPACK_BUFFER 0x88EC
629c54dc7e0d support for rectangular and streaming textures.
reimar
parents: 14142
diff changeset
25 #endif
629c54dc7e0d support for rectangular and streaming textures.
reimar
parents: 14142
diff changeset
26 #ifndef GL_STREAM_DRAW
629c54dc7e0d support for rectangular and streaming textures.
reimar
parents: 14142
diff changeset
27 #define GL_STREAM_DRAW 0x88E0
629c54dc7e0d support for rectangular and streaming textures.
reimar
parents: 14142
diff changeset
28 #endif
16237
b951a75d4f83 Our buffer usage actually fits better to GL_DYNAMIC_DRAW than GL_STREAM_DRAW.
reimar
parents: 16233
diff changeset
29 #ifndef GL_DYNAMIC_DRAW
b951a75d4f83 Our buffer usage actually fits better to GL_DYNAMIC_DRAW than GL_STREAM_DRAW.
reimar
parents: 16233
diff changeset
30 #define GL_DYNAMIC_DRAW 0x88E8
b951a75d4f83 Our buffer usage actually fits better to GL_DYNAMIC_DRAW than GL_STREAM_DRAW.
reimar
parents: 16233
diff changeset
31 #endif
16099
629c54dc7e0d support for rectangular and streaming textures.
reimar
parents: 14142
diff changeset
32 #ifndef GL_WRITE_ONLY
629c54dc7e0d support for rectangular and streaming textures.
reimar
parents: 14142
diff changeset
33 #define GL_WRITE_ONLY 0x88B9
629c54dc7e0d support for rectangular and streaming textures.
reimar
parents: 14142
diff changeset
34 #endif
16117
d280ec2b9e63 More helper functions/defines and bugfixes
reimar
parents: 16109
diff changeset
35 #ifndef GL_BGR
d280ec2b9e63 More helper functions/defines and bugfixes
reimar
parents: 16109
diff changeset
36 #define GL_BGR 0x80E0
d280ec2b9e63 More helper functions/defines and bugfixes
reimar
parents: 16109
diff changeset
37 #endif
d280ec2b9e63 More helper functions/defines and bugfixes
reimar
parents: 16109
diff changeset
38 #ifndef GL_BGRA
d280ec2b9e63 More helper functions/defines and bugfixes
reimar
parents: 16109
diff changeset
39 #define GL_BGRA 0x80E1
d280ec2b9e63 More helper functions/defines and bugfixes
reimar
parents: 16109
diff changeset
40 #endif
d280ec2b9e63 More helper functions/defines and bugfixes
reimar
parents: 16109
diff changeset
41 #ifndef GL_UNSIGNED_BYTE_3_3_2
d280ec2b9e63 More helper functions/defines and bugfixes
reimar
parents: 16109
diff changeset
42 #define GL_UNSIGNED_BYTE_3_3_2 0x8032
d280ec2b9e63 More helper functions/defines and bugfixes
reimar
parents: 16109
diff changeset
43 #endif
d280ec2b9e63 More helper functions/defines and bugfixes
reimar
parents: 16109
diff changeset
44 #ifndef GL_UNSIGNED_BYTE_2_3_3_REV
d280ec2b9e63 More helper functions/defines and bugfixes
reimar
parents: 16109
diff changeset
45 #define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362
d280ec2b9e63 More helper functions/defines and bugfixes
reimar
parents: 16109
diff changeset
46 #endif
d280ec2b9e63 More helper functions/defines and bugfixes
reimar
parents: 16109
diff changeset
47 #ifndef GL_UNSIGNED_SHORT_5_6_5
d280ec2b9e63 More helper functions/defines and bugfixes
reimar
parents: 16109
diff changeset
48 #define GL_UNSIGNED_SHORT_5_6_5 0x8363
d280ec2b9e63 More helper functions/defines and bugfixes
reimar
parents: 16109
diff changeset
49 #endif
d280ec2b9e63 More helper functions/defines and bugfixes
reimar
parents: 16109
diff changeset
50 #ifndef GL_UNSIGNED_SHORT_5_6_5_REV
d280ec2b9e63 More helper functions/defines and bugfixes
reimar
parents: 16109
diff changeset
51 #define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364
d280ec2b9e63 More helper functions/defines and bugfixes
reimar
parents: 16109
diff changeset
52 #endif
d280ec2b9e63 More helper functions/defines and bugfixes
reimar
parents: 16109
diff changeset
53 #ifndef GL_UNSIGNED_SHORT_5_5_5_1
d280ec2b9e63 More helper functions/defines and bugfixes
reimar
parents: 16109
diff changeset
54 #define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
d280ec2b9e63 More helper functions/defines and bugfixes
reimar
parents: 16109
diff changeset
55 #endif
d280ec2b9e63 More helper functions/defines and bugfixes
reimar
parents: 16109
diff changeset
56 #ifndef GL_UNSIGNED_SHORT_1_5_5_5_REV
d280ec2b9e63 More helper functions/defines and bugfixes
reimar
parents: 16109
diff changeset
57 #define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366
d280ec2b9e63 More helper functions/defines and bugfixes
reimar
parents: 16109
diff changeset
58 #endif
16099
629c54dc7e0d support for rectangular and streaming textures.
reimar
parents: 14142
diff changeset
59
13653
799f81d3cb19 added gl_common for code used by both vo_gl.c and vo_gl2.c.
reimar
parents:
diff changeset
60 void glAdjustAlignment(int stride);
799f81d3cb19 added gl_common for code used by both vo_gl.c and vo_gl2.c.
reimar
parents:
diff changeset
61
14078
c4033dcb986f More similar code from gl and gl2 moved to gl_common
reimar
parents: 13921
diff changeset
62 const char *glValName(GLint value);
c4033dcb986f More similar code from gl and gl2 moved to gl_common
reimar
parents: 13921
diff changeset
63
16303
a87c6cf3fe52 Fix texture format variable types. Internal format is GLint, others are GLenum
reimar
parents: 16270
diff changeset
64 int glFindFormat(uint32_t format, uint32_t *bpp, GLint *gl_texfmt,
14078
c4033dcb986f More similar code from gl and gl2 moved to gl_common
reimar
parents: 13921
diff changeset
65 GLenum *gl_format, GLenum *gl_type);
16117
d280ec2b9e63 More helper functions/defines and bugfixes
reimar
parents: 16109
diff changeset
66 int glFmt2bpp(GLenum format, GLenum type);
d280ec2b9e63 More helper functions/defines and bugfixes
reimar
parents: 16109
diff changeset
67 void glCreateClearTex(GLenum target, GLenum fmt, GLint filter,
d280ec2b9e63 More helper functions/defines and bugfixes
reimar
parents: 16109
diff changeset
68 int w, int h, char val);
d280ec2b9e63 More helper functions/defines and bugfixes
reimar
parents: 16109
diff changeset
69 void glUploadTex(GLenum target, GLenum format, GLenum type,
d280ec2b9e63 More helper functions/defines and bugfixes
reimar
parents: 16109
diff changeset
70 const char *data, int stride,
d280ec2b9e63 More helper functions/defines and bugfixes
reimar
parents: 16109
diff changeset
71 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
72 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
73 GLfloat tx, GLfloat ty, GLfloat tw, GLfloat th,
ede5b4afd262 Helper function for drawing texture and general cleanup of vo_gl2.c
reimar
parents: 16117
diff changeset
74 int sx, int sy, int rect_tex);
14078
c4033dcb986f More similar code from gl and gl2 moved to gl_common
reimar
parents: 13921
diff changeset
75
13843
3f28d2a56758 fullscreen fixes and GUI support for vo_gl
reimar
parents: 13653
diff changeset
76 //! could not set new window, will continue drawing into the old one.
3f28d2a56758 fullscreen fixes and GUI support for vo_gl
reimar
parents: 13653
diff changeset
77 #define SET_WINDOW_FAILED -1
3f28d2a56758 fullscreen fixes and GUI support for vo_gl
reimar
parents: 13653
diff changeset
78 //! new window is set, could even transfer the OpenGL context.
3f28d2a56758 fullscreen fixes and GUI support for vo_gl
reimar
parents: 13653
diff changeset
79 #define SET_WINDOW_OK 0
3f28d2a56758 fullscreen fixes and GUI support for vo_gl
reimar
parents: 13653
diff changeset
80 //! new window is set, but the OpenGL context needs to be reinitialized.
3f28d2a56758 fullscreen fixes and GUI support for vo_gl
reimar
parents: 13653
diff changeset
81 #define SET_WINDOW_REINIT 1
3f28d2a56758 fullscreen fixes and GUI support for vo_gl
reimar
parents: 13653
diff changeset
82
14142
f0c1ee83b216 Improving gl2 under windows, moving some functionality to gl_common
reimar
parents: 14078
diff changeset
83 #ifdef GL_WIN32
f0c1ee83b216 Improving gl2 under windows, moving some functionality to gl_common
reimar
parents: 14078
diff changeset
84 int setGlWindow(int *vinfo, HGLRC *context, HWND win);
f0c1ee83b216 Improving gl2 under windows, moving some functionality to gl_common
reimar
parents: 14078
diff changeset
85 void releaseGlContext(int *vinfo, HGLRC *context);
f0c1ee83b216 Improving gl2 under windows, moving some functionality to gl_common
reimar
parents: 14078
diff changeset
86 #else
13843
3f28d2a56758 fullscreen fixes and GUI support for vo_gl
reimar
parents: 13653
diff changeset
87 int setGlWindow(XVisualInfo **vinfo, GLXContext *context, Window win);
13921
ae1dfa5bc2e1 added missing declaration of releaseGlContext
reimar
parents: 13843
diff changeset
88 void releaseGlContext(XVisualInfo **vinfo, GLXContext *context);
13653
799f81d3cb19 added gl_common for code used by both vo_gl.c and vo_gl2.c.
reimar
parents:
diff changeset
89 #endif
13843
3f28d2a56758 fullscreen fixes and GUI support for vo_gl
reimar
parents: 13653
diff changeset
90
16233
f00a2826ee11 use GenBuffers to get a buffer number instead of hardcoding 1.
reimar
parents: 16214
diff changeset
91 extern void (APIENTRY *GenBuffers)(GLsizei, GLuint *);
f00a2826ee11 use GenBuffers to get a buffer number instead of hardcoding 1.
reimar
parents: 16214
diff changeset
92 extern void (APIENTRY *DeleteBuffers)(GLsizei, const GLuint *);
16099
629c54dc7e0d support for rectangular and streaming textures.
reimar
parents: 14142
diff changeset
93 extern void (APIENTRY *BindBuffer)(GLenum, GLuint);
629c54dc7e0d support for rectangular and streaming textures.
reimar
parents: 14142
diff changeset
94 extern GLvoid* (APIENTRY *MapBuffer)(GLenum, GLenum);
629c54dc7e0d support for rectangular and streaming textures.
reimar
parents: 14142
diff changeset
95 extern GLboolean (APIENTRY *UnmapBuffer)(GLenum);
16109
519a307e3ccf OpenGL fixes for windows and vo_gl.c ported to windows.
reimar
parents: 16099
diff changeset
96 extern void (APIENTRY *BufferData)(GLenum, intptr_t, const GLvoid *, GLenum);
16099
629c54dc7e0d support for rectangular and streaming textures.
reimar
parents: 14142
diff changeset
97 extern void (APIENTRY *CombinerParameterfv)(GLenum, const GLfloat *);
629c54dc7e0d support for rectangular and streaming textures.
reimar
parents: 14142
diff changeset
98 extern void (APIENTRY *CombinerParameteri)(GLenum, GLint);
629c54dc7e0d support for rectangular and streaming textures.
reimar
parents: 14142
diff changeset
99 extern void (APIENTRY *CombinerInput)(GLenum, GLenum, GLenum, GLenum, GLenum,
629c54dc7e0d support for rectangular and streaming textures.
reimar
parents: 14142
diff changeset
100 GLenum);
629c54dc7e0d support for rectangular and streaming textures.
reimar
parents: 14142
diff changeset
101 extern void (APIENTRY *CombinerOutput)(GLenum, GLenum, GLenum, GLenum, GLenum,
629c54dc7e0d support for rectangular and streaming textures.
reimar
parents: 14142
diff changeset
102 GLenum, GLenum, GLboolean, GLboolean,
629c54dc7e0d support for rectangular and streaming textures.
reimar
parents: 14142
diff changeset
103 GLboolean);
629c54dc7e0d support for rectangular and streaming textures.
reimar
parents: 14142
diff changeset
104 extern void (APIENTRY *ActiveTexture)(GLenum);
629c54dc7e0d support for rectangular and streaming textures.
reimar
parents: 14142
diff changeset
105 extern void (APIENTRY *BindTexture)(GLenum, GLuint);
629c54dc7e0d support for rectangular and streaming textures.
reimar
parents: 14142
diff changeset
106 extern void (APIENTRY *MultiTexCoord2f)(GLenum, GLfloat, GLfloat);
629c54dc7e0d support for rectangular and streaming textures.
reimar
parents: 14142
diff changeset
107 extern void (APIENTRY *BindProgram)(GLenum, GLuint);
629c54dc7e0d support for rectangular and streaming textures.
reimar
parents: 14142
diff changeset
108 extern void (APIENTRY *ProgramString)(GLenum, GLenum, GLsizei, const GLvoid *);
629c54dc7e0d support for rectangular and streaming textures.
reimar
parents: 14142
diff changeset
109 extern void (APIENTRY *ProgramEnvParameter4f)(GLenum, GLuint, GLfloat, GLfloat,
629c54dc7e0d support for rectangular and streaming textures.
reimar
parents: 14142
diff changeset
110 GLfloat, GLfloat);
16270
d5374d07492a Fix crash in windows
reimar
parents: 16268
diff changeset
111 extern int (APIENTRY *SwapInterval)(int);
16099
629c54dc7e0d support for rectangular and streaming textures.
reimar
parents: 14142
diff changeset
112
13843
3f28d2a56758 fullscreen fixes and GUI support for vo_gl
reimar
parents: 13653
diff changeset
113 #endif