aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/evas/src/lib/Evas_GL.h
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/evas/src/lib/Evas_GL.h')
-rw-r--r--libraries/evas/src/lib/Evas_GL.h1412
1 files changed, 1412 insertions, 0 deletions
diff --git a/libraries/evas/src/lib/Evas_GL.h b/libraries/evas/src/lib/Evas_GL.h
new file mode 100644
index 0000000..04bedea
--- /dev/null
+++ b/libraries/evas/src/lib/Evas_GL.h
@@ -0,0 +1,1412 @@
1#ifndef _EVAS_GL_H
2#define _EVAS_GL_H
3
4#include <Evas.h>
5//#include <GL/gl.h>
6
7#ifdef __cplusplus
8extern "C" {
9#endif
10
11typedef struct _Evas_GL Evas_GL;
12typedef struct _Evas_GL_Surface Evas_GL_Surface;
13typedef struct _Evas_GL_Context Evas_GL_Context;
14typedef struct _Evas_GL_Config Evas_GL_Config;
15typedef struct _Evas_GL_API Evas_GL_API;
16typedef void *Evas_GL_Func;
17typedef void *EvasGLImage;
18
19typedef enum _Evas_GL_Color_Format
20{
21 EVAS_GL_RGB_888 = 0,
22 EVAS_GL_RGBA_8888 = 1
23} Evas_GL_Color_Format;
24
25typedef enum _Evas_GL_Depth_Bits
26{
27 EVAS_GL_DEPTH_NONE = 0,
28 EVAS_GL_DEPTH_BIT_8 = 1,
29 EVAS_GL_DEPTH_BIT_16 = 2,
30 EVAS_GL_DEPTH_BIT_24 = 3,
31 EVAS_GL_DEPTH_BIT_32 = 4,
32} Evas_GL_Depth_Bits;
33
34typedef enum _Evas_GL_Stencil_Bits
35{
36 EVAS_GL_STENCIL_NONE = 0,
37 EVAS_GL_STENCIL_BIT_1 = 1,
38 EVAS_GL_STENCIL_BIT_2 = 2,
39 EVAS_GL_STENCIL_BIT_4 = 3,
40 EVAS_GL_STENCIL_BIT_8 = 4,
41 EVAS_GL_STENCIL_BIT_16 = 5,
42} Evas_GL_Stencil_Bits;
43
44struct _Evas_GL_Config
45{
46 Evas_GL_Color_Format color_format;
47 Evas_GL_Depth_Bits depth_bits;
48 Evas_GL_Stencil_Bits stencil_bits;
49};
50
51#define EVAS_GL_EXTENSIONS 1
52
53
54/**
55 * @defgroup Evas_GL Rendering GL on Evas
56 *
57 * Functions that are used to do OpenGL rendering on Evas. Evas allows you
58 * to use OpenGL to render to specially set up image objects (which act as
59 * render target surfaces).
60 *
61 * Below is an illlustrative example of how to use OpenGL to render to an
62 * object in Evas.
63 *
64 * @code
65// Simple Evas_GL example
66#include <Ecore_Evas.h>
67#include <Ecore.h>
68#include <Evas_GL.h>
69#include <stdio.h>
70
71// GL related data here..
72typedef struct _GLData
73{
74 Evas_GL_Context *ctx;
75 Evas_GL_Surface *sfc;
76 Evas_GL *evasgl;
77 Evas_GL_API *glapi;
78 GLuint program;
79 GLuint vtx_shader;
80 GLuint fgmt_shader;
81 Eina_Bool initialized : 1;
82} GLData;
83
84// callbacks we want to handle deletion on the object and updates/draws
85static void on_del (void *data, Evas *e, Evas_Object *obj, void *event_info);
86static void on_pixels (void *data, Evas_Object *obj);
87// demo - animator just to keep ticking over saying to draw the image
88static Eina_Bool on_animate (void *data);
89// gl stuff
90static int init_shaders (GLData *gld);
91static GLuint load_shader (GLData *gld, GLenum type, const char *shader_src);
92
93int
94main(int argc, char **argv)
95{
96 // config for the surface for evas_gl
97 Evas_GL_Config config =
98 {
99 EVAS_GL_RGBA_8888,
100 EVAS_GL_DEPTH_NONE,
101 EVAS_GL_STENCIL_NONE
102 };
103 // a size by default
104 int w = 256, h = 256;
105 // some variables we will use
106 Ecore_Evas *ee;
107 Evas *canvas;
108 Evas_Object *r1;
109 Evas_Native_Surface ns;
110 GLData *gld = NULL;
111
112 // regular low-leve EFL (ecore+ecore-evas) init. elm is simpler
113 ecore_init();
114 ecore_evas_init();
115 ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 512, 512);
116 ecore_evas_title_set(ee, "Ecore_Evas Template");
117 canvas = ecore_evas_get(ee);
118
119 // alloc a data struct to hold our relevant gl info in
120 if (!(gld = calloc(1, sizeof(GLData)))) return 0;
121
122 //-//-//-// THIS IS WHERE GL INIT STUFF HAPPENS (ALA EGL)
123 //-//
124 // get the evas gl handle for doing gl things
125 gld->evasgl = evas_gl_new(canvas);
126 gld->glapi = evas_gl_api_get(gld->evasgl);
127 // create a surface and context
128 gld->sfc = evas_gl_surface_create(gld->evasgl, &config, w, h);
129 gld->ctx = evas_gl_context_create(gld->evasgl, NULL);
130 //-//
131 //-//-//-// END GL INIT BLOB
132
133 // set up the image object. a filled one by default
134 r1 = evas_object_image_filled_add(canvas);
135 // attach important data we need to the object using key names. this just
136 // avoids some global variables and means we can do nice cleanup. you can
137 // avoid this if you are lazy
138 evas_object_data_set(r1, "..gld", gld);
139 // when the object is deleted - call the on_del callback. like the above,
140 // this is just being clean
141 evas_object_event_callback_add(r1, EVAS_CALLBACK_DEL, on_del, NULL);
142 // set up an actual pixel size fot the buffer data. it may be different
143 // to the output size. any windowing system has something like this, just
144 // evas has 2 sizes, a pixel size and the output object size
145 evas_object_image_size_set(r1, w, h);
146 // set up the native surface info to use the context and surface created
147 // above
148
149 //-//-//-// THIS IS WHERE GL INIT STUFF HAPPENS (ALA EGL)
150 //-//
151 evas_gl_native_surface_get(gld->evasgl, gld->sfc, &ns);
152 evas_object_image_native_surface_set(r1, &ns);
153 evas_object_image_pixels_get_callback_set(r1, on_pixels, r1);
154 //-//
155 //-//-//-// END GL INIT BLOB
156
157 // move the image object somewhere, resize it and show it. any windowing
158 // system would need this kind of thing - place a child "window"
159 evas_object_move(r1, 128, 128);
160 evas_object_resize(r1, w, h);
161 evas_object_show(r1);
162
163 // animating - just a demo. as long as you trigger an update on the image
164 // object via evas_object_image_pixels_dirty_set(). any display system,
165 // mainloop siztem etc. will have something of this kind unless it's making
166 // you spin infinitely yourself and invent your own animation mechanism
167 //
168 // NOTE: if you delete r1, this animator will keep running trying to access
169 // r1 so you'd better delete this animator with ecore_animator_del() or
170 // structure how you do animation differently. you can also attach it like
171 // evasgl, sfc, etc. etc. if this animator is specific to this object
172 // only and delete it in the del handler for the obj.
173 ecore_animator_add(on_animate, r1);
174
175 // finally show the window for the world to see. windowing system generic
176 ecore_evas_show(ee);
177
178 // begin the mainloop and tick over the animator, handle events etc.
179 // also windowing system generic
180 ecore_main_loop_begin();
181
182 // standard EFL shutdown stuff - generic for most systems, EFL or not
183 ecore_evas_shutdown();
184 ecore_shutdown();
185 return 0;
186}
187
188static void
189on_del(void *data, Evas *e, Evas_Object *obj, void *event_info)
190{
191 // on delete of our object clean up some things that don't get auto
192 // celeted for us as they are not intrinsically bound to the image
193 // object as such (you could use the same context and surface across
194 // multiple image objects and re-use the evasgl handle too multiple times.
195 // here we bind them to 1 object only though by doing this.
196 GLData *gld = evas_object_data_get(obj, "..gld");
197 if (!gld) return;
198 Evas_GL_API *gl = gld->glapi;
199
200 evas_object_data_del(obj, "..gld");
201
202 // Do a make_current before deleting all the GL stuff.
203 evas_gl_make_current(gld->evasgl, gld->sfc, gld->ctx);
204 gl->glDeleteShader(gld->vtx_shader);
205 gl->glDeleteShader(gld->fgmt_shader);
206 gl->glDeleteProgram(gld->program);
207
208 evas_gl_surface_destroy(gld->evasgl, gld->sfc);
209 evas_gl_context_destroy(gld->evasgl, gld->ctx);
210 evas_gl_free(gld->evasgl);
211 free(gld);
212}
213
214static void
215on_pixels(void *data, Evas_Object *obj)
216{
217 // get some variable we need from the object data keys
218 GLData *gld = evas_object_data_get(obj, "..gld");
219 if (!gld) return;
220 Evas_GL_API *gl = gld->glapi;
221 GLfloat vVertices[] =
222 {
223 0.0f, 0.5f, 0.0f,
224 -0.5f, -0.5f, 0.0f,
225 0.5f, -0.5f, 0.0f
226 };
227 int w, h;
228
229 // get the image size in case it changed with evas_object_image_size_set()
230 evas_object_image_size_get(obj, &w, &h);
231 // set up the context and surface as the current one
232 evas_gl_make_current(gld->evasgl, gld->sfc, gld->ctx);
233
234 if (!gld->initialized)
235 {
236 if (!init_shaders(gld)) printf("Error Initializing Shaders\n");
237 gld->initialized = EINA_TRUE;
238 }
239
240 // GL Viewport stuff. you can avoid doing this if viewport is all the
241 // same as last frame if you want
242 gl->glViewport(0, 0, w, h);
243
244 // Clear the buffer
245 gl->glClearColor(1.0, 0.0, 0.0, 1);
246 gl->glClear(GL_COLOR_BUFFER_BIT);
247
248 // Draw a Triangle
249 gl->glEnable(GL_BLEND);
250
251 gl->glUseProgram(gld->program);
252
253 gl->glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, vVertices);
254 gl->glEnableVertexAttribArray(0);
255
256 gl->glDrawArrays(GL_TRIANGLES, 0, 3);
257
258 // Optional - Flush the GL pipeline
259 gl->glFlush();
260}
261
262static Eina_Bool
263on_animate(void *data)
264{
265 // just a demo - animate here whenever an animation tick happens and then
266 // mark the image as "dirty" meaning it needs an update next time evas
267 // renders. it will call the pixel get callback then.
268 evas_object_image_pixels_dirty_set(data, EINA_TRUE);
269 return EINA_TRUE; // keep looping
270}
271
272static GLuint
273load_shader(GLData *gld, GLenum type, const char *shader_src)
274{
275 Evas_GL_API *gl = gld->glapi;
276 GLuint shader;
277 GLint compiled = 0;
278
279 // Create the shader object
280 if (!(shader = gl->glCreateShader(type))) return 0;
281 gl->glShaderSource(shader, 1, &shader_src, NULL);
282 // Compile the shader
283 gl->glCompileShader(shader);
284 gl->glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled);
285
286 if (!compiled)
287 {
288 GLint len = 0;
289
290 gl->glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &len);
291 if (len > 1)
292 {
293 char *info = malloc(sizeof(char) * len);
294
295 if (info)
296 {
297 gl->glGetShaderInfoLog(shader, len, NULL, info);
298 printf("Error compiling shader:\n"
299 "%s\n", info);
300 free(info);
301 }
302 }
303 gl->glDeleteShader(shader);
304 return 0;
305 }
306 return shader;
307}
308
309// Initialize the shader and program object
310static int
311init_shaders(GLData *gld)
312{
313 Evas_GL_API *gl = gld->glapi;
314 const char vShaderStr[] =
315 "attribute vec4 vPosition; \n"
316 "void main() \n"
317 "{ \n"
318 " gl_Position = vPosition; \n"
319 "} \n";
320 const char fShaderStr[] =
321 "precision mediump float; \n"
322 "void main() \n"
323 "{ \n"
324 " gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n"
325 "} \n";
326 GLint linked = 0;
327
328 // Load the vertex/fragment shaders
329 gld->vtx_shader = load_shader(gld, GL_VERTEX_SHADER, vShaderStr);
330 gld->fgmt_shader = load_shader(gld, GL_FRAGMENT_SHADER, fShaderStr);
331
332 // Create the program object
333 if (!(gld->program = gl->glCreateProgram())) return 0;
334
335 gl->glAttachShader(gld->program, gld->vtx_shader);
336 gl->glAttachShader(gld->program, gld->fgmt_shader);
337
338 // Bind vPosition to attribute 0
339 gl->glBindAttribLocation(gld->program, 0, "vPosition");
340 // Link the program
341 gl->glLinkProgram(gld->program);
342 gl->glGetProgramiv(gld->program, GL_LINK_STATUS, &linked);
343
344 if (!linked)
345 {
346 GLint len = 0;
347
348 gl->glGetProgramiv(gld->program, GL_INFO_LOG_LENGTH, &len);
349 if (len > 1)
350 {
351 char *info = malloc(sizeof(char) * len);
352
353 if (info)
354 {
355 gl->glGetProgramInfoLog(gld->program, len, NULL, info);
356 printf("Error linking program:\n"
357 "%s\n", info);
358 free(info);
359 }
360 }
361 gl->glDeleteProgram(gld->program);
362 return 0;
363 }
364 return 1;
365}
366 * @endcode
367 *
368 * @ingroup Evas_Canvas
369 */
370
371/**
372 * @addtogroup Evas_GL
373 * @{
374 */
375
376/**
377 * Creates a new Evas_GL object and returns a handle for gl rendering on efl.
378 *
379 * @param e The given evas canvas OpenGL is to be used on.
380 * @return The created evas_gl object, or NULl on fasilure.
381 */
382EAPI Evas_GL *evas_gl_new (Evas *e) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1);
383
384/**
385 * Frees the created Evas_GL object.
386 *
387 * @param evas_gl The given Evas_GL object.
388 */
389EAPI void evas_gl_free (Evas_GL *evas_gl) EINA_ARG_NONNULL(1);
390
391/**
392 * Creates and returns new Evas_GL_Surface object for GL Rendering.
393 *
394 * @param evas_gl The given Evas_GL object.
395 * @param config The pixel format and configuration of the rendering surface.
396 * @param width The width of the surface.
397 * @param height The height of the surface.
398 * @return The created GL surface object, or NULL on failure.
399 */
400EAPI Evas_GL_Surface *evas_gl_surface_create (Evas_GL *evas_gl, Evas_GL_Config *cfg, int w, int h) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1,2);
401
402/**
403 * Destroys the created Evas GL Surface.
404 *
405 * @param evas_gl The given Evas_GL object.
406 * @param surf The given GL surface object.
407 */
408EAPI void evas_gl_surface_destroy (Evas_GL *evas_gl, Evas_GL_Surface *surf) EINA_ARG_NONNULL(1,2);
409
410/**
411 * Creates and returns a new Evas GL context object
412 *
413 * @param evas_gl The given Evas_GL object.
414 * @return The created context, or NULL on failure.
415 */
416EAPI Evas_GL_Context *evas_gl_context_create (Evas_GL *evas_gl, Evas_GL_Context *share_ctx) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1);
417
418/**
419 * Destroys the given Evas GL context object
420 *
421 * @param evas_gl The given Evas_GL object.
422 * @param ctx The given Evas GL context.
423 */
424EAPI void evas_gl_context_destroy (Evas_GL *evas_gl, Evas_GL_Context *ctx) EINA_ARG_NONNULL(1,2);
425
426/**
427 * Sets the given context as a current context for the given surface
428 *
429 * @param evas_gl The given Evas_GL object.
430 * @param surf The given Evas GL surface.
431 * @param ctx The given Evas GL context.
432 * @return EINA_TRUE if successful, EINA_FALSE if not.
433 */
434EAPI Eina_Bool evas_gl_make_current (Evas_GL *evas_gl, Evas_GL_Surface *surf, Evas_GL_Context *ctx) EINA_ARG_NONNULL(1,2);
435
436/**
437 * Returns a pointer to a static, zero-terminated string describing some aspect of evas_gl.
438 *
439 * @param evas_gl The given Evas_GL object.
440 * @param name Specifies a symbolic constant, one of EVAS_GL_EXTENSIONS...
441 */
442EAPI const char *evas_gl_string_query (Evas_GL *evas_gl, int name) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
443
444/**
445 * Returns a GL or the Glue Layer's extension function.
446 *
447 * @param evas_gl The given Evas_GL object.
448 * @param name The name of the function to return.
449 */
450EAPI Evas_GL_Func evas_gl_proc_address_get (Evas_GL *evas_gl, const char *name) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1,2) EINA_PURE;
451
452/**
453 * Fills in the Native Surface information from the given Evas GL surface.
454 *
455 * @param evas_gl The given Evas_GL object.
456 * @param surf The given Evas GL surface to retrieve the Native Surface info from.
457 * @param ns The native surface structure that the function fills in.
458 * @return EINA_TRUE if successful, EINA_FALSE if not.
459 */
460EAPI Eina_Bool evas_gl_native_surface_get (Evas_GL *evas_gl, Evas_GL_Surface *surf, Evas_Native_Surface *ns) EINA_ARG_NONNULL(1,2,3);
461
462/**
463 * Get the API for rendering using OpenGL
464 *
465 * @param evas_gl The given Eva_GL object.
466 * @return The API to use.
467 *
468 * This returns a structure that contains all the OpenGL functions you can
469 * use to render in Evas. These functions consist of all the standard
470 * OpenGL-ES2.0 functions and any extra ones Evas has decided to provide in
471 * addition. This means that if you have your code ported to OpenGL-ES2.0,
472 * it will be easy to render to Evas.
473 *
474 */
475EAPI Evas_GL_API *evas_gl_api_get (Evas_GL *evas_gl) EINA_ARG_NONNULL(1);
476
477#if !defined(__gl_h_) && !defined(__gl2_h_)
478# define __gl_h_
479# define __gl2_h_
480
481/*
482 * This document is licensed under the SGI Free Software B License Version
483 * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
484 */
485
486/*-------------------------------------------------------------------------
487 * Data type definitions
488 *-----------------------------------------------------------------------*/
489
490typedef void GLvoid;
491typedef unsigned int GLenum;
492typedef unsigned char GLboolean;
493typedef unsigned int GLbitfield;
494typedef signed char GLbyte; // Changed khronos_int8_t
495typedef short GLshort;
496typedef int GLint;
497typedef int GLsizei;
498typedef unsigned char GLubyte; // Changed khronos_uint8_t
499typedef unsigned short GLushort;
500typedef unsigned int GLuint;
501typedef float GLfloat; // Changed khronos_float_t
502typedef float GLclampf; // Changed khronos_float_t
503typedef signed int GLfixed; // Changed khronos_int32_t
504
505/* GL types for handling large vertex buffer objects */
506typedef signed long int GLintptr; // Changed khronos_intptr_t
507typedef signed long int GLsizeiptr; // Changed khronos_ssize_t
508
509//#if (!defined(__gl2_h_) && !defined(__gl_h_))
510
511/* OpenGL ES core versions */
512//#define GL_ES_VERSION_2_0 1
513
514/* ClearBufferMask */
515#define GL_DEPTH_BUFFER_BIT 0x00000100
516#define GL_STENCIL_BUFFER_BIT 0x00000400
517#define GL_COLOR_BUFFER_BIT 0x00004000
518
519/* Boolean */
520#define GL_FALSE 0
521#define GL_TRUE 1
522
523/* BeginMode */
524#define GL_POINTS 0x0000
525#define GL_LINES 0x0001
526#define GL_LINE_LOOP 0x0002
527#define GL_LINE_STRIP 0x0003
528#define GL_TRIANGLES 0x0004
529#define GL_TRIANGLE_STRIP 0x0005
530#define GL_TRIANGLE_FAN 0x0006
531
532/* AlphaFunction (not supported in ES20) */
533/* GL_NEVER */
534/* GL_LESS */
535/* GL_EQUAL */
536/* GL_LEQUAL */
537/* GL_GREATER */
538/* GL_NOTEQUAL */
539/* GL_GEQUAL */
540/* GL_ALWAYS */
541
542/* BlendingFactorDest */
543#define GL_ZERO 0
544#define GL_ONE 1
545#define GL_SRC_COLOR 0x0300
546#define GL_ONE_MINUS_SRC_COLOR 0x0301
547#define GL_SRC_ALPHA 0x0302
548#define GL_ONE_MINUS_SRC_ALPHA 0x0303
549#define GL_DST_ALPHA 0x0304
550#define GL_ONE_MINUS_DST_ALPHA 0x0305
551
552/* BlendingFactorSrc */
553/* GL_ZERO */
554/* GL_ONE */
555#define GL_DST_COLOR 0x0306
556#define GL_ONE_MINUS_DST_COLOR 0x0307
557#define GL_SRC_ALPHA_SATURATE 0x0308
558/* GL_SRC_ALPHA */
559/* GL_ONE_MINUS_SRC_ALPHA */
560/* GL_DST_ALPHA */
561/* GL_ONE_MINUS_DST_ALPHA */
562
563/* BlendEquationSeparate */
564#define GL_FUNC_ADD 0x8006
565#define GL_BLEND_EQUATION 0x8009
566#define GL_BLEND_EQUATION_RGB 0x8009 /* same as BLEND_EQUATION */
567#define GL_BLEND_EQUATION_ALPHA 0x883D
568
569/* BlendSubtract */
570#define GL_FUNC_SUBTRACT 0x800A
571#define GL_FUNC_REVERSE_SUBTRACT 0x800B
572
573/* Separate Blend Functions */
574#define GL_BLEND_DST_RGB 0x80C8
575#define GL_BLEND_SRC_RGB 0x80C9
576#define GL_BLEND_DST_ALPHA 0x80CA
577#define GL_BLEND_SRC_ALPHA 0x80CB
578#define GL_CONSTANT_COLOR 0x8001
579#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002
580#define GL_CONSTANT_ALPHA 0x8003
581#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004
582#define GL_BLEND_COLOR 0x8005
583
584/* Buffer Objects */
585#define GL_ARRAY_BUFFER 0x8892
586#define GL_ELEMENT_ARRAY_BUFFER 0x8893
587#define GL_ARRAY_BUFFER_BINDING 0x8894
588#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895
589
590#define GL_STREAM_DRAW 0x88E0
591#define GL_STATIC_DRAW 0x88E4
592#define GL_DYNAMIC_DRAW 0x88E8
593
594#define GL_BUFFER_SIZE 0x8764
595#define GL_BUFFER_USAGE 0x8765
596
597#define GL_CURRENT_VERTEX_ATTRIB 0x8626
598
599/* CullFaceMode */
600#define GL_FRONT 0x0404
601#define GL_BACK 0x0405
602#define GL_FRONT_AND_BACK 0x0408
603
604/* DepthFunction */
605/* GL_NEVER */
606/* GL_LESS */
607/* GL_EQUAL */
608/* GL_LEQUAL */
609/* GL_GREATER */
610/* GL_NOTEQUAL */
611/* GL_GEQUAL */
612/* GL_ALWAYS */
613
614/* EnableCap */
615#define GL_TEXTURE_2D 0x0DE1
616#define GL_CULL_FACE 0x0B44
617#define GL_BLEND 0x0BE2
618#define GL_DITHER 0x0BD0
619#define GL_STENCIL_TEST 0x0B90
620#define GL_DEPTH_TEST 0x0B71
621#define GL_SCISSOR_TEST 0x0C11
622#define GL_POLYGON_OFFSET_FILL 0x8037
623#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E
624#define GL_SAMPLE_COVERAGE 0x80A0
625
626/* ErrorCode */
627#define GL_NO_ERROR 0
628#define GL_INVALID_ENUM 0x0500
629#define GL_INVALID_VALUE 0x0501
630#define GL_INVALID_OPERATION 0x0502
631#define GL_OUT_OF_MEMORY 0x0505
632
633/* FrontFaceDirection */
634#define GL_CW 0x0900
635#define GL_CCW 0x0901
636
637/* GetPName */
638#define GL_LINE_WIDTH 0x0B21
639#define GL_ALIASED_POINT_SIZE_RANGE 0x846D
640#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E
641#define GL_CULL_FACE_MODE 0x0B45
642#define GL_FRONT_FACE 0x0B46
643#define GL_DEPTH_RANGE 0x0B70
644#define GL_DEPTH_WRITEMASK 0x0B72
645#define GL_DEPTH_CLEAR_VALUE 0x0B73
646#define GL_DEPTH_FUNC 0x0B74
647#define GL_STENCIL_CLEAR_VALUE 0x0B91
648#define GL_STENCIL_FUNC 0x0B92
649#define GL_STENCIL_FAIL 0x0B94
650#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95
651#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96
652#define GL_STENCIL_REF 0x0B97
653#define GL_STENCIL_VALUE_MASK 0x0B93
654#define GL_STENCIL_WRITEMASK 0x0B98
655#define GL_STENCIL_BACK_FUNC 0x8800
656#define GL_STENCIL_BACK_FAIL 0x8801
657#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802
658#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803
659#define GL_STENCIL_BACK_REF 0x8CA3
660#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4
661#define GL_STENCIL_BACK_WRITEMASK 0x8CA5
662#define GL_VIEWPORT 0x0BA2
663#define GL_SCISSOR_BOX 0x0C10
664/* GL_SCISSOR_TEST */
665#define GL_COLOR_CLEAR_VALUE 0x0C22
666#define GL_COLOR_WRITEMASK 0x0C23
667#define GL_UNPACK_ALIGNMENT 0x0CF5
668#define GL_PACK_ALIGNMENT 0x0D05
669#define GL_MAX_TEXTURE_SIZE 0x0D33
670#define GL_MAX_VIEWPORT_DIMS 0x0D3A
671#define GL_SUBPIXEL_BITS 0x0D50
672#define GL_RED_BITS 0x0D52
673#define GL_GREEN_BITS 0x0D53
674#define GL_BLUE_BITS 0x0D54
675#define GL_ALPHA_BITS 0x0D55
676#define GL_DEPTH_BITS 0x0D56
677#define GL_STENCIL_BITS 0x0D57
678#define GL_POLYGON_OFFSET_UNITS 0x2A00
679/* GL_POLYGON_OFFSET_FILL */
680#define GL_POLYGON_OFFSET_FACTOR 0x8038
681#define GL_TEXTURE_BINDING_2D 0x8069
682#define GL_SAMPLE_BUFFERS 0x80A8
683#define GL_SAMPLES 0x80A9
684#define GL_SAMPLE_COVERAGE_VALUE 0x80AA
685#define GL_SAMPLE_COVERAGE_INVERT 0x80AB
686
687/* GetTextureParameter */
688/* GL_TEXTURE_MAG_FILTER */
689/* GL_TEXTURE_MIN_FILTER */
690/* GL_TEXTURE_WRAP_S */
691/* GL_TEXTURE_WRAP_T */
692
693#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
694#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
695
696/* HintMode */
697#define GL_DONT_CARE 0x1100
698#define GL_FASTEST 0x1101
699#define GL_NICEST 0x1102
700
701/* HintTarget */
702#define GL_GENERATE_MIPMAP_HINT 0x8192
703
704/* DataType */
705#define GL_BYTE 0x1400
706#define GL_UNSIGNED_BYTE 0x1401
707#define GL_SHORT 0x1402
708#define GL_UNSIGNED_SHORT 0x1403
709#define GL_INT 0x1404
710#define GL_UNSIGNED_INT 0x1405
711#define GL_FLOAT 0x1406
712#define GL_FIXED 0x140C
713
714/* PixelFormat */
715#define GL_DEPTH_COMPONENT 0x1902
716#define GL_ALPHA 0x1906
717#define GL_RGB 0x1907
718#define GL_RGBA 0x1908
719#define GL_LUMINANCE 0x1909
720#define GL_LUMINANCE_ALPHA 0x190A
721
722/* PixelType */
723/* GL_UNSIGNED_BYTE */
724#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033
725#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
726#define GL_UNSIGNED_SHORT_5_6_5 0x8363
727
728/* Shaders */
729#define GL_FRAGMENT_SHADER 0x8B30
730#define GL_VERTEX_SHADER 0x8B31
731#define GL_MAX_VERTEX_ATTRIBS 0x8869
732#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB
733#define GL_MAX_VARYING_VECTORS 0x8DFC
734#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D
735#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C
736#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872
737#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD
738#define GL_SHADER_TYPE 0x8B4F
739#define GL_DELETE_STATUS 0x8B80
740#define GL_LINK_STATUS 0x8B82
741#define GL_VALIDATE_STATUS 0x8B83
742#define GL_ATTACHED_SHADERS 0x8B85
743#define GL_ACTIVE_UNIFORMS 0x8B86
744#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87
745#define GL_ACTIVE_ATTRIBUTES 0x8B89
746#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A
747#define GL_SHADING_LANGUAGE_VERSION 0x8B8C
748#define GL_CURRENT_PROGRAM 0x8B8D
749
750/* StencilFunction */
751#define GL_NEVER 0x0200
752#define GL_LESS 0x0201
753#define GL_EQUAL 0x0202
754#define GL_LEQUAL 0x0203
755#define GL_GREATER 0x0204
756#define GL_NOTEQUAL 0x0205
757#define GL_GEQUAL 0x0206
758#define GL_ALWAYS 0x0207
759
760/* StencilOp */
761/* GL_ZERO */
762#define GL_KEEP 0x1E00
763#define GL_REPLACE 0x1E01
764#define GL_INCR 0x1E02
765#define GL_DECR 0x1E03
766#define GL_INVERT 0x150A
767#define GL_INCR_WRAP 0x8507
768#define GL_DECR_WRAP 0x8508
769
770/* StringName */
771#define GL_VENDOR 0x1F00
772#define GL_RENDERER 0x1F01
773#define GL_VERSION 0x1F02
774#define GL_EXTENSIONS 0x1F03
775
776/* TextureMagFilter */
777#define GL_NEAREST 0x2600
778#define GL_LINEAR 0x2601
779
780/* TextureMinFilter */
781/* GL_NEAREST */
782/* GL_LINEAR */
783#define GL_NEAREST_MIPMAP_NEAREST 0x2700
784#define GL_LINEAR_MIPMAP_NEAREST 0x2701
785#define GL_NEAREST_MIPMAP_LINEAR 0x2702
786#define GL_LINEAR_MIPMAP_LINEAR 0x2703
787
788/* TextureParameterName */
789#define GL_TEXTURE_MAG_FILTER 0x2800
790#define GL_TEXTURE_MIN_FILTER 0x2801
791#define GL_TEXTURE_WRAP_S 0x2802
792#define GL_TEXTURE_WRAP_T 0x2803
793
794/* TextureTarget */
795/* GL_TEXTURE_2D */
796#define GL_TEXTURE 0x1702
797
798#define GL_TEXTURE_CUBE_MAP 0x8513
799#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514
800#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515
801#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516
802#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517
803#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518
804#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519
805#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A
806#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C
807
808/* TextureUnit */
809#define GL_TEXTURE0 0x84C0
810#define GL_TEXTURE1 0x84C1
811#define GL_TEXTURE2 0x84C2
812#define GL_TEXTURE3 0x84C3
813#define GL_TEXTURE4 0x84C4
814#define GL_TEXTURE5 0x84C5
815#define GL_TEXTURE6 0x84C6
816#define GL_TEXTURE7 0x84C7
817#define GL_TEXTURE8 0x84C8
818#define GL_TEXTURE9 0x84C9
819#define GL_TEXTURE10 0x84CA
820#define GL_TEXTURE11 0x84CB
821#define GL_TEXTURE12 0x84CC
822#define GL_TEXTURE13 0x84CD
823#define GL_TEXTURE14 0x84CE
824#define GL_TEXTURE15 0x84CF
825#define GL_TEXTURE16 0x84D0
826#define GL_TEXTURE17 0x84D1
827#define GL_TEXTURE18 0x84D2
828#define GL_TEXTURE19 0x84D3
829#define GL_TEXTURE20 0x84D4
830#define GL_TEXTURE21 0x84D5
831#define GL_TEXTURE22 0x84D6
832#define GL_TEXTURE23 0x84D7
833#define GL_TEXTURE24 0x84D8
834#define GL_TEXTURE25 0x84D9
835#define GL_TEXTURE26 0x84DA
836#define GL_TEXTURE27 0x84DB
837#define GL_TEXTURE28 0x84DC
838#define GL_TEXTURE29 0x84DD
839#define GL_TEXTURE30 0x84DE
840#define GL_TEXTURE31 0x84DF
841#define GL_ACTIVE_TEXTURE 0x84E0
842
843/* TextureWrapMode */
844#define GL_REPEAT 0x2901
845#define GL_CLAMP_TO_EDGE 0x812F
846#define GL_MIRRORED_REPEAT 0x8370
847
848/* Uniform Types */
849#define GL_FLOAT_VEC2 0x8B50
850#define GL_FLOAT_VEC3 0x8B51
851#define GL_FLOAT_VEC4 0x8B52
852#define GL_INT_VEC2 0x8B53
853#define GL_INT_VEC3 0x8B54
854#define GL_INT_VEC4 0x8B55
855#define GL_BOOL 0x8B56
856#define GL_BOOL_VEC2 0x8B57
857#define GL_BOOL_VEC3 0x8B58
858#define GL_BOOL_VEC4 0x8B59
859#define GL_FLOAT_MAT2 0x8B5A
860#define GL_FLOAT_MAT3 0x8B5B
861#define GL_FLOAT_MAT4 0x8B5C
862#define GL_SAMPLER_2D 0x8B5E
863#define GL_SAMPLER_CUBE 0x8B60
864
865/* Vertex Arrays */
866#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622
867#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623
868#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624
869#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625
870#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A
871#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645
872#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F
873
874/* Read Format */
875#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A
876#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B
877
878/* Shader Source */
879#define GL_COMPILE_STATUS 0x8B81
880#define GL_INFO_LOG_LENGTH 0x8B84
881#define GL_SHADER_SOURCE_LENGTH 0x8B88
882#define GL_SHADER_COMPILER 0x8DFA
883
884/* Shader Binary */
885#define GL_SHADER_BINARY_FORMATS 0x8DF8
886#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9
887
888/* Shader Precision-Specified Types */
889#define GL_LOW_FLOAT 0x8DF0
890#define GL_MEDIUM_FLOAT 0x8DF1
891#define GL_HIGH_FLOAT 0x8DF2
892#define GL_LOW_INT 0x8DF3
893#define GL_MEDIUM_INT 0x8DF4
894#define GL_HIGH_INT 0x8DF5
895
896/* Framebuffer Object. */
897#define GL_FRAMEBUFFER 0x8D40
898#define GL_RENDERBUFFER 0x8D41
899
900#define GL_RGBA4 0x8056
901#define GL_RGB5_A1 0x8057
902#define GL_RGB565 0x8D62
903#define GL_DEPTH_COMPONENT16 0x81A5
904#define GL_STENCIL_INDEX 0x1901
905#define GL_STENCIL_INDEX8 0x8D48
906
907#define GL_RENDERBUFFER_WIDTH 0x8D42
908#define GL_RENDERBUFFER_HEIGHT 0x8D43
909#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44
910#define GL_RENDERBUFFER_RED_SIZE 0x8D50
911#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51
912#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52
913#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53
914#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54
915#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55
916
917#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0
918#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1
919#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2
920#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3
921
922#define GL_COLOR_ATTACHMENT0 0x8CE0
923#define GL_DEPTH_ATTACHMENT 0x8D00
924#define GL_STENCIL_ATTACHMENT 0x8D20
925
926#define GL_NONE 0
927
928#define GL_FRAMEBUFFER_COMPLETE 0x8CD5
929#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6
930#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7
931#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9
932#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD
933
934#define GL_FRAMEBUFFER_BINDING 0x8CA6
935#define GL_RENDERBUFFER_BINDING 0x8CA7
936#define GL_MAX_RENDERBUFFER_SIZE 0x84E8
937
938#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506
939
940//---------------------------//
941// GLES extension defines
942
943/* GL_OES_compressed_ETC1_RGB8_texture */
944#define GL_ETC1_RGB8_OES 0x8D64
945
946/* GL_OES_compressed_paletted_texture */
947#define GL_PALETTE4_RGB8_OES 0x8B90
948#define GL_PALETTE4_RGBA8_OES 0x8B91
949#define GL_PALETTE4_R5_G6_B5_OES 0x8B92
950#define GL_PALETTE4_RGBA4_OES 0x8B93
951#define GL_PALETTE4_RGB5_A1_OES 0x8B94
952#define GL_PALETTE8_RGB8_OES 0x8B95
953#define GL_PALETTE8_RGBA8_OES 0x8B96
954#define GL_PALETTE8_R5_G6_B5_OES 0x8B97
955#define GL_PALETTE8_RGBA4_OES 0x8B98
956#define GL_PALETTE8_RGB5_A1_OES 0x8B99
957
958/* GL_OES_depth24 */
959#define GL_DEPTH_COMPONENT24_OES 0x81A6
960
961/* GL_OES_depth32 */
962#define GL_DEPTH_COMPONENT32_OES 0x81A7
963
964/* GL_OES_get_program_binary */
965#define GL_PROGRAM_BINARY_LENGTH_OES 0x8741
966#define GL_NUM_PROGRAM_BINARY_FORMATS_OES 0x87FE
967#define GL_PROGRAM_BINARY_FORMATS_OES 0x87FF
968
969/* GL_OES_mapbuffer */
970#define GL_WRITE_ONLY_OES 0x88B9
971#define GL_BUFFER_ACCESS_OES 0x88BB
972#define GL_BUFFER_MAPPED_OES 0x88BC
973#define GL_BUFFER_MAP_POINTER_OES 0x88BD
974
975/* GL_OES_packed_depth_stencil */
976#define GL_DEPTH_STENCIL_OES 0x84F9
977#define GL_UNSIGNED_INT_24_8_OES 0x84FA
978#define GL_DEPTH24_STENCIL8_OES 0x88F0
979
980/* GL_OES_rgb8_rgba8 */
981#define GL_RGB8_OES 0x8051
982#define GL_RGBA8_OES 0x8058
983
984/* GL_OES_standard_derivatives */
985#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES 0x8B8B
986
987/* GL_OES_stencil1 */
988#define GL_STENCIL_INDEX1_OES 0x8D46
989
990/* GL_OES_stencil4 */
991#define GL_STENCIL_INDEX4_OES 0x8D47
992
993/* GL_OES_texture_3D */
994#define GL_TEXTURE_WRAP_R_OES 0x8072
995#define GL_TEXTURE_3D_OES 0x806F
996#define GL_TEXTURE_BINDING_3D_OES 0x806A
997#define GL_MAX_3D_TEXTURE_SIZE_OES 0x8073
998#define GL_SAMPLER_3D_OES 0x8B5F
999#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES 0x8CD4
1000
1001/* GL_OES_texture_float */
1002/* No new tokens introduced by this extension. */
1003
1004/* GL_OES_texture_float_linear */
1005/* No new tokens introduced by this extension. */
1006
1007/* GL_OES_texture_half_float */
1008#define GL_HALF_FLOAT_OES 0x8D61
1009
1010/* GL_OES_texture_half_float_linear */
1011/* No new tokens introduced by this extension. */
1012
1013/* GL_OES_texture_npot */
1014/* No new tokens introduced by this extension. */
1015
1016/* GL_OES_vertex_half_float */
1017/* GL_HALF_FLOAT_OES defined in GL_OES_texture_half_float already. */
1018
1019/* GL_OES_vertex_type_10_10_10_2 */
1020#define GL_UNSIGNED_INT_10_10_10_2_OES 0x8DF6
1021#define GL_INT_10_10_10_2_OES 0x8DF7
1022
1023/*------------------------------------------------------------------------*
1024 * AMD extension tokens
1025 *------------------------------------------------------------------------*/
1026
1027/* GL_AMD_compressed_3DC_texture */
1028#define GL_3DC_X_AMD 0x87F9
1029#define GL_3DC_XY_AMD 0x87FA
1030
1031/* GL_AMD_compressed_ATC_texture */
1032#define GL_ATC_RGB_AMD 0x8C92
1033#define GL_ATC_RGBA_EXPLICIT_ALPHA_AMD 0x8C93
1034#define GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD 0x87EE
1035
1036/* GL_AMD_performance_monitor */
1037#define GL_COUNTER_TYPE_AMD 0x8BC0
1038#define GL_COUNTER_RANGE_AMD 0x8BC1
1039#define GL_UNSIGNED_INT64_AMD 0x8BC2
1040#define GL_PERCENTAGE_AMD 0x8BC3
1041#define GL_PERFMON_RESULT_AVAILABLE_AMD 0x8BC4
1042#define GL_PERFMON_RESULT_SIZE_AMD 0x8BC5
1043#define GL_PERFMON_RESULT_AMD 0x8BC6
1044
1045/* GL_AMD_program_binary_Z400 */
1046#define GL_Z400_BINARY_AMD 0x8740
1047
1048/*------------------------------------------------------------------------*
1049 * EXT extension tokens
1050 *------------------------------------------------------------------------*/
1051
1052/* GL_EXT_blend_minmax */
1053#define GL_MIN_EXT 0x8007
1054#define GL_MAX_EXT 0x8008
1055
1056/* GL_EXT_discard_framebuffer */
1057#define GL_COLOR_EXT 0x1800
1058#define GL_DEPTH_EXT 0x1801
1059#define GL_STENCIL_EXT 0x1802
1060
1061/* GL_EXT_multi_draw_arrays */
1062/* No new tokens introduced by this extension. */
1063
1064/* GL_EXT_read_format_bgra */
1065#define GL_BGRA_EXT 0x80E1
1066#define GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT 0x8365
1067#define GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT 0x8366
1068
1069/* GL_EXT_texture_filter_anisotropic */
1070#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
1071#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
1072
1073/* GL_EXT_texture_format_BGRA8888 */
1074#define GL_BGRA_EXT 0x80E1
1075
1076/* GL_EXT_texture_type_2_10_10_10_REV */
1077#define GL_UNSIGNED_INT_2_10_10_10_REV_EXT 0x8368
1078
1079/*------------------------------------------------------------------------*
1080 * IMG extension tokens
1081 *------------------------------------------------------------------------*/
1082
1083/* GL_IMG_program_binary */
1084#define GL_SGX_PROGRAM_BINARY_IMG 0x9130
1085
1086/* GL_IMG_read_format */
1087#define GL_BGRA_IMG 0x80E1
1088#define GL_UNSIGNED_SHORT_4_4_4_4_REV_IMG 0x8365
1089
1090/* GL_IMG_shader_binary */
1091#define GL_SGX_BINARY_IMG 0x8C0A
1092
1093/* GL_IMG_texture_compression_pvrtc */
1094#define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00
1095#define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01
1096#define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02
1097#define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03
1098
1099/*------------------------------------------------------------------------*
1100 * NV extension tokens
1101 *------------------------------------------------------------------------*/
1102
1103/* GL_NV_fence */
1104#define GL_ALL_COMPLETED_NV 0x84F2
1105#define GL_FENCE_STATUS_NV 0x84F3
1106#define GL_FENCE_CONDITION_NV 0x84F4
1107
1108/*------------------------------------------------------------------------*
1109 * QCOM extension tokens
1110 *------------------------------------------------------------------------*/
1111
1112/* GL_QCOM_driver_control */
1113/* No new tokens introduced by this extension. */
1114
1115/* GL_QCOM_extended_get */
1116#define GL_TEXTURE_WIDTH_QCOM 0x8BD2
1117#define GL_TEXTURE_HEIGHT_QCOM 0x8BD3
1118#define GL_TEXTURE_DEPTH_QCOM 0x8BD4
1119#define GL_TEXTURE_INTERNAL_FORMAT_QCOM 0x8BD5
1120#define GL_TEXTURE_FORMAT_QCOM 0x8BD6
1121#define GL_TEXTURE_TYPE_QCOM 0x8BD7
1122#define GL_TEXTURE_IMAGE_VALID_QCOM 0x8BD8
1123#define GL_TEXTURE_NUM_LEVELS_QCOM 0x8BD9
1124#define GL_TEXTURE_TARGET_QCOM 0x8BDA
1125#define GL_TEXTURE_OBJECT_VALID_QCOM 0x8BDB
1126#define GL_STATE_RESTORE 0x8BDC
1127
1128/* GL_QCOM_extended_get2 */
1129/* No new tokens introduced by this extension. */
1130
1131/* GL_QCOM_perfmon_global_mode */
1132#define GL_PERFMON_GLOBAL_MODE_QCOM 0x8FA0
1133
1134/* GL_QCOM_writeonly_rendering */
1135#define GL_WRITEONLY_RENDERING_QCOM 0x8823
1136
1137/*------------------------------------------------------------------------*
1138 * End of extension tokens, start of corresponding extension functions
1139 *------------------------------------------------------------------------*/
1140
1141/* EvasGL_KHR_image */
1142#define EVAS_GL_NATIVE_PIXMAP 0x30B0 /* evasglCreateImage target */
1143
1144/* EvasGL_KHR_vg_parent_image */
1145#define EVAS_VG_PARENT_IMAGE 0x30BA /* evasglCreateImage target */
1146
1147/* EvasGL_KHR_gl_texture_2D_image */
1148#define EVAS_GL_TEXTURE_2D 0x30B1 /* evasglCreateImage target */
1149#define EVAS_GL_TEXTURE_LEVEL 0x30BC /* evasglCreateImage attribute */
1150
1151/* EvasGL_KHR_gl_texture_cubemap_image */
1152#define EVAS_GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x30B3 /* evasglCreateImage target */
1153#define EVAS_GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x30B4 /* evasglCreateImage target */
1154#define EVAS_GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x30B5 /* evasglCreateImage target */
1155#define EVAS_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x30B6 /* evasglCreateImage target */
1156#define EVAS_GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x30B7 /* evasglCreateImage target */
1157#define EVAS_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x30B8 /* evasglCreateImage target */
1158
1159/* EvasGL_KHR_gl_texture_3D_image */
1160#define EVAS_GL_TEXTURE_3D 0x30B2 /* evasglCreateImage target */
1161#define EVAS_GL_TEXTURE_ZOFFSET 0x30BD /* evasglCreateImage attribute */
1162
1163/* EvasGL_KHR_gl_renderbuffer_image */
1164#define EVAS_GL_RENDERBUFFER 0x30B9 /* evasglCreateImage target */
1165
1166#else
1167# ifndef EVAS_GL_NO_GL_H_CHECK
1168# error "You may only include either Evas_GL.h OR use your native OpenGL's headers. If you use Evas to do GL, then you cannot use the native gl headers."
1169# endif
1170#endif
1171
1172#define EVAS_GL_API_VERSION 1
1173struct _Evas_GL_API
1174{
1175 int version;
1176
1177 /* version 1: */
1178 /*------- GLES 2.0 -------*/
1179 void (*glActiveTexture) (GLenum texture);
1180 void (*glAttachShader) (GLuint program, GLuint shader);
1181 void (*glBindAttribLocation) (GLuint program, GLuint index, const char* name);
1182 void (*glBindBuffer) (GLenum target, GLuint buffer);
1183 void (*glBindFramebuffer) (GLenum target, GLuint framebuffer);
1184 void (*glBindRenderbuffer) (GLenum target, GLuint renderbuffer);
1185 void (*glBindTexture) (GLenum target, GLuint texture);
1186 void (*glBlendColor) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
1187 void (*glBlendEquation) ( GLenum mode );
1188 void (*glBlendEquationSeparate) (GLenum modeRGB, GLenum modeAlpha);
1189 void (*glBlendFunc) (GLenum sfactor, GLenum dfactor);
1190 void (*glBlendFuncSeparate) (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
1191 void (*glBufferData) (GLenum target, GLsizeiptr size, const void* data, GLenum usage);
1192 void (*glBufferSubData) (GLenum target, GLintptr offset, GLsizeiptr size, const void* data);
1193 GLenum (*glCheckFramebufferStatus) (GLenum target);
1194 void (*glClear) (GLbitfield mask);
1195 void (*glClearColor) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
1196 void (*glClearDepthf) (GLclampf depth);
1197 void (*glClearStencil) (GLint s);
1198 void (*glColorMask) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
1199 void (*glCompileShader) (GLuint shader);
1200 void (*glCompressedTexImage2D) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data);
1201 void (*glCompressedTexSubImage2D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data);
1202 void (*glCopyTexImage2D) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
1203 void (*glCopyTexSubImage2D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
1204 GLuint (*glCreateProgram) (void);
1205 GLuint (*glCreateShader) (GLenum type);
1206 void (*glCullFace) (GLenum mode);
1207 void (*glDeleteBuffers) (GLsizei n, const GLuint* buffers);
1208 void (*glDeleteFramebuffers) (GLsizei n, const GLuint* framebuffers);
1209 void (*glDeleteProgram) (GLuint program);
1210 void (*glDeleteRenderbuffers) (GLsizei n, const GLuint* renderbuffers);
1211 void (*glDeleteShader) (GLuint shader);
1212 void (*glDeleteTextures) (GLsizei n, const GLuint* textures);
1213 void (*glDepthFunc) (GLenum func);
1214 void (*glDepthMask) (GLboolean flag);
1215 void (*glDepthRangef) (GLclampf zNear, GLclampf zFar);
1216 void (*glDetachShader) (GLuint program, GLuint shader);
1217 void (*glDisable) (GLenum cap);
1218 void (*glDisableVertexAttribArray) (GLuint index);
1219 void (*glDrawArrays) (GLenum mode, GLint first, GLsizei count);
1220 void (*glDrawElements) (GLenum mode, GLsizei count, GLenum type, const void* indices);
1221 void (*glEnable) (GLenum cap);
1222 void (*glEnableVertexAttribArray) (GLuint index);
1223 void (*glFinish) (void);
1224 void (*glFlush) (void);
1225 void (*glFramebufferRenderbuffer) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
1226 void (*glFramebufferTexture2D) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
1227 void (*glFrontFace) (GLenum mode);
1228 void (*glGenBuffers) (GLsizei n, GLuint* buffers);
1229 void (*glGenerateMipmap) (GLenum target);
1230 void (*glGenFramebuffers) (GLsizei n, GLuint* framebuffers);
1231 void (*glGenRenderbuffers) (GLsizei n, GLuint* renderbuffers);
1232 void (*glGenTextures) (GLsizei n, GLuint* textures);
1233 void (*glGetActiveAttrib) (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name);
1234 void (*glGetActiveUniform) (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name);
1235 void (*glGetAttachedShaders) (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders);
1236 int (*glGetAttribLocation) (GLuint program, const char* name);
1237 void (*glGetBooleanv) (GLenum pname, GLboolean* params);
1238 void (*glGetBufferParameteriv) (GLenum target, GLenum pname, GLint* params);
1239 GLenum (*glGetError) (void);
1240 void (*glGetFloatv) (GLenum pname, GLfloat* params);
1241 void (*glGetFramebufferAttachmentParameteriv) (GLenum target, GLenum attachment, GLenum pname, GLint* params);
1242 void (*glGetIntegerv) (GLenum pname, GLint* params);
1243 void (*glGetProgramiv) (GLuint program, GLenum pname, GLint* params);
1244 void (*glGetProgramInfoLog) (GLuint program, GLsizei bufsize, GLsizei* length, char* infolog);
1245 void (*glGetRenderbufferParameteriv) (GLenum target, GLenum pname, GLint* params);
1246 void (*glGetShaderiv) (GLuint shader, GLenum pname, GLint* params);
1247 void (*glGetShaderInfoLog) (GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog);
1248 void (*glGetShaderPrecisionFormat) (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision);
1249 void (*glGetShaderSource) (GLuint shader, GLsizei bufsize, GLsizei* length, char* source);
1250 const GLubyte* (*glGetString) (GLenum name);
1251 void (*glGetTexParameterfv) (GLenum target, GLenum pname, GLfloat* params);
1252 void (*glGetTexParameteriv) (GLenum target, GLenum pname, GLint* params);
1253 void (*glGetUniformfv) (GLuint program, GLint location, GLfloat* params);
1254 void (*glGetUniformiv) (GLuint program, GLint location, GLint* params);
1255 int (*glGetUniformLocation) (GLuint program, const char* name);
1256 void (*glGetVertexAttribfv) (GLuint index, GLenum pname, GLfloat* params);
1257 void (*glGetVertexAttribiv) (GLuint index, GLenum pname, GLint* params);
1258 void (*glGetVertexAttribPointerv) (GLuint index, GLenum pname, void** pointer);
1259 void (*glHint) (GLenum target, GLenum mode);
1260 GLboolean (*glIsBuffer) (GLuint buffer);
1261 GLboolean (*glIsEnabled) (GLenum cap);
1262 GLboolean (*glIsFramebuffer) (GLuint framebuffer);
1263 GLboolean (*glIsProgram) (GLuint program);
1264 GLboolean (*glIsRenderbuffer) (GLuint renderbuffer);
1265 GLboolean (*glIsShader) (GLuint shader);
1266 GLboolean (*glIsTexture) (GLuint texture);
1267 void (*glLineWidth) (GLfloat width);
1268 void (*glLinkProgram) (GLuint program);
1269 void (*glPixelStorei) (GLenum pname, GLint param);
1270 void (*glPolygonOffset) (GLfloat factor, GLfloat units);
1271 void (*glReadPixels) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels);
1272 void (*glReleaseShaderCompiler) (void);
1273 void (*glRenderbufferStorage) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
1274 void (*glSampleCoverage) (GLclampf value, GLboolean invert);
1275 void (*glScissor) (GLint x, GLint y, GLsizei width, GLsizei height);
1276 void (*glShaderBinary) (GLsizei n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLsizei length);
1277 void (*glShaderSource) (GLuint shader, GLsizei count, const char** string, const GLint* length);
1278 void (*glStencilFunc) (GLenum func, GLint ref, GLuint mask);
1279 void (*glStencilFuncSeparate) (GLenum face, GLenum func, GLint ref, GLuint mask);
1280 void (*glStencilMask) (GLuint mask);
1281 void (*glStencilMaskSeparate) (GLenum face, GLuint mask);
1282 void (*glStencilOp) (GLenum fail, GLenum zfail, GLenum zpass);
1283 void (*glStencilOpSeparate) (GLenum face, GLenum fail, GLenum zfail, GLenum zpass);
1284 void (*glTexImage2D) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels);
1285 void (*glTexParameterf) (GLenum target, GLenum pname, GLfloat param);
1286 void (*glTexParameterfv) (GLenum target, GLenum pname, const GLfloat* params);
1287 void (*glTexParameteri) (GLenum target, GLenum pname, GLint param);
1288 void (*glTexParameteriv) (GLenum target, GLenum pname, const GLint* params);
1289 void (*glTexSubImage2D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels);
1290 void (*glUniform1f) (GLint location, GLfloat x);
1291 void (*glUniform1fv) (GLint location, GLsizei count, const GLfloat* v);
1292 void (*glUniform1i) (GLint location, GLint x);
1293 void (*glUniform1iv) (GLint location, GLsizei count, const GLint* v);
1294 void (*glUniform2f) (GLint location, GLfloat x, GLfloat y);
1295 void (*glUniform2fv) (GLint location, GLsizei count, const GLfloat* v);
1296 void (*glUniform2i) (GLint location, GLint x, GLint y);
1297 void (*glUniform2iv) (GLint location, GLsizei count, const GLint* v);
1298 void (*glUniform3f) (GLint location, GLfloat x, GLfloat y, GLfloat z);
1299 void (*glUniform3fv) (GLint location, GLsizei count, const GLfloat* v);
1300 void (*glUniform3i) (GLint location, GLint x, GLint y, GLint z);
1301 void (*glUniform3iv) (GLint location, GLsizei count, const GLint* v);
1302 void (*glUniform4f) (GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
1303 void (*glUniform4fv) (GLint location, GLsizei count, const GLfloat* v);
1304 void (*glUniform4i) (GLint location, GLint x, GLint y, GLint z, GLint w);
1305 void (*glUniform4iv) (GLint location, GLsizei count, const GLint* v);
1306 void (*glUniformMatrix2fv) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
1307 void (*glUniformMatrix3fv) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
1308 void (*glUniformMatrix4fv) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
1309 void (*glUseProgram) (GLuint program);
1310 void (*glValidateProgram) (GLuint program);
1311 void (*glVertexAttrib1f) (GLuint indx, GLfloat x);
1312 void (*glVertexAttrib1fv) (GLuint indx, const GLfloat* values);
1313 void (*glVertexAttrib2f) (GLuint indx, GLfloat x, GLfloat y);
1314 void (*glVertexAttrib2fv) (GLuint indx, const GLfloat* values);
1315 void (*glVertexAttrib3f) (GLuint indx, GLfloat x, GLfloat y, GLfloat z);
1316 void (*glVertexAttrib3fv) (GLuint indx, const GLfloat* values);
1317 void (*glVertexAttrib4f) (GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
1318 void (*glVertexAttrib4fv) (GLuint indx, const GLfloat* values);
1319 void (*glVertexAttribPointer) (GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr);
1320 void (*glViewport) (GLint x, GLint y, GLsizei width, GLsizei height);
1321
1322 /*------- GLES 2.0 Extensions -------*/
1323 // Notice these two names have been changed to fit Evas GL and not EGL!
1324 /* GL_OES_EvasGL_image */
1325 void (*glEvasGLImageTargetTexture2DOES) (GLenum target, EvasGLImage image);
1326 void (*glEvasGLImageTargetRenderbufferStorageOES) (GLenum target, EvasGLImage image);
1327
1328 /* GL_OES_get_program_binary */
1329 void (*glGetProgramBinaryOES) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary);
1330 void (*glProgramBinaryOES) (GLuint program, GLenum binaryFormat, const void *binary, GLint length);
1331 /* GL_OES_mapbuffer */
1332 void* (*glMapBufferOES) (GLenum target, GLenum access);
1333 GLboolean (*glUnmapBufferOES) (GLenum target);
1334 void (*glGetBufferPointervOES) (GLenum target, GLenum pname, void** params);
1335 /* GL_OES_texture_3D */
1336 void (*glTexImage3DOES) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void* pixels);
1337 void (*glTexSubImage3DOES) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void* pixels);
1338 void (*glCopyTexSubImage3DOES) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
1339 void (*glCompressedTexImage3DOES) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void* data);
1340 void (*glCompressedTexSubImage3DOES) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void* data);
1341 void (*glFramebufferTexture3DOES) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
1342
1343 /* AMD_performance_monitor */
1344 void (*glGetPerfMonitorGroupsAMD) (GLint* numGroups, GLsizei groupsSize, GLuint* groups);
1345 void (*glGetPerfMonitorCountersAMD) (GLuint group, GLint* numCounters, GLint* maxActiveCounters, GLsizei counterSize, GLuint* counters);
1346 void (*glGetPerfMonitorGroupStringAMD) (GLuint group, GLsizei bufSize, GLsizei* length, char* groupString);
1347 void (*glGetPerfMonitorCounterStringAMD) (GLuint group, GLuint counter, GLsizei bufSize, GLsizei* length, char* counterString);
1348 void (*glGetPerfMonitorCounterInfoAMD) (GLuint group, GLuint counter, GLenum pname, void* data);
1349 void (*glGenPerfMonitorsAMD) (GLsizei n, GLuint* monitors);
1350 void (*glDeletePerfMonitorsAMD) (GLsizei n, GLuint* monitors);
1351 void (*glSelectPerfMonitorCountersAMD) (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint* countersList);
1352 void (*glBeginPerfMonitorAMD) (GLuint monitor);
1353 void (*glEndPerfMonitorAMD) (GLuint monitor);
1354 void (*glGetPerfMonitorCounterDataAMD) (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint* data, GLint* bytesWritten);
1355
1356 /* GL_EXT_discard_framebuffer */
1357 void (*glDiscardFramebufferEXT) (GLenum target, GLsizei numAttachments, const GLenum* attachments);
1358
1359 /* GL_EXT_multi_draw_arrays */
1360 void (*glMultiDrawArraysEXT) (GLenum mode, GLint* first, GLsizei* count, GLsizei primcount);
1361 void (*glMultiDrawElementsEXT) (GLenum mode, const GLsizei* count, GLenum type, const GLvoid** indices, GLsizei primcount);
1362
1363 /* GL_NV_fence */
1364 void (*glDeleteFencesNV) (GLsizei n, const GLuint* fences);
1365 void (*glGenFencesNV) (GLsizei n, GLuint* fences);
1366 GLboolean (*glIsFenceNV) (GLuint fence);
1367 GLboolean (*glTestFenceNV) (GLuint fence);
1368 void (*glGetFenceivNV) (GLuint fence, GLenum pname, GLint* params);
1369 void (*glFinishFenceNV) (GLuint fence);
1370 void (*glSetFenceNV) (GLuint, GLenum);
1371
1372 /* GL_QCOM_driver_control */
1373 void (*glGetDriverControlsQCOM) (GLint* num, GLsizei size, GLuint* driverControls);
1374 void (*glGetDriverControlStringQCOM) (GLuint driverControl, GLsizei bufSize, GLsizei* length, char* driverControlString);
1375 void (*glEnableDriverControlQCOM) (GLuint driverControl);
1376 void (*glDisableDriverControlQCOM) (GLuint driverControl);
1377
1378 /* GL_QCOM_extended_get */
1379 void (*glExtGetTexturesQCOM) (GLuint* textures, GLint maxTextures, GLint* numTextures);
1380 void (*glExtGetBuffersQCOM) (GLuint* buffers, GLint maxBuffers, GLint* numBuffers);
1381 void (*glExtGetRenderbuffersQCOM) (GLuint* renderbuffers, GLint maxRenderbuffers, GLint* numRenderbuffers);
1382 void (*glExtGetFramebuffersQCOM) (GLuint* framebuffers, GLint maxFramebuffers, GLint* numFramebuffers);
1383 void (*glExtGetTexLevelParameterivQCOM) (GLuint texture, GLenum face, GLint level, GLenum pname, GLint* params);
1384 void (*glExtTexObjectStateOverrideiQCOM) (GLenum target, GLenum pname, GLint param);
1385 void (*glExtGetTexSubImageQCOM) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, void* texels);
1386 void (*glExtGetBufferPointervQCOM) (GLenum target, void** params);
1387
1388
1389 /* GL_QCOM_extended_get2 */
1390 void (*glExtGetShadersQCOM) (GLuint* shaders, GLint maxShaders, GLint* numShaders);
1391 void (*glExtGetProgramsQCOM) (GLuint* programs, GLint maxPrograms, GLint* numPrograms);
1392 GLboolean (*glExtIsProgramBinaryQCOM) (GLuint program);
1393 void (*glExtGetProgramBinarySourceQCOM) (GLuint program, GLenum shadertype, char* source, GLint* length);
1394
1395 //------- EGL Related Extensions -------//
1396 /* EvasGL_KHR_image */
1397 EvasGLImage (*evasglCreateImage) (int target, void* buffer, int* attrib_list);
1398 void (*evasglDestroyImage) (EvasGLImage image);
1399
1400 /* future calls will be added down here for expansion */
1401 /* version 2: */
1402};
1403
1404
1405#ifdef __cplusplus
1406}
1407#endif
1408
1409#endif
1410/**
1411 * @}
1412 */