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