1 /*
2  * GStreamer
3  * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.com>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  */
20 /*
21  * Cogl
22  *
23  * An object oriented GL/GLES Abstraction/Utility Layer
24  *
25  * Copyright (C) 2009, 2011 Intel Corporation.
26  *
27  * This library is free software; you can redistribute it and/or
28  * modify it under the terms of the GNU Lesser General Public
29  * License as published by the Free Software Foundation; either
30  * version 2 of the License, or (at your option) any later version.
31  *
32  * This library is distributed in the hope that it will be useful,
33  * but WITHOUT ANY WARRANTY; without even the implied warranty of
34  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
35  * Lesser General Public License for more details.
36  *
37  * You should have received a copy of the GNU Lesser General Public
38  * License along with this library. If not, see <http://www.gnu.org/licenses/>.
39  */
40 
41 
42 /* These are the core GL functions which we assume will always be
43    available */
44 GST_GL_EXT_BEGIN (core,
45                   GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
46                   GST_GL_API_GLES1 | GST_GL_API_GLES2,
47                   1, 0,
48                   1, 0,
49                   "\0",
50                   "\0")
51 GST_GL_EXT_FUNCTION (void, BindTexture,
52                      (GLenum target, GLuint texture))
53 GST_GL_EXT_FUNCTION (void, BlendFunc,
54                      (GLenum sfactor, GLenum dfactor))
55 GST_GL_EXT_FUNCTION (void, Clear,
56                      (GLbitfield mask))
57 GST_GL_EXT_FUNCTION (void, ClearColor,
58                      (GLclampf red,
59                       GLclampf green,
60                       GLclampf blue,
61                       GLclampf alpha))
62 GST_GL_EXT_FUNCTION (void, ClearStencil,
63                      (GLint s))
64 GST_GL_EXT_FUNCTION (void, ColorMask,
65                      (GLboolean red,
66                       GLboolean green,
67                       GLboolean blue,
68                       GLboolean alpha))
69 GST_GL_EXT_FUNCTION (void, CopyTexSubImage2D,
70                      (GLenum target,
71                       GLint level,
72                       GLint xoffset,
73                       GLint yoffset,
74                       GLint x,
75                       GLint y,
76                       GLsizei width,
77                       GLsizei height))
78 GST_GL_EXT_FUNCTION (void, DeleteTextures,
79                      (GLsizei n, const GLuint* textures))
80 GST_GL_EXT_FUNCTION (void, DepthFunc,
81                      (GLenum func))
82 GST_GL_EXT_FUNCTION (void, DepthMask,
83                      (GLboolean flag))
84 GST_GL_EXT_FUNCTION (void, Disable,
85                      (GLenum cap))
86 GST_GL_EXT_FUNCTION (void, DrawArrays,
87                      (GLenum mode, GLint first, GLsizei count))
88 GST_GL_EXT_FUNCTION (void, DrawElements,
89                      (GLenum mode,
90                       GLsizei count,
91                       GLenum type,
92                       const GLvoid* indices))
93 GST_GL_EXT_FUNCTION (void, Enable,
94                      (GLenum cap))
95 GST_GL_EXT_FUNCTION (void, Finish,
96                      (void))
97 GST_GL_EXT_FUNCTION (void, Flush,
98                      (void))
99 GST_GL_EXT_FUNCTION (void, FrontFace,
100                      (GLenum mode))
101 GST_GL_EXT_FUNCTION (void, CullFace,
102                      (GLenum mode))
103 GST_GL_EXT_FUNCTION (void, GenTextures,
104                      (GLsizei n, GLuint* textures))
105 GST_GL_EXT_FUNCTION (GLenum, GetError,
106                      (void))
107 GST_GL_EXT_FUNCTION (void, GetIntegerv,
108                      (GLenum pname, GLint* params))
109 GST_GL_EXT_FUNCTION (void, GetBooleanv,
110                      (GLenum pname, GLboolean* params))
111 GST_GL_EXT_FUNCTION (void, GetFloatv,
112                      (GLenum pname, GLfloat* params))
113 GST_GL_EXT_FUNCTION (const GLubyte*, GetString,
114                      (GLenum name))
115 GST_GL_EXT_FUNCTION (void, Hint,
116                      (GLenum target, GLenum mode))
117 GST_GL_EXT_FUNCTION (GLboolean, IsTexture,
118                      (GLuint texture))
119 GST_GL_EXT_FUNCTION (void, PixelStorei,
120                      (GLenum pname, GLint param))
121 GST_GL_EXT_FUNCTION (void, ReadPixels,
122                      (GLint x,
123                       GLint y,
124                       GLsizei width,
125                       GLsizei height,
126                       GLenum format,
127                       GLenum type,
128                       GLvoid* pixels))
129 GST_GL_EXT_FUNCTION (void, Scissor,
130                      (GLint x, GLint y, GLsizei width, GLsizei height))
131 GST_GL_EXT_FUNCTION (void, StencilFunc,
132                      (GLenum func, GLint ref, GLuint mask))
133 GST_GL_EXT_FUNCTION (void, StencilMask,
134                      (GLuint mask))
135 GST_GL_EXT_FUNCTION (void, StencilOp,
136                      (GLenum fail, GLenum zfail, GLenum zpass))
137 GST_GL_EXT_FUNCTION (void, TexImage2D,
138                      (GLenum target,
139                       GLint level,
140                       GLint internalformat,
141                       GLsizei width,
142                       GLsizei height,
143                       GLint border,
144                       GLenum format,
145                       GLenum type,
146                       const GLvoid* pixels))
147 GST_GL_EXT_FUNCTION (void, TexParameterfv,
148                      (GLenum target, GLenum pname, const GLfloat* params))
149 GST_GL_EXT_FUNCTION (void, TexParameteri,
150                      (GLenum target, GLenum pname, GLint param))
151 GST_GL_EXT_FUNCTION (void, TexParameteriv,
152                      (GLenum target, GLenum pname, const GLint* params))
153 GST_GL_EXT_FUNCTION (void, GetTexParameterfv,
154                      (GLenum target, GLenum pname, GLfloat* params))
155 GST_GL_EXT_FUNCTION (void, GetTexParameteriv,
156                      (GLenum target, GLenum pname, GLint* params))
157 GST_GL_EXT_FUNCTION (void, TexSubImage2D,
158                      (GLenum target,
159                       GLint level,
160                       GLint xoffset,
161                       GLint yoffset,
162                       GLsizei width,
163                       GLsizei height,
164                       GLenum format,
165                       GLenum type,
166                       const GLvoid* pixels))
167 GST_GL_EXT_FUNCTION (void, CopyTexImage2D,
168                      (GLenum target,
169                       GLint level,
170                       GLenum internalformat,
171                       GLint x,
172                       GLint y,
173                       GLsizei width,
174                       GLsizei height,
175                       GLint border))
176 GST_GL_EXT_FUNCTION (void, Viewport,
177                      (GLint x, GLint y, GLsizei width, GLsizei height))
178 GST_GL_EXT_FUNCTION (GLboolean, IsEnabled, (GLenum cap))
179 GST_GL_EXT_FUNCTION (void, LineWidth, (GLfloat width))
180 GST_GL_EXT_FUNCTION (void, PolygonOffset, (GLfloat factor, GLfloat units))
181 GST_GL_EXT_FUNCTION (void, TexParameterf,
182                      (GLenum target,
183                       GLenum pname,
184                       GLfloat param))
185 GST_GL_EXT_END ()
186 
187 GST_GL_EXT_BEGIN (texture_3d,
188                   GST_GL_API_OPENGL | GST_GL_API_OPENGL3,
189                   1, 2,
190                   255, 255, /* not in either GLES */
191                   "OES\0",
192                   "texture_3D\0")
193 GST_GL_EXT_FUNCTION (void, TexImage3D,
194                      (GLenum target, GLint level,
195                       GLint internalFormat,
196                       GLsizei width, GLsizei height,
197                       GLsizei depth, GLint border,
198                       GLenum format, GLenum type,
199                       const GLvoid *pixels))
200 GST_GL_EXT_FUNCTION (void, TexSubImage3D,
201                      (GLenum target, GLint level,
202                       GLint xoffset, GLint yoffset,
203                       GLint zoffset, GLsizei width,
204                       GLsizei height, GLsizei depth,
205                       GLenum format,
206                       GLenum type, const GLvoid *pixels))
207 GST_GL_EXT_END ()
208 
209 GST_GL_EXT_BEGIN (only_in_both_gles_and_gl_1_3,
210                   GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
211                   GST_GL_API_GLES1 | GST_GL_API_GLES2,
212                   1, 3,
213                   1, 0,
214                   "\0",
215                   "\0")
216 GST_GL_EXT_FUNCTION (void, CompressedTexImage2D,
217                      (GLenum target,
218                       GLint level,
219                       GLenum internalformat,
220                       GLsizei width,
221                       GLsizei height,
222                       GLint border,
223                       GLsizei imageSize,
224                       const GLvoid* data))
225 GST_GL_EXT_FUNCTION (void, CompressedTexSubImage2D,
226                      (GLenum target,
227                       GLint level,
228                       GLint xoffset,
229                       GLint yoffset,
230                       GLsizei width,
231                       GLsizei height,
232                       GLenum format,
233                       GLsizei imageSize,
234                       const GLvoid* data))
235 GST_GL_EXT_FUNCTION (void, SampleCoverage,
236                      (GLclampf value, GLboolean invert))
237 GST_GL_EXT_END ()
238 
239 GST_GL_EXT_BEGIN (only_in_both_gles_and_gl_1_5,
240                   GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
241                   GST_GL_API_GLES1 | GST_GL_API_GLES2,
242                   1, 5,
243                   1, 0,
244                   "\0",
245                   "\0")
246 GST_GL_EXT_FUNCTION (void, GetBufferParameteriv,
247                      (GLenum target, GLenum pname, GLint* params))
248 GST_GL_EXT_END ()
249 
250 GST_GL_EXT_BEGIN (vbos,
251                   GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
252                   GST_GL_API_GLES1 | GST_GL_API_GLES2,
253                   1, 5,
254                   1, 0,
255                   "ARB\0",
256                   "vertex_buffer_object\0")
257 GST_GL_EXT_FUNCTION (void, GenBuffers,
258                      (GLsizei		 n,
259                       GLuint		*buffers))
260 GST_GL_EXT_FUNCTION (void, BindBuffer,
261                      (GLenum		 target,
262                       GLuint		 buffer))
263 GST_GL_EXT_FUNCTION (void, BufferData,
264                      (GLenum		 target,
265                       GLsizeiptr		 size,
266                       const GLvoid		*data,
267                       GLenum		 usage))
268 GST_GL_EXT_FUNCTION (void, BufferSubData,
269                      (GLenum		 target,
270                       GLintptr		 offset,
271                       GLsizeiptr		 size,
272                       const GLvoid		*data))
273 GST_GL_EXT_FUNCTION (void, DeleteBuffers,
274                      (GLsizei		 n,
275                       const GLuint		*buffers))
276 GST_GL_EXT_FUNCTION (GLboolean, IsBuffer,
277                      (GLuint               buffer))
278 GST_GL_EXT_END ()
279 
280 /* Available in GL 1.3, the multitexture extension or GLES. These are
281    required */
282 GST_GL_EXT_BEGIN (multitexture_part0,
283                   GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
284                   GST_GL_API_GLES1 | GST_GL_API_GLES2,
285                   1, 3,
286                   1, 0,
287                   "ARB\0",
288                   "multitexture\0")
289 GST_GL_EXT_FUNCTION (void, ActiveTexture,
290                    (GLenum                texture))
291 GST_GL_EXT_END ()
292 
293 
294  /* GLES doesn't support mapping buffers in core so this has to be a
295    separate check */
296 GST_GL_EXT_BEGIN (map_vbos,
297                   GST_GL_API_OPENGL | GST_GL_API_OPENGL3,
298                   1, 5,
299                   255, 255, /* not in GLES core */
300                   "ARB\0OES\0",
301                   "vertex_buffer_object\0mapbuffer\0")
302 GST_GL_EXT_FUNCTION (void *, MapBuffer,
303                    (GLenum		 target,
304                     GLenum		 access))
305 GST_GL_EXT_END ()
306 
307 GST_GL_EXT_BEGIN (unmap_buffer,
308                   GST_GL_API_OPENGL | GST_GL_API_OPENGL3 | GST_GL_API_GLES2,
309                   1, 5,
310                   3, 0,
311                   "ARB\0OES\0",
312                   "vertex_buffer_object\0mapbuffer\0")
313 GST_GL_EXT_FUNCTION (GLboolean, UnmapBuffer,
314                    (GLenum		 target))
315 GST_GL_EXT_END ()
316 
317 GST_GL_EXT_BEGIN (gl3,
318                   GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
319                   GST_GL_API_GLES2,
320                   3, 0,
321                   3, 0,
322                   "\0",
323                   "\0")
324 GST_GL_EXT_FUNCTION (const GLubyte*, GetStringi,
325                      (GLenum name, GLint index))
326 GST_GL_EXT_FUNCTION (void *, MapBufferRange,
327                      (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access))
328 GST_GL_EXT_END ()
329