1 // Copyright Danny Arends 2020.
2 // Distributed under the Boost Software License, Version 1.0.
3 // (See: http://www.boost.org/LICENSE_1_0.txt)
4 
5 module bindbc.gles.gles;
6 
7 import bindbc.loader;
8 
9 public import bindbc.gles.config,
10               bindbc.gles.glestypes,
11               bindbc.gles.glesconstants;
12 
13 private {
14     SharedLib lib;
15     GLESSupport contextVersion = GLESSupport.noContext;
16     GLESSupport loadedVersion = GLESSupport.noContext;
17 }
18 
19 void unloadGLES()
20 {
21     if(lib != invalidHandle) {
22         lib.unload();
23         contextVersion = loadedVersion = GLESSupport.noContext;
24     }
25 }
26 
27 GLESSupport loadGLES()
28 {
29     version(Windows) {
30         const(char)[][1] libNames = ["libglesv2.dll"];
31     }
32     else version(Posix) {
33         const(char)[][2] libNames = [
34             "libGLESv2.so.2",
35             "libGLESv2.so"
36         ];
37     }
38     else static assert(0, "bindbc-gles is not yet supported on this platform");
39 
40     GLESSupport ret;
41     foreach(name; libNames) {
42         ret = loadGLES(name.ptr);
43         if(ret != GLESSupport.noLibrary) break;
44     }
45     return ret;
46 }
47 
48 GLESSupport loadGLES(const(char)* libName)
49 {
50     // If the library isn't yet loaded, load it now.
51     if(lib == invalidHandle) {
52         lib = load(libName);
53         if(lib == invalidHandle) {
54             return GLESSupport.noLibrary;
55         }
56     }
57     if(!lib.loadGLES()) return GLESSupport.badLibrary;
58     return loadedVersion;
59 }
60 
61 
62 extern(System) @nogc nothrow {
63     // V1.0
64     alias pglActiveTexture = void function( GLenum );
65     alias pglAlphaFunc = void function(GLenum, GLfloat);
66     alias pglBindBuffer = void function( GLenum, GLuint );
67     alias pglBindTexture = void function( GLenum, GLuint );
68     alias pglBlendFunc = void function( GLenum, GLenum );
69     alias pglBufferData = void function( GLenum, GLsizeiptr, const void*, GLenum );
70     alias pglBufferSubData = void function( GLenum, GLintptr, GLsizeiptr, const void* );
71     alias pglClear = void function( GLbitfield );
72     alias pglClearColor = void function( GLfloat, GLfloat, GLfloat, GLfloat );
73     alias pglClearDepthf = void function( GLfloat );
74     alias pglClearStencil = void function( GLint );
75     alias pglClientActiveTexture = void function(GLenum);
76     alias pglClipPlanef = void function(GLenum, const(GLfloat)*);
77     alias pglColor4f = void function(GLfloat, GLfloat, GLfloat, GLfloat);
78     alias pglColor4ub = void function(GLubyte, GLubyte, GLubyte, GLubyte);
79     alias pglColor4x = void function(GLfixed, GLfixed, GLfixed, GLfixed);
80     alias pglColorMask = void function(GLboolean, GLboolean, GLboolean, GLboolean);
81     alias pglColorPointer = void function(GLint, GLenum, GLsizei, const(void)*);
82     alias pglCompressedTexImage2D = void function(GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const(void)*);
83     alias pglCompressedTexSubImage2D = void function(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const(void)*);
84     alias pglCopyTexImage2D = void function(GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint);
85     alias pglCopyTexSubImage2D = void function(GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei);
86     alias pglCullFace = void function(GLenum);
87     //glCurrentPaletteMatrix
88     alias pglDeleteBuffers = void function(GLsizei, const(GLuint)*);
89     alias pglDeleteTextures = void function(GLsizei, const(GLuint)*);
90     alias pglDepthFunc = void function(GLenum);
91     alias pglDepthMask = void function(GLboolean);
92     alias pglDepthRangef = void function(GLfloat, GLfloat);
93     alias pglDepthRangex = void function(GLfixed, GLfixed);
94     alias pglDrawArrays = void function( GLenum, GLint, GLsizei );
95     alias pglDrawElements = void function( GLenum, GLsizei, GLenum, const void* );
96     //glDrawTex
97     alias pglEnable = void function(GLenum);
98     alias pglEnableClientState = void function(GLenum);
99     alias pglFinish = void function();
100     alias pglFlush = void function();
101     alias pglFogf = void function(GLenum, GLfloat);
102     alias pglFogfv = void function(GLenum, const(GLfloat)*);
103     alias pglFogx = void function(GLenum, GLfixed);
104     alias pglFogxv = void function(GLenum, const(GLfixed)*);
105     alias pglFrontFace = void function(GLenum);
106     alias pglFrustumf = void function(GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
107     alias pglFrustumx = void function(GLfixed, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed);
108     alias pglGenBuffers = void function(GLsizei, GLuint*);
109     alias pglGenTextures = void function(GLsizei, GLuint*);
110     //glGet
111     alias pglGetBufferParameteriv = void function(GLenum, GLenum, GLint*);
112     alias pglGetClipPlanex = void function(GLenum, GLfixed*);
113     alias pglGetError = GLenum function();
114     alias pglGetFixedv = void function(GLenum, GLfixed*);
115     alias pglGetIntegerv = void function(GLenum, GLint*);
116     alias pglGetLightfv = void function(GLenum, GLenum, GLfloat*);
117     alias pglGetLightxv = void function(GLenum, GLenum, GLfixed*);
118     alias pglGetMaterialfv = void function(GLenum, GLenum, GLfloat*);
119     alias pglGetMaterialxv = void function(GLenum, GLenum, GLfixed*);
120     alias pglGetPointerv = void function(GLenum, void**);
121     alias pglGetString = const( char )* function( GLenum );
122     alias pglGetTexEnvfv = void function(GLenum, GLenum, GLfloat*);
123     alias pglGetTexEnviv = void function(GLenum, GLenum, GLint*);
124     alias pglGetTexEnvxv = void function(GLenum, GLenum, GLfixed*);
125     alias pglGetTexParameterfv = void function(GLenum, GLenum, GLfloat*);
126     alias pglGetTexParameteriv = void function(GLenum, GLenum, GLint*);
127     alias pglGetTexParameterxv = void function(GLenum, GLenum, GLfixed*);
128     alias pglHint = void function(GLenum, GLenum);
129     //glIntro
130     alias pglIsBuffer = GLboolean function(GLuint);
131     alias pglIsEnabled = GLboolean function(GLenum);
132     alias pglIsTexture = GLboolean function(GLuint);
133     alias pglLightf = void function(GLenum, GLenum, GLfloat);
134     alias pglLightfv = void function(GLenum, GLenum, const(GLfloat)*);
135     alias pglLightx = void function(GLenum, GLenum, GLfixed);
136     alias pglLightxv = void function(GLenum, GLenum, const(GLfixed)*);    
137     alias pglLightModelf = void function(GLenum, GLfloat);
138     alias pglLightModelfv = void function(GLenum, const(GLfloat)*);
139     alias pglLightModelx = void function(GLenum, GLfixed);
140     alias pglLightModelxv = void function(GLenum, const(GLfixed)*);
141     alias pglLineWidth = void function(GLfloat);
142     alias pglLineWidthx = void function(GLfixed);
143     alias pglLoadIdentity = void function();
144     alias pglLoadMatrixf = void function(const(GLfloat)*);
145     alias pglLoadMatrixx = void function(const(GLfixed)*);
146     //glLoadPaletteFromModelViewMatrix
147     //glLogicOp
148     alias pglMaterialf = void function(GLenum, GLenum, GLfloat);
149     alias pglMaterialfv = void function(GLenum, GLenum, const(GLfloat)*);
150     alias pglMaterialx = void function(GLenum, GLenum, GLfixed);
151     alias pglMaterialxv = void function(GLenum, GLenum, const(GLfixed)*);
152     //glMatrixIndexPointer
153     alias pglMatrixMode = void function(GLenum);
154     alias pglMultiTexCoord4f = void function(GLenum, GLfloat, GLfloat, GLfloat, GLfloat);
155     alias pglMultiTexCoord4x = void function(GLenum, GLfixed, GLfixed, GLfixed, GLfixed);
156     alias pglMultMatrixf = void function(const(GLfloat)*);
157     alias pglMultMatrixx = void function(const(GLfixed)*);
158     alias pglNormal3f = void function(GLfloat, GLfloat, GLfloat);
159     alias pglNormal3x = void function(GLfixed, GLfixed, GLfixed);
160     alias pglNormalPointer = void function(GLenum, GLsizei, const(void)*);
161     alias pglOrthof = void function(GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
162     alias pglOrthox = void function(GLfixed, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed);
163     alias pglPixelStorei = void function(GLenum, GLint);
164     alias pglPointParameterf = void function(GLenum, GLfloat);
165     alias pglPointParameterfv = void function(GLenum, const(GLfloat)*);
166     alias pglPointParameterx = void function(GLenum, GLfixed);
167     alias pglPointParameterxv = void function(GLenum, const(GLfixed)*);
168     alias pglPointSize = void function(GLfloat);
169     alias pglPointSizex = void function(GLfixed);
170     //glPointSizePointerOES
171     alias pglPolygonOffset = void function(GLfloat, GLfloat);
172     alias pglPolygonOffsetx = void function(GLfixed, GLfixed);
173     alias pglPushMatrix = void function();
174     //glQueryMatrix
175     alias pglReadPixels = void function(GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, void*);
176     alias pglRotatef = void function(GLfloat, GLfloat, GLfloat, GLfloat);
177     alias pglRotatex = void function(GLfixed, GLfixed, GLfixed, GLfixed);
178     alias pglSampleCoverage = void function(GLfloat, GLboolean);
179     alias pglSampleCoveragex = void function(GLclampx, GLboolean);
180     alias pglScalex = void function(GLfixed, GLfixed, GLfixed);
181     alias pglScissor = void function(GLint, GLint, GLsizei, GLsizei);
182     alias pglShadeModel = void function(GLenum);
183     alias pglStencilFunc = void function(GLenum, GLint, GLuint);
184     alias pglStencilMask = void function(GLuint);
185     alias pglStencilOp = void function(GLenum, GLenum, GLenum);
186     alias pglTexCoordPointer = void function(GLint, GLenum, GLsizei, const(void)*);
187     alias pglTexEnvi = void function(GLenum, GLenum, GLint);
188     alias pglTexEnvx = void function(GLenum, GLenum, GLfixed);
189     alias pglTexEnviv = void function(GLenum, GLenum, const(GLint)*);
190     alias pglTexEnvxv = void function(GLenum, GLenum, const(GLfixed)*);
191     alias pglTexImage2D = void function(GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const(void)*);
192     alias pglTexParameteri = void function(GLenum, GLenum, GLint);
193     alias pglTexParameterx = void function(GLenum, GLenum, GLfixed);
194     alias pglTexParameteriv = void function(GLenum, GLenum, const(GLint)*);
195     alias pglTexParameterxv = void function(GLenum, GLenum, const(GLfixed)*);
196     alias pglTexSubImage2D = void function(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const(void)*);
197     alias pglTranslatex = void function(GLfixed, GLfixed, GLfixed);
198     alias pglVertexPointer = void function(GLint, GLenum, GLsizei, const(void)*);
199     alias pglViewport = void function(GLint, GLint, GLsizei, GLsizei);
200     //glWeightPointer
201     
202     //V2.0
203     alias pglDisable = void function( GLenum );
204     alias pglBindFramebuffer = void function( GLenum, GLuint );
205     alias pglBindRenderbuffer = void function( GLenum, GLuint );
206     alias pglGenFramebuffers = void function( GLsizei, GLuint* );
207     alias pglGenRenderbuffers = void function( GLsizei, GLuint* );
208     alias pglRenderbufferStorage = void function( GLenum, GLenum, GLsizei, GLsizei );
209     alias pglFramebufferRenderbuffer = void function( GLenum, GLenum, GLenum, GLuint );
210     alias pglFramebufferTexture2D = void function( GLenum, GLenum, GLenum, GLuint, GLint );
211     alias pglCheckFramebufferStatus = GLenum function( GLenum );
212     alias pglGetUniformLocation = GLint function( GLuint, const GLchar* );
213     alias pglUniform1f = void function( GLint, GLfloat);
214     alias pglUniform1i = void function( GLint, GLint);
215     alias pglUniform3fv = void function( GLint, GLsizei, const GLfloat* );
216     alias pglUniform4fv = void function( GLint, GLsizei, const GLfloat* );
217     alias pglUniformMatrix4fv = void function( GLint, GLsizei, GLboolean, const GLfloat* );
218     alias pglUseProgram = void function( GLuint );
219     alias pglGetShaderiv = void function( GLuint, GLenum, GLint* );
220     alias pglGetShaderInfoLog = void function( GLuint, GLsizei, GLsizei*, GLchar* );
221     alias pglCreateShader = GLuint function( GLenum );
222     alias pglCreateProgram = GLuint function(  );
223     alias pglShaderSource = void function( GLuint, GLsizei, const( const( GLchar )* )*, const GLint* );
224     alias pglCompileShader = void function( GLuint );
225     alias pglAttachShader = void function( GLuint, GLuint );
226     alias pglLinkProgram = void function( GLuint );
227     alias pglGenerateMipmap = void function( GLenum );
228 
229     //V3.2
230     alias pglDrawBuffers = void function(GLsizei, const(GLenum)*);
231     alias pglDeleteVertexArrays = void function(GLsizei, const(GLuint)*);
232     alias pglGenVertexArrays = void function(GLsizei, GLuint*);
233     alias pglBindVertexArray = void function(GLuint);
234     alias pglGetAttribLocation = GLint function(GLuint, const(GLchar)*);
235     alias pglEnableVertexAttribArray = void function(GLuint);
236     alias pglVertexAttribPointer = void function(GLuint, GLint, GLenum, GLboolean, GLsizei, const(void)*);
237 }
238 
239 __gshared {
240   pglActiveTexture glActiveTexture;
241   pglAlphaFunc glAlphaFunc;
242   pglBindBuffer glBindBuffer;
243   pglBindTexture glBindTexture;
244   pglBlendFunc glBlendFunc;
245   pglBufferData glBufferData;
246   pglBufferSubData glBufferSubData;
247   pglClear glClear;
248   pglClearColor glClearColor;
249   pglClearDepthf glClearDepthf;
250   pglClearStencil glClearStencil;
251   pglClientActiveTexture glClientActiveTexture;
252   pglClipPlanef glClipPlanef;
253   pglColor4f glColor4f;
254   pglColor4ub glColor4ub;
255   pglColor4x glColor4x;
256   pglColorMask glColorMask;
257   pglColorPointer glColorPointer;
258   pglCompressedTexImage2D glCompressedTexImage2D;
259   pglCompressedTexSubImage2D glCompressedTexSubImage2D;
260   pglCopyTexImage2D glCopyTexImage2D;
261   pglCopyTexSubImage2D glCopyTexSubImage2D;
262   pglCullFace glCullFace;
263   pglDeleteBuffers glDeleteBuffers;
264   pglDeleteTextures glDeleteTextures;
265   pglDepthFunc glDepthFunc;
266   pglDepthMask glDepthMask;
267   pglDepthRangef glDepthRangef;
268   pglDepthRangex glDepthRangex;
269   pglDrawArrays glDrawArrays;
270   pglDrawElements glDrawElements;
271   pglEnable glEnable;
272   pglEnableClientState glEnableClientState;
273   pglFinish glFinish;
274   pglFlush glFlush;
275   pglFogf glFogf;
276   pglFogfv glFogfv;
277   pglFogx glFogx;
278   pglFogxv glFogxv;
279   pglFrontFace glFrontFace;
280   pglFrustumf glFrustumf;
281   pglFrustumx glFrustumx;
282   pglGenBuffers glGenBuffers;
283   pglGenTextures glGenTextures;
284   pglGetBufferParameteriv glGetBufferParameteriv;
285   pglGetClipPlanex glGetClipPlanex;
286   pglGetError glGetError;
287   pglGetFixedv glGetFixedv;
288   pglGetIntegerv glGetIntegerv;
289   pglGetLightfv glGetLightfv;
290   pglGetLightxv glGetLightxv;
291   pglGetMaterialfv glGetMaterialfv;
292   pglGetMaterialxv glGetMaterialxv;
293   pglGetPointerv glGetPointerv;
294   pglGetString glGetString;
295   pglGetTexEnvfv glGetTexEnvfv;
296   pglGetTexEnviv glGetTexEnviv;
297   pglGetTexEnvxv glGetTexEnvxv;
298   pglGetTexParameterfv glGetTexParameterfv;
299   pglGetTexParameteriv glGetTexParameteriv;
300   pglGetTexParameterxv glGetTexParameterxv;
301   pglHint glHint;
302   pglIsBuffer glIsBuffer;
303   pglIsEnabled glIsEnabled;
304   pglIsTexture glIsTexture;
305   pglLightf glLightf;
306   pglLightfv glLightfv;
307   pglLightx glLightx;
308   pglLightxv glLightxv;
309   pglLightModelf glLightModelf;
310   pglLightModelfv glLightModelfv;
311   pglLightModelx glLightModelx;
312   pglLightModelxv glLightModelxv;
313   pglLineWidth glLineWidth;
314   pglLineWidthx glLineWidthx;
315   pglLoadIdentity glLoadIdentity;
316   pglLoadMatrixf glLoadMatrixf;
317   pglLoadMatrixx glLoadMatrixx;
318   pglMaterialf glMaterialf;
319   pglMaterialfv glMaterialfv;
320   pglMaterialx glMaterialx;
321   pglMaterialxv glMaterialxv;
322   pglMatrixMode glMatrixMode;
323   pglMultiTexCoord4f glMultiTexCoord4f;
324   pglMultiTexCoord4x glMultiTexCoord4x;
325   pglMultMatrixf glMultMatrixf;
326   pglMultMatrixx glMultMatrixx;
327   pglNormal3f glNormal3f;
328   pglNormal3x glNormal3x;
329   pglNormalPointer glNormalPointer;
330   pglOrthof glOrthof;
331   pglOrthox glOrthox;
332   pglPixelStorei glPixelStorei;
333   pglPointParameterf glPointParameterf;
334   pglPointParameterfv glPointParameterfv;
335   pglPointParameterx glPointParameterx;
336   pglPointParameterxv glPointParameterxv;
337   pglPointSize glPointSize;
338   pglPointSizex glPointSizex;
339   pglPolygonOffset glPolygonOffset;
340   pglPolygonOffsetx glPolygonOffsetx;
341   pglPushMatrix glPushMatrix;
342   pglReadPixels glReadPixels;
343   pglRotatef glRotatef;
344   pglRotatex glRotatex;
345   pglSampleCoverage glSampleCoverage;
346   pglSampleCoveragex glSampleCoveragex;
347   pglScalex glScalex;
348   pglScissor glScissor;
349   pglShadeModel glShadeModel;
350   pglStencilFunc glStencilFunc;
351   pglStencilMask glStencilMask;
352   pglStencilOp glStencilOp;
353   pglTexCoordPointer glTexCoordPointer;
354   pglTexEnvi glTexEnvi;
355   pglTexEnvx glTexEnvx;
356   pglTexEnviv glTexEnviv;
357   pglTexEnvxv glTexEnvxv;
358   pglTexImage2D glTexImage2D;
359   pglTexParameteri glTexParameteri;
360   pglTexParameterx glTexParameterx;
361   pglTexParameteriv glTexParameteriv;
362   pglTexParameterxv glTexParameterxv;
363   pglTexSubImage2D glTexSubImage2D;
364   pglTranslatex glTranslatex;
365   pglVertexPointer glVertexPointer;
366   pglViewport glViewport;
367 
368   //V2.0
369   pglDisable glDisable;
370   pglBindFramebuffer glBindFramebuffer;
371   pglBindRenderbuffer glBindRenderbuffer;
372   pglGenFramebuffers glGenFramebuffers;
373   pglGenRenderbuffers glGenRenderbuffers;
374   pglRenderbufferStorage glRenderbufferStorage;
375   pglFramebufferRenderbuffer glFramebufferRenderbuffer;
376   pglFramebufferTexture2D glFramebufferTexture2D;
377   pglCheckFramebufferStatus glCheckFramebufferStatus;
378   pglGetUniformLocation glGetUniformLocation;
379   pglUniform1f glUniform1f;
380   pglUniform1i glUniform1i;
381   pglUniform3fv glUniform3fv;
382   pglUniform4fv glUniform4fv;
383   pglUniformMatrix4fv glUniformMatrix4fv;
384   pglUseProgram glUseProgram;
385   pglGetShaderiv glGetShaderiv;
386   pglGetShaderInfoLog glGetShaderInfoLog;
387   pglCreateShader glCreateShader;
388   pglCreateProgram glCreateProgram;
389   pglShaderSource glShaderSource;
390   pglCompileShader glCompileShader;
391   pglAttachShader glAttachShader;
392   pglLinkProgram glLinkProgram;
393   pglGenerateMipmap glGenerateMipmap;
394   
395   //V3.2
396   pglDrawBuffers glDrawBuffers;
397   pglDeleteVertexArrays glDeleteVertexArrays;
398   pglGenVertexArrays glGenVertexArrays;
399   pglBindVertexArray glBindVertexArray;
400   pglGetAttribLocation glGetAttribLocation;
401   pglEnableVertexAttribArray glEnableVertexAttribArray;
402   pglVertexAttribPointer glVertexAttribPointer;
403 }
404 
405 bool loadGLES(SharedLib lib){
406     auto startErrorCount = errorCount();
407     lib.bindSymbol( cast( void** )&glActiveTexture, "glActiveTexture" );
408     lib.bindSymbol( cast( void** )&glAlphaFunc, "glAlphaFunc" );
409     lib.bindSymbol( cast( void** )&glBindBuffer, "glBindBuffer" );
410     lib.bindSymbol( cast( void** )&glBindTexture, "glBindTexture" );
411     lib.bindSymbol( cast( void** )&glBlendFunc, "glBlendFunc" );
412     lib.bindSymbol( cast( void** )&glBufferData, "glBufferData" );
413     lib.bindSymbol( cast( void** )&glBufferSubData, "glBufferSubData" );
414     lib.bindSymbol( cast( void** )&glClear, "glClear" );
415     lib.bindSymbol( cast( void** )&glClearColor, "glClearColor" );
416     lib.bindSymbol( cast( void** )&glClearDepthf, "glClearDepthf" );
417     lib.bindSymbol( cast( void** )&glClearStencil, "glClearStencil" );
418     lib.bindSymbol( cast( void** )&glClientActiveTexture, "glClientActiveTexture" );
419     lib.bindSymbol( cast( void** )&glClipPlanef, "glClipPlanef" );
420     lib.bindSymbol( cast( void** )&glColor4f, "glColor4f" );
421     lib.bindSymbol( cast( void** )&glColor4ub, "glColor4ub" );
422     lib.bindSymbol( cast( void** )&glColor4x, "glColor4x" );
423     lib.bindSymbol( cast( void** )&glColorMask, "glColorMask" );
424     lib.bindSymbol( cast( void** )&glColorPointer, "glColorPointer" );
425     lib.bindSymbol( cast( void** )&glCompressedTexImage2D, "glCompressedTexImage2D" );
426     lib.bindSymbol( cast( void** )&glCompressedTexSubImage2D, "glCompressedTexSubImage2D" );
427     lib.bindSymbol( cast( void** )&glCopyTexImage2D, "glCopyTexImage2D" );
428     lib.bindSymbol( cast( void** )&glCopyTexSubImage2D, "glCopyTexSubImage2D" );
429     lib.bindSymbol( cast( void** )&glCullFace, "glCullFace" );
430     lib.bindSymbol( cast( void** )&glDeleteBuffers, "glDeleteBuffers" );
431     lib.bindSymbol( cast( void** )&glDeleteTextures, "glDeleteTextures" );
432     lib.bindSymbol( cast( void** )&glDepthFunc, "glDepthFunc" );
433     lib.bindSymbol( cast( void** )&glDepthMask, "glDepthMask" );
434     lib.bindSymbol( cast( void** )&glDepthRangef, "glDepthRangef" );
435     lib.bindSymbol( cast( void** )&glDepthRangex, "glDepthRangex" );
436     lib.bindSymbol( cast( void** )&glDrawArrays, "glDrawArrays" );
437     lib.bindSymbol( cast( void** )&glDrawElements, "glDrawElements" );
438     lib.bindSymbol( cast( void** )&glEnable, "glEnable" );
439     lib.bindSymbol( cast( void** )&glEnableClientState, "glEnableClientState" );
440     lib.bindSymbol( cast( void** )&glFinish, "glFinish" );
441     lib.bindSymbol( cast( void** )&glFlush, "glFlush" );
442     lib.bindSymbol( cast( void** )&glFogf, "glFogf" );
443     lib.bindSymbol( cast( void** )&glFogfv, "glFogfv" );
444     lib.bindSymbol( cast( void** )&glFogx, "glFogx" );
445     lib.bindSymbol( cast( void** )&glFogxv, "glFogxv" );
446     lib.bindSymbol( cast( void** )&glFrontFace, "glFrontFace" );
447     lib.bindSymbol( cast( void** )&glFrustumf, "glFrustumf" );
448     lib.bindSymbol( cast( void** )&glFrustumx, "glFrustumx" );
449     lib.bindSymbol( cast( void** )&glGenBuffers, "glGenBuffers" );
450     lib.bindSymbol( cast( void** )&glGenTextures, "glGenTextures" );
451     lib.bindSymbol( cast( void** )&glGetBufferParameteriv, "glGetBufferParameteriv" );
452     lib.bindSymbol( cast( void** )&glGetClipPlanex, "glGetClipPlanex" );
453     lib.bindSymbol( cast( void** )&glGetError, "glGetError" );
454     lib.bindSymbol( cast( void** )&glGetFixedv, "glGetFixedv" );
455     lib.bindSymbol( cast( void** )&glGetIntegerv, "glGetIntegerv" );
456     lib.bindSymbol( cast( void** )&glGetLightfv, "glGetLightfv" );
457     lib.bindSymbol( cast( void** )&glGetLightxv, "glGetLightxv" );
458     lib.bindSymbol( cast( void** )&glGetMaterialfv, "glGetMaterialfv" );
459     lib.bindSymbol( cast( void** )&glGetMaterialxv, "glGetMaterialxv" );
460     lib.bindSymbol( cast( void** )&glGetPointerv, "glGetPointerv" );
461     lib.bindSymbol( cast( void** )&glGetString, "glGetString" );
462     lib.bindSymbol( cast( void** )&glGetTexEnvfv, "glGetTexEnvfv" );
463     lib.bindSymbol( cast( void** )&glGetTexEnviv, "glGetTexEnviv" );
464     lib.bindSymbol( cast( void** )&glGetTexEnvxv, "glGetTexEnvxv" );
465     lib.bindSymbol( cast( void** )&glGetTexParameterfv, "glGetTexParameterfv" );
466     lib.bindSymbol( cast( void** )&glGetTexParameteriv, "glGetTexParameteriv" );
467     lib.bindSymbol( cast( void** )&glGetTexParameterxv, "glGetTexParameterxv" );
468     lib.bindSymbol( cast( void** )&glHint, "glHint" );
469     lib.bindSymbol( cast( void** )&glIsBuffer, "glIsBuffer" );
470     lib.bindSymbol( cast( void** )&glIsEnabled, "glIsEnabled" );
471     lib.bindSymbol( cast( void** )&glIsTexture, "glIsTexture" );
472     lib.bindSymbol( cast( void** )&glLightf, "glLightf" );
473     lib.bindSymbol( cast( void** )&glLightfv, "glLightfv" );
474     lib.bindSymbol( cast( void** )&glLightx, "glLightx" );
475     lib.bindSymbol( cast( void** )&glLightxv, "glLightxv" );
476     lib.bindSymbol( cast( void** )&glLightModelf, "glLightModelf" );
477     lib.bindSymbol( cast( void** )&glLightModelfv, "glLightModelfv" );
478     lib.bindSymbol( cast( void** )&glLightModelx, "glLightModelx" );
479     lib.bindSymbol( cast( void** )&glLightModelxv, "glLightModelxv" );
480     lib.bindSymbol( cast( void** )&glLineWidth, "glLineWidth" );
481     lib.bindSymbol( cast( void** )&glLineWidthx, "glLineWidthx" );
482     lib.bindSymbol( cast( void** )&glLoadIdentity, "glLoadIdentity" );
483     lib.bindSymbol( cast( void** )&glLoadMatrixf, "glLoadMatrixf" );
484     lib.bindSymbol( cast( void** )&glLoadMatrixx, "glLoadMatrixx" );
485     lib.bindSymbol( cast( void** )&glMaterialf, "glMaterialf" );
486     lib.bindSymbol( cast( void** )&glMaterialfv, "glMaterialfv" );
487     lib.bindSymbol( cast( void** )&glMaterialx, "glMaterialx" );
488     lib.bindSymbol( cast( void** )&glMaterialxv, "glMaterialxv" );
489     lib.bindSymbol( cast( void** )&glMatrixMode, "glMatrixMode" );
490     lib.bindSymbol( cast( void** )&glMultiTexCoord4f, "glMultiTexCoord4f" );
491     lib.bindSymbol( cast( void** )&glMultiTexCoord4x, "glMultiTexCoord4x" );
492     lib.bindSymbol( cast( void** )&glMultMatrixf, "glMultMatrixf" );
493     lib.bindSymbol( cast( void** )&glMultMatrixx, "glMultMatrixx" );
494     lib.bindSymbol( cast( void** )&glNormal3f, "glNormal3f" );
495     lib.bindSymbol( cast( void** )&glNormal3x, "glNormal3x" );
496     lib.bindSymbol( cast( void** )&glNormalPointer, "glNormalPointer" );
497     lib.bindSymbol( cast( void** )&glOrthof, "glOrthof" );
498     lib.bindSymbol( cast( void** )&glOrthox, "glOrthox" );
499     lib.bindSymbol( cast( void** )&glPixelStorei, "glPixelStorei" );
500     lib.bindSymbol( cast( void** )&glPointParameterf, "glPointParameterf" );
501     lib.bindSymbol( cast( void** )&glPointParameterfv, "glPointParameterfv" );
502     lib.bindSymbol( cast( void** )&glPointParameterx, "glPointParameterx" );
503     lib.bindSymbol( cast( void** )&glPointParameterxv, "glPointParameterxv" );
504     lib.bindSymbol( cast( void** )&glPointSize, "glPointSize" );
505     lib.bindSymbol( cast( void** )&glPointSizex, "glPointSizex" );
506     lib.bindSymbol( cast( void** )&glPolygonOffset, "glPolygonOffset" );
507     lib.bindSymbol( cast( void** )&glPolygonOffsetx, "glPolygonOffsetx" );
508     lib.bindSymbol( cast( void** )&glPushMatrix, "glPushMatrix" );
509     lib.bindSymbol( cast( void** )&glReadPixels, "glReadPixels" );
510     lib.bindSymbol( cast( void** )&glRotatef, "glRotatef" );
511     lib.bindSymbol( cast( void** )&glRotatex, "glRotatex" );
512     lib.bindSymbol( cast( void** )&glSampleCoverage, "glSampleCoverage" );
513     lib.bindSymbol( cast( void** )&glSampleCoveragex, "glSampleCoveragex" );
514     lib.bindSymbol( cast( void** )&glScalex, "glScalex" );
515     lib.bindSymbol( cast( void** )&glScissor, "glScissor" );
516     lib.bindSymbol( cast( void** )&glShadeModel, "glShadeModel" );
517     lib.bindSymbol( cast( void** )&glStencilFunc, "glStencilFunc" );
518     lib.bindSymbol( cast( void** )&glStencilMask, "glStencilMask" );
519     lib.bindSymbol( cast( void** )&glStencilOp, "glStencilOp" );
520     lib.bindSymbol( cast( void** )&glTexCoordPointer, "glTexCoordPointer" );
521     lib.bindSymbol( cast( void** )&glTexEnvi, "glTexEnvi" );
522     lib.bindSymbol( cast( void** )&glTexEnvx, "glTexEnvx" );
523     lib.bindSymbol( cast( void** )&glTexEnviv, "glTexEnviv" );
524     lib.bindSymbol( cast( void** )&glTexEnvxv, "glTexEnvxv" );
525     lib.bindSymbol( cast( void** )&glTexImage2D, "glTexImage2D" );
526     lib.bindSymbol( cast( void** )&glTexParameteri, "glTexParameteri" );
527     lib.bindSymbol( cast( void** )&glTexParameterx, "glTexParameterx" );
528     lib.bindSymbol( cast( void** )&glTexParameteriv, "glTexParameteriv" );
529     lib.bindSymbol( cast( void** )&glTexParameterxv, "glTexParameterxv" );
530     lib.bindSymbol( cast( void** )&glTexSubImage2D, "glTexSubImage2D" );
531     lib.bindSymbol( cast( void** )&glTranslatex, "glTranslatex" );
532     lib.bindSymbol( cast( void** )&glVertexPointer, "glVertexPointer" );
533     lib.bindSymbol( cast( void** )&glViewport, "glViewport" );
534     loadedVersion = GLESSupport.GLES10;
535     
536     //V2.0
537     lib.bindSymbol( cast( void** )&glDisable, "glDisable" );
538     lib.bindSymbol( cast( void** )&glBindFramebuffer, "glBindFramebuffer" );
539     lib.bindSymbol( cast( void** )&glBindRenderbuffer, "glBindRenderbuffer" );
540     lib.bindSymbol( cast( void** )&glGenFramebuffers, "glGenFramebuffers" );
541     lib.bindSymbol( cast( void** )&glGenRenderbuffers, "glGenRenderbuffers" );
542     lib.bindSymbol( cast( void** )&glRenderbufferStorage, "glRenderbufferStorage" );
543     lib.bindSymbol( cast( void** )&glFramebufferRenderbuffer, "glFramebufferRenderbuffer" );
544     lib.bindSymbol( cast( void** )&glFramebufferTexture2D, "glFramebufferTexture2D" );
545     lib.bindSymbol( cast( void** )&glCheckFramebufferStatus, "glCheckFramebufferStatus" );
546     lib.bindSymbol( cast( void** )&glGetUniformLocation, "glGetUniformLocation" );
547     lib.bindSymbol( cast( void** )&glUniform1f, "glUniform1f" );
548     lib.bindSymbol( cast( void** )&glUniform1i, "glUniform1i" );
549     lib.bindSymbol( cast( void** )&glUniform3fv, "glUniform3fv" );
550     lib.bindSymbol( cast( void** )&glUniform4fv, "glUniform4fv" );
551     lib.bindSymbol( cast( void** )&glUniformMatrix4fv, "glUniformMatrix4fv" );
552     lib.bindSymbol( cast( void** )&glUseProgram, "glUseProgram" );
553     lib.bindSymbol( cast( void** )&glGetShaderiv, "glGetShaderiv" );
554     lib.bindSymbol( cast( void** )&glGetShaderInfoLog, "glGetShaderInfoLog" );
555     lib.bindSymbol( cast( void** )&glCreateShader, "glCreateShader" );
556     lib.bindSymbol( cast( void** )&glCreateProgram, "glCreateProgram" );
557     lib.bindSymbol( cast( void** )&glShaderSource, "glShaderSource" );
558     lib.bindSymbol( cast( void** )&glCompileShader, "glCompileShader" );
559     lib.bindSymbol( cast( void** )&glAttachShader, "glAttachShader" );
560     lib.bindSymbol( cast( void** )&glLinkProgram, "glLinkProgram" );
561     lib.bindSymbol( cast( void** )&glGenerateMipmap, "glGenerateMipmap" );
562   
563     //V3.2
564     lib.bindSymbol( cast( void** )&glDrawBuffers, "glDrawBuffers" );
565     lib.bindSymbol( cast( void** )&glDeleteVertexArrays, "glDeleteVertexArrays" );
566     lib.bindSymbol( cast( void** )&glGenVertexArrays, "glGenVertexArrays" );
567     lib.bindSymbol( cast( void** )&glBindVertexArray, "glBindVertexArray" );
568     lib.bindSymbol( cast( void** )&glGetAttribLocation, "glGetAttribLocation" );
569     lib.bindSymbol( cast( void** )&glEnableVertexAttribArray, "glEnableVertexAttribArray" );
570     lib.bindSymbol( cast( void** )&glVertexAttribPointer, "glVertexAttribPointer" );
571 
572     return(errorCount() == startErrorCount);
573 }
574