1 /*
2 
3 Boost Software License - Version 1.0 - August 17th, 2003
4 
5 Permission is hereby granted, free of charge, to any person or organization
6 obtaining a copy of the software and accompanying documentation covered by
7 this license (the "Software") to use, reproduce, display, distribute,
8 execute, and transmit the Software, and to prepare derivative works of the
9 Software, and to permit third-parties to whom the Software is furnished to
10 do so, all subject to the following:
11 
12 The copyright notices in the Software and this entire statement, including
13 the above license grant, this restriction and the following disclaimer,
14 must be included in all copies of the Software, in whole or in part, and
15 all derivative works of the Software, unless such copies or derivative
16 works are solely in the form of machine-executable object code generated by
17 a source language processor.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
22 SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
23 FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
24 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25 DEALINGS IN THE SOFTWARE.
26 
27 */
28 module derelict.opengl.gl;
29 
30 public
31 {
32     import derelict.opengl.glfuncs;
33     import derelict.opengl.gltypes;
34 }
35 
36 private
37 {
38     import derelict.util.loader;
39     import derelict.util.exception;
40     import derelict.util.compat;
41     import derelict.opengl.extloader;
42 
43     version(Windows)
44         import derelict.opengl.wgl;
45 
46     version(darwin)
47         version = MacOSX;
48 
49     version(OSX)
50         version = MacOSX;
51 
52     version (MacOSX)
53         import derelict.opengl.cgl;
54 
55     version(linux)
56         version = GLX;
57 
58     version(FreeBSD)
59         version = freebsd;
60 
61     version(freebsd)
62         version = GLX;
63 
64     version(GLX)
65         import derelict.opengl.glx;
66 }
67 
68 enum GLVersion
69 {
70     None,
71     GL11 = 11,
72     GL12 = 12,
73     GL13 = 13,
74     GL14 = 14,
75     GL15 = 15,
76     GL20 = 20,
77     GL21 = 21,
78     MaxClassic = 21,
79 
80     GL30 = 30,
81     GL31 = 31,
82     GL32 = 32,
83     GL33 = 33,
84     GL40 = 40,
85     MaxModern = 40,
86     HighestSupported = 40
87 }
88 
89 class DerelictGLLoader : SharedLibLoader
90 {
91 private:
92     this()
93     {
94         super(
95             "opengl32.dll",
96             "libGL.so.2,libGL.so.1,libGL.so",
97             "../Frameworks/OpenGL.framework/OpenGL, /Library/Frameworks/OpenGL.framework/OpenGL, /System/Library/Frameworks/OpenGL.framework/OpenGL"
98         );
99     }
100 
101     GLVersion findMaxAvailable()
102     {
103         string verstr = toDString(glGetString(GL_VERSION));
104         if(verstr.findStr("4.0") == 0)
105             return GLVersion.GL40;
106         else if(verstr.findStr("3.3") == 0)
107             return GLVersion.GL33;
108         else if(verstr.findStr("3.2") == 0)
109             return GLVersion.GL32;
110         else if(verstr.findStr("3.1") == 0)
111             return GLVersion.GL31;
112         else if(verstr.findStr("3.0") == 0)
113             return GLVersion.GL30;
114         else if(verstr.findStr("2.1") == 0)
115             return GLVersion.GL21;
116         else if(verstr.findStr("2.0") == 0)
117             return GLVersion.GL20;
118         else if(verstr.findStr("1.5") == 0)
119             return GLVersion.GL15;
120         else if(verstr.findStr("1.4") == 0)
121             return GLVersion.GL14;
122         else if(verstr.findStr("1.3") == 0)
123             return GLVersion.GL13;
124         else if(verstr.findStr("1.2") == 0)
125             return GLVersion.GL12;
126         else if(verstr.findStr("1.1") == 0)
127             return GLVersion.GL11;
128 
129         // assume new version of OpenGL
130         // TODO this needs to be more robust -- check to make sure that there this
131         // is a valid version number and actually is higher than the highest supported
132         return GLVersion.HighestSupported;
133     }
134 
135     GLVersion _maxVersion;
136 
137 public:
138     GLVersion maxVersion()
139     {
140         return _maxVersion;
141     }
142 
143     void loadExtensions()
144     {
145         if(!hasValidContext())
146             throw new DerelictException("An OpenGL context must be created and activated before attempting to load extensions.");
147         extLoadAll();
148     }
149     
150     void loadBaseExtensions()
151     {
152         if(!hasValidContext())
153             throw new DerelictException("An OpenGL context must be created and activated before attempting to load extensions.");
154         extLoadMinimal();
155     }
156 
157     string[] loadedExtensionNames()
158     {
159         return getLoadedExtensionNames();
160     }
161 
162     string[] notLoadedExtensionNames()
163     {
164         return getNotLoadedExtensionNames();
165     }
166 
167     bool isExtensionSupported(string extName)
168     {
169         if(!hasValidContext())
170             throw new DerelictException("An OpenGL context must be created and activated before attempting to check for supported extensions.");
171 
172         return extIsSupported(extName);
173     }
174 
175     bool isExtensionLoaded(string extName)
176     {
177         if(!hasValidContext())
178             throw new DerelictException("An OpenGL context must be created and activated, and extensions must be loaded, before checking for loaded extensions.");
179 
180         return (GLExtensionState.Loaded == extGetState(extName));
181     }
182 
183     GLExtensionState getExtensionState(string extName)
184     {
185         if(!hasValidContext())
186             throw new DerelictException("An OpenGL context must be created and activated, and extensions must be loaded, before chacking extension state.");
187 
188         return extGetState(extName);
189     }
190 
191     alias loadClassicVersions loadExtendedVersions;
192 
193     GLVersion loadClassicVersions(GLVersion targetVersion = GLVersion.GL11)
194     {
195         if(!hasValidContext())
196             throw new DerelictException("An OpenGL context must be created and activated before attempting to load extended versions.");
197 
198         GLVersion maxAvail = findMaxAvailable();
199         if(maxAvail < targetVersion)
200             throw new DerelictException("Required GL version " ~ versionToString(targetVersion) ~ " is not available.");
201 
202         bool doThrow = false;
203 
204         // gl 1.2
205         if(maxAvail >= GLVersion.GL12)
206         {
207             doThrow = (targetVersion >= GLVersion.GL12);
208 
209             bindExtendedFunc(cast(void**)&glDrawRangeElements, "glDrawRangeElements", doThrow);
210             bindExtendedFunc(cast(void**)&glTexImage3D, "glTexImage3D", doThrow);
211             bindExtendedFunc(cast(void**)&glTexSubImage3D, "glTexSubImage3D", doThrow);
212             bindExtendedFunc(cast(void**)&glCopyTexSubImage3D, "glCopyTexSubImage3D", doThrow);
213 
214             /* GL_ARB_imaging
215             bindExtendedFunc(cast(void**)&glColorTable, "glColorTable", doThrow);
216             bindExtendedFunc(cast(void**)&glColorSubTable, "glColorSubTable", doThrow);
217             bindExtendedFunc(cast(void**)&glColorTableParameteriv, "glColorTableParameteriv", doThrow);
218             bindExtendedFunc(cast(void**)&glColorTableParameterfv, "glColorTableParameterfv", doThrow);
219             bindExtendedFunc(cast(void**)&glCopyColorSubTable, "glCopyColorSubTable", doThrow);
220             bindExtendedFunc(cast(void**)&glCopyColorTable, "glCopyColorTable", doThrow);
221             bindExtendedFunc(cast(void**)&glGetColorTable, "glGetColorTable", doThrow);
222             bindExtendedFunc(cast(void**)&glGetColorTableParameterfv, "glGetColorTableParameterfv", doThrow);
223             bindExtendedFunc(cast(void**)&glGetColorTableParameteriv, "glGetColorTableParameteriv", doThrow);
224             bindExtendedFunc(cast(void**)&glHistogram, "glHistogram", doThrow);
225             bindExtendedFunc(cast(void**)&glResetHistogram, "glResetHistogram", doThrow);
226             bindExtendedFunc(cast(void**)&glGetHistogram, "glGetHistogram", doThrow);
227             bindExtendedFunc(cast(void**)&glGetHistogramParameterfv, "glGetHistogramParameterfv", doThrow);
228             bindExtendedFunc(cast(void**)&glGetHistogramParameteriv, "glGetHistogramParameteriv", doThrow);
229             bindExtendedFunc(cast(void**)&glMinmax, "glMinmax", doThrow);
230             bindExtendedFunc(cast(void**)&glResetMinmax, "glResetMinmax", doThrow);
231             bindExtendedFunc(cast(void**)&glGetMinmax, "glGetMinmax", doThrow);
232             bindExtendedFunc(cast(void**)&glGetMinmaxParameterfv, "glGetMinmaxParameterfv", doThrow);
233             bindExtendedFunc(cast(void**)&glGetMinmaxParameteriv, "glGetMinmaxParameteriv", doThrow);
234             bindExtendedFunc(cast(void**)&glConvolutionFilter1D, "glConvolutionFilter1D", doThrow);
235             bindExtendedFunc(cast(void**)&glConvolutionFilter2D, "glConvolutionFilter2D", doThrow);
236             bindExtendedFunc(cast(void**)&glConvolutionParameterf, "glConvolutionParameterf", doThrow);
237             bindExtendedFunc(cast(void**)&glConvolutionParameterfv, "glConvolutionParameterfv", doThrow);
238             bindExtendedFunc(cast(void**)&glConvolutionParameteri, "glConvolutionParameteri", doThrow);
239             bindExtendedFunc(cast(void**)&glConvolutionParameteriv, "glConvolutionParameteriv", doThrow);
240             bindExtendedFunc(cast(void**)&glCopyConvolutionFilter1D, "glCopyConvolutionFilter1D", doThrow);
241             bindExtendedFunc(cast(void**)&glCopyConvolutionFilter2D, "glCopyConvolutionFilter2D", doThrow);
242             bindExtendedFunc(cast(void**)&glGetConvolutionFilter, "glGetConvolutionFilter", doThrow);
243             bindExtendedFunc(cast(void**)&glGetConvolutionParameterfv, "glGetConvolutionParameterfv", doThrow);
244             bindExtendedFunc(cast(void**)&glGetConvolutionParameteriv, "glGetConvolutionParameteriv", doThrow);
245             bindExtendedFunc(cast(void**)&glSeparableFilter2D, "glSeparableFilter2D", doThrow);
246             bindExtendedFunc(cast(void**)&glGetSeparableFilter, "glGetSeparableFilter", doThrow);
247             */
248             _maxVersion = GLVersion.GL12;
249         }
250 
251         // gl 1.3
252         if(maxAvail >= GLVersion.GL13)
253         {
254             doThrow = (targetVersion >= GLVersion.GL13);
255 
256             bindExtendedFunc(cast(void**)&glActiveTexture, "glActiveTexture", doThrow);
257             bindExtendedFunc(cast(void**)&glClientActiveTexture, "glClientActiveTexture", doThrow);
258             bindExtendedFunc(cast(void**)&glMultiTexCoord1d, "glMultiTexCoord1d", doThrow);
259             bindExtendedFunc(cast(void**)&glMultiTexCoord1dv, "glMultiTexCoord1dv", doThrow);
260             bindExtendedFunc(cast(void**)&glMultiTexCoord1f, "glMultiTexCoord1f", doThrow);
261             bindExtendedFunc(cast(void**)&glMultiTexCoord1fv, "glMultiTexCoord1fv", doThrow);
262             bindExtendedFunc(cast(void**)&glMultiTexCoord1i, "glMultiTexCoord1i", doThrow);
263             bindExtendedFunc(cast(void**)&glMultiTexCoord1iv, "glMultiTexCoord1iv", doThrow);
264             bindExtendedFunc(cast(void**)&glMultiTexCoord1s, "glMultiTexCoord1s", doThrow);
265             bindExtendedFunc(cast(void**)&glMultiTexCoord1sv, "glMultiTexCoord1sv", doThrow);
266             bindExtendedFunc(cast(void**)&glMultiTexCoord2d, "glMultiTexCoord2d", doThrow);
267             bindExtendedFunc(cast(void**)&glMultiTexCoord2dv, "glMultiTexCoord2dv", doThrow);
268             bindExtendedFunc(cast(void**)&glMultiTexCoord2f, "glMultiTexCoord2f", doThrow);
269             bindExtendedFunc(cast(void**)&glMultiTexCoord2fv, "glMultiTexCoord2fv", doThrow);
270             bindExtendedFunc(cast(void**)&glMultiTexCoord2i, "glMultiTexCoord2i", doThrow);
271             bindExtendedFunc(cast(void**)&glMultiTexCoord2iv, "glMultiTexCoord2iv", doThrow);
272             bindExtendedFunc(cast(void**)&glMultiTexCoord2s, "glMultiTexCoord2s", doThrow);
273             bindExtendedFunc(cast(void**)&glMultiTexCoord2sv, "glMultiTexCoord2sv", doThrow);
274             bindExtendedFunc(cast(void**)&glMultiTexCoord3d, "glMultiTexCoord3d", doThrow);
275             bindExtendedFunc(cast(void**)&glMultiTexCoord3dv, "glMultiTexCoord3d", doThrow);
276             bindExtendedFunc(cast(void**)&glMultiTexCoord3f, "glMultiTexCoord3f", doThrow);
277             bindExtendedFunc(cast(void**)&glMultiTexCoord3fv, "glMultiTexCoord3fv", doThrow);
278             bindExtendedFunc(cast(void**)&glMultiTexCoord3i, "glMultiTexCoord3i", doThrow);
279             bindExtendedFunc(cast(void**)&glMultiTexCoord3iv, "glMultiTexCoord3iv", doThrow);
280             bindExtendedFunc(cast(void**)&glMultiTexCoord3s, "glMultiTexCoord3s", doThrow);
281             bindExtendedFunc(cast(void**)&glMultiTexCoord3sv, "glMultiTexCoord3sv", doThrow);
282             bindExtendedFunc(cast(void**)&glMultiTexCoord4d, "glMultiTexCoord4d", doThrow);
283             bindExtendedFunc(cast(void**)&glMultiTexCoord4dv, "glMultiTexCoord4dv", doThrow);
284             bindExtendedFunc(cast(void**)&glMultiTexCoord4f, "glMultiTexCoord4f", doThrow);
285             bindExtendedFunc(cast(void**)&glMultiTexCoord4fv, "glMultiTexCoord4fv", doThrow);
286             bindExtendedFunc(cast(void**)&glMultiTexCoord4i, "glMultiTexCoord4i", doThrow);
287             bindExtendedFunc(cast(void**)&glMultiTexCoord4iv, "glMultiTexCoord4iv", doThrow);
288             bindExtendedFunc(cast(void**)&glMultiTexCoord4s, "glMultiTexCoord4s", doThrow);
289             bindExtendedFunc(cast(void**)&glMultiTexCoord4sv, "glMultiTexCoord4sv", doThrow);
290             bindExtendedFunc(cast(void**)&glLoadTransposeMatrixd, "glLoadTransposeMatrixd", doThrow);
291             bindExtendedFunc(cast(void**)&glLoadTransposeMatrixf, "glLoadTransposeMatrixf", doThrow);
292             bindExtendedFunc(cast(void**)&glMultTransposeMatrixd, "glMultTransposeMatrixd", doThrow);
293             bindExtendedFunc(cast(void**)&glMultTransposeMatrixf, "glMultTransposeMatrixf", doThrow);
294             bindExtendedFunc(cast(void**)&glSampleCoverage, "glSampleCoverage", doThrow);
295             bindExtendedFunc(cast(void**)&glCompressedTexImage1D, "glCompressedTexImage1D", doThrow);
296             bindExtendedFunc(cast(void**)&glCompressedTexImage2D, "glCompressedTexImage2D", doThrow);
297             bindExtendedFunc(cast(void**)&glCompressedTexImage3D, "glCompressedTexImage3D", doThrow);
298             bindExtendedFunc(cast(void**)&glCompressedTexSubImage1D, "glCompressedTexSubImage1D", doThrow);
299             bindExtendedFunc(cast(void**)&glCompressedTexSubImage2D, "glCompressedTexSubImage2D", doThrow);
300             bindExtendedFunc(cast(void**)&glCompressedTexSubImage3D, "glCompressedTexSubImage3D", doThrow);
301             bindExtendedFunc(cast(void**)&glGetCompressedTexImage, "glGetCompressedTexImage", doThrow);
302 
303             _maxVersion = GLVersion.GL13;
304         }
305 
306         if(maxAvail >= GLVersion.GL14)
307         {
308             doThrow = (targetVersion >= GLVersion.GL14);
309 
310             bindExtendedFunc(cast(void**)&glBlendFuncSeparate, "glBlendFuncSeparate", doThrow);
311             bindExtendedFunc(cast(void**)&glFogCoordf, "glFogCoordf", doThrow);
312             bindExtendedFunc(cast(void**)&glFogCoordfv, "glFogCoordfv", doThrow);
313             bindExtendedFunc(cast(void**)&glFogCoordd, "glFogCoordd", doThrow);
314             bindExtendedFunc(cast(void**)&glFogCoorddv, "glFogCoorddv", doThrow);
315             bindExtendedFunc(cast(void**)&glFogCoordPointer, "glFogCoordPointer", doThrow);
316             bindExtendedFunc(cast(void**)&glMultiDrawArrays, "glMultiDrawArrays", doThrow);
317             bindExtendedFunc(cast(void**)&glMultiDrawElements, "glMultiDrawElements", doThrow);
318             bindExtendedFunc(cast(void**)&glPointParameterf, "glPointParameterf", doThrow);
319             bindExtendedFunc(cast(void**)&glPointParameterfv, "glPointParameterfv", doThrow);
320             bindExtendedFunc(cast(void**)&glPointParameteri, "glPointParameteri", doThrow);
321             bindExtendedFunc(cast(void**)&glPointParameteriv, "glPointParameteriv", doThrow);
322             bindExtendedFunc(cast(void**)&glSecondaryColor3b, "glSecondaryColor3b", doThrow);
323             bindExtendedFunc(cast(void**)&glSecondaryColor3bv, "glSecondaryColor3bv", doThrow);
324             bindExtendedFunc(cast(void**)&glSecondaryColor3d, "glSecondaryColor3d", doThrow);
325             bindExtendedFunc(cast(void**)&glSecondaryColor3dv, "glSecondaryColor3dv", doThrow);
326             bindExtendedFunc(cast(void**)&glSecondaryColor3f, "glSecondaryColor3f", doThrow);
327             bindExtendedFunc(cast(void**)&glSecondaryColor3fv, "glSecondaryColor3fv", doThrow);
328             bindExtendedFunc(cast(void**)&glSecondaryColor3i, "glSecondaryColor3i", doThrow);
329             bindExtendedFunc(cast(void**)&glSecondaryColor3iv, "glSecondaryColor3iv", doThrow);
330             bindExtendedFunc(cast(void**)&glSecondaryColor3s, "glSecondaryColor3s", doThrow);
331             bindExtendedFunc(cast(void**)&glSecondaryColor3sv, "glSecondaryColor3sv", doThrow);
332             bindExtendedFunc(cast(void**)&glSecondaryColor3ub, "glSecondaryColor3ub", doThrow);
333             bindExtendedFunc(cast(void**)&glSecondaryColor3ubv, "glSecondaryColor3ubv", doThrow);
334             bindExtendedFunc(cast(void**)&glSecondaryColor3ui, "glSecondaryColor3ui", doThrow);
335             bindExtendedFunc(cast(void**)&glSecondaryColor3uiv, "glSecondaryColor3uiv", doThrow);
336             bindExtendedFunc(cast(void**)&glSecondaryColor3us, "glSecondaryColor3us", doThrow);
337             bindExtendedFunc(cast(void**)&glSecondaryColor3usv, "glSecondaryColor3usv", doThrow);
338             bindExtendedFunc(cast(void**)&glSecondaryColorPointer, "glSecondaryColorPointer", doThrow);
339             bindExtendedFunc(cast(void**)&glWindowPos2d, "glWindowPos2d", doThrow);
340             bindExtendedFunc(cast(void**)&glWindowPos2dv, "glWindowPos2dv", doThrow);
341             bindExtendedFunc(cast(void**)&glWindowPos2f, "glWindowPos2f", doThrow);
342             bindExtendedFunc(cast(void**)&glWindowPos2fv, "glWindowPos2fv", doThrow);
343             bindExtendedFunc(cast(void**)&glWindowPos2i, "glWindowPos2i", doThrow);
344             bindExtendedFunc(cast(void**)&glWindowPos2iv, "glWindowPos2iv", doThrow);
345             bindExtendedFunc(cast(void**)&glWindowPos2s, "glWindowPos2s", doThrow);
346             bindExtendedFunc(cast(void**)&glWindowPos2sv, "glWindowPos2sv", doThrow);
347             bindExtendedFunc(cast(void**)&glWindowPos3d, "glWindowPos3d", doThrow);
348             bindExtendedFunc(cast(void**)&glWindowPos3dv, "glWindowPos3dv", doThrow);
349             bindExtendedFunc(cast(void**)&glWindowPos3f, "glWindowPos3f", doThrow);
350             bindExtendedFunc(cast(void**)&glWindowPos3fv, "glWindowPos3fv", doThrow);
351             bindExtendedFunc(cast(void**)&glWindowPos3i, "glWindowPos3i", doThrow);
352             bindExtendedFunc(cast(void**)&glWindowPos3iv, "glWindowPos3iv", doThrow);
353             bindExtendedFunc(cast(void**)&glWindowPos3s, "glWindowPos3s", doThrow);
354             bindExtendedFunc(cast(void**)&glWindowPos3sv, "glWindowPos3sv", doThrow);
355             bindExtendedFunc(cast(void**)&glBlendEquation, "glBlendEquation", doThrow);
356             bindExtendedFunc(cast(void**)&glBlendColor, "glBlendColor", doThrow);
357 
358             _maxVersion = GLVersion.GL14;
359         }
360 
361         if(maxAvail >= GLVersion.GL15)
362         {
363             doThrow = (targetVersion >= GLVersion.GL15);
364 
365             bindExtendedFunc(cast(void**)&glGenQueries, "glGenQueries", doThrow);
366             bindExtendedFunc(cast(void**)&glDeleteQueries, "glDeleteQueries", doThrow);
367             bindExtendedFunc(cast(void**)&glIsQuery, "glIsQuery", doThrow);
368             bindExtendedFunc(cast(void**)&glBeginQuery, "glBeginQuery", doThrow);
369             bindExtendedFunc(cast(void**)&glEndQuery, "glEndQuery", doThrow);
370             bindExtendedFunc(cast(void**)&glGetQueryiv, "glGetQueryiv", doThrow);
371             bindExtendedFunc(cast(void**)&glGetQueryObjectiv, "glGetQueryObjectiv", doThrow);
372             bindExtendedFunc(cast(void**)&glGetQueryObjectuiv, "glGetQueryObjectuiv", doThrow);
373             bindExtendedFunc(cast(void**)&glBindBuffer, "glBindBuffer", doThrow);
374             bindExtendedFunc(cast(void**)&glDeleteBuffers, "glDeleteBuffers", doThrow);
375             bindExtendedFunc(cast(void**)&glGenBuffers, "glGenBuffers", doThrow);
376             bindExtendedFunc(cast(void**)&glIsBuffer, "glIsBuffer", doThrow);
377             bindExtendedFunc(cast(void**)&glBufferData, "glBufferData", doThrow);
378             bindExtendedFunc(cast(void**)&glBufferSubData, "glBufferSubData", doThrow);
379             bindExtendedFunc(cast(void**)&glGetBufferSubData, "glGetBufferSubData", doThrow);
380             bindExtendedFunc(cast(void**)&glMapBuffer, "glMapBuffer", doThrow);
381             bindExtendedFunc(cast(void**)&glUnmapBuffer, "glUnmapBuffer", doThrow);
382             bindExtendedFunc(cast(void**)&glGetBufferParameteriv, "glGetBufferParameteriv", doThrow);
383             bindExtendedFunc(cast(void**)&glGetBufferPointerv, "glGetBufferPointerv", doThrow);
384 
385             _maxVersion = GLVersion.GL15;
386         }
387 
388         if(maxAvail >= GLVersion.GL20)
389         {
390             doThrow = (targetVersion >= GLVersion.GL20);
391 
392             bindExtendedFunc(cast(void**)&glBlendEquationSeparate, "glBlendEquationSeparate", doThrow);
393             bindExtendedFunc(cast(void**)&glDrawBuffers, "glDrawBuffers", doThrow);
394             bindExtendedFunc(cast(void**)&glStencilOpSeparate, "glStencilOpSeparate", doThrow);
395             bindExtendedFunc(cast(void**)&glStencilFuncSeparate, "glStencilFuncSeparate", doThrow);
396             bindExtendedFunc(cast(void**)&glStencilMaskSeparate, "glStencilMaskSeparate", doThrow);
397             bindExtendedFunc(cast(void**)&glAttachShader, "glAttachShader", doThrow);
398             bindExtendedFunc(cast(void**)&glBindAttribLocation, "glBindAttribLocation", doThrow);
399             bindExtendedFunc(cast(void**)&glCompileShader, "glCompileShader", doThrow);
400             bindExtendedFunc(cast(void**)&glCreateProgram, "glCreateProgram", doThrow);
401             bindExtendedFunc(cast(void**)&glCreateShader, "glCreateShader", doThrow);
402             bindExtendedFunc(cast(void**)&glDeleteProgram, "glDeleteProgram", doThrow);
403             bindExtendedFunc(cast(void**)&glDeleteShader, "glDeleteShader", doThrow);
404             bindExtendedFunc(cast(void**)&glDetachShader, "glDetachShader", doThrow);
405             bindExtendedFunc(cast(void**)&glDisableVertexAttribArray, "glDisableVertexAttribArray", doThrow);
406             bindExtendedFunc(cast(void**)&glEnableVertexAttribArray, "glEnableVertexAttribArray", doThrow);
407             bindExtendedFunc(cast(void**)&glGetActiveAttrib, "glGetActiveAttrib", doThrow);
408             bindExtendedFunc(cast(void**)&glGetActiveUniform, "glGetActiveUniform", doThrow);
409             bindExtendedFunc(cast(void**)&glGetAttachedShaders, "glGetAttachedShaders", doThrow);
410             bindExtendedFunc(cast(void**)&glGetAttribLocation, "glGetAttribLocation", doThrow);
411             bindExtendedFunc(cast(void**)&glGetProgramiv, "glGetProgramiv", doThrow);
412             bindExtendedFunc(cast(void**)&glGetProgramInfoLog, "glGetProgramInfoLog", doThrow);
413             bindExtendedFunc(cast(void**)&glGetShaderiv, "glGetShaderiv", doThrow);
414             bindExtendedFunc(cast(void**)&glGetShaderInfoLog, "glGetShaderInfoLog", doThrow);
415             bindExtendedFunc(cast(void**)&glGetShaderSource, "glGetShaderSource", doThrow);
416             bindExtendedFunc(cast(void**)&glGetUniformLocation, "glGetUniformLocation", doThrow);
417             bindExtendedFunc(cast(void**)&glGetUniformfv, "glGetUniformfv", doThrow);
418             bindExtendedFunc(cast(void**)&glGetUniformiv, "glGetUniformiv", doThrow);
419             bindExtendedFunc(cast(void**)&glGetVertexAttribdv, "glGetVertexAttribdv", doThrow);
420             bindExtendedFunc(cast(void**)&glGetVertexAttribfv, "glGetVertexAttribfv", doThrow);
421             bindExtendedFunc(cast(void**)&glGetVertexAttribiv, "glGetVertexAttribiv", doThrow);
422             bindExtendedFunc(cast(void**)&glGetVertexAttribPointerv, "glGetVertexAttribPointerv", doThrow);
423             bindExtendedFunc(cast(void**)&glIsProgram, "glIsProgram", doThrow);
424             bindExtendedFunc(cast(void**)&glIsShader, "glIsShader", doThrow);
425             bindExtendedFunc(cast(void**)&glLinkProgram, "glLinkProgram", doThrow);
426             bindExtendedFunc(cast(void**)&glShaderSource, "glShaderSource", doThrow);
427             bindExtendedFunc(cast(void**)&glUseProgram, "glUseProgram", doThrow);
428             bindExtendedFunc(cast(void**)&glUniform1f, "glUniform1f", doThrow);
429             bindExtendedFunc(cast(void**)&glUniform2f, "glUniform2f", doThrow);
430             bindExtendedFunc(cast(void**)&glUniform3f, "glUniform3f", doThrow);
431             bindExtendedFunc(cast(void**)&glUniform4f, "glUniform4f", doThrow);
432             bindExtendedFunc(cast(void**)&glUniform1i, "glUniform1i", doThrow);
433             bindExtendedFunc(cast(void**)&glUniform2i, "glUniform2i", doThrow);
434             bindExtendedFunc(cast(void**)&glUniform3i, "glUniform3i", doThrow);
435             bindExtendedFunc(cast(void**)&glUniform4i, "glUniform4i", doThrow);
436             bindExtendedFunc(cast(void**)&glUniform1fv, "glUniform1fv", doThrow);
437             bindExtendedFunc(cast(void**)&glUniform2fv, "glUniform2fv", doThrow);
438             bindExtendedFunc(cast(void**)&glUniform3fv, "glUniform3fv", doThrow);
439             bindExtendedFunc(cast(void**)&glUniform4fv, "glUniform4fv", doThrow);
440             bindExtendedFunc(cast(void**)&glUniform1iv, "glUniform1iv", doThrow);
441             bindExtendedFunc(cast(void**)&glUniform2iv, "glUniform2iv", doThrow);
442             bindExtendedFunc(cast(void**)&glUniform3iv, "glUniform3iv", doThrow);
443             bindExtendedFunc(cast(void**)&glUniform4iv, "glUniform4iv", doThrow);
444             bindExtendedFunc(cast(void**)&glUniformMatrix2fv, "glUniformMatrix2fv", doThrow);
445             bindExtendedFunc(cast(void**)&glUniformMatrix3fv, "glUniformMatrix3fv", doThrow);
446             bindExtendedFunc(cast(void**)&glUniformMatrix4fv, "glUniformMatrix4fv", doThrow);
447             bindExtendedFunc(cast(void**)&glValidateProgram, "glValidateProgram", doThrow);
448             bindExtendedFunc(cast(void**)&glVertexAttrib1d, "glVertexAttrib1d", doThrow);
449             bindExtendedFunc(cast(void**)&glVertexAttrib1dv, "glVertexAttrib1dv", doThrow);
450             bindExtendedFunc(cast(void**)&glVertexAttrib1f, "glVertexAttrib1f", doThrow);
451             bindExtendedFunc(cast(void**)&glVertexAttrib1fv, "glVertexAttrib1fv", doThrow);
452             bindExtendedFunc(cast(void**)&glVertexAttrib1s, "glVertexAttrib1s", doThrow);
453             bindExtendedFunc(cast(void**)&glVertexAttrib1sv, "glVertexAttrib1sv", doThrow);
454             bindExtendedFunc(cast(void**)&glVertexAttrib2d, "glVertexAttrib2d", doThrow);
455             bindExtendedFunc(cast(void**)&glVertexAttrib2dv, "glVertexAttrib2dv", doThrow);
456             bindExtendedFunc(cast(void**)&glVertexAttrib2f, "glVertexAttrib2f", doThrow);
457             bindExtendedFunc(cast(void**)&glVertexAttrib2fv, "glVertexAttrib2fv", doThrow);
458             bindExtendedFunc(cast(void**)&glVertexAttrib2s, "glVertexAttrib2s", doThrow);
459             bindExtendedFunc(cast(void**)&glVertexAttrib2sv, "glVertexAttrib2sv", doThrow);
460             bindExtendedFunc(cast(void**)&glVertexAttrib3d, "glVertexAttrib3d", doThrow);
461             bindExtendedFunc(cast(void**)&glVertexAttrib3dv, "glVertexAttrib3dv", doThrow);
462             bindExtendedFunc(cast(void**)&glVertexAttrib3f, "glVertexAttrib3f", doThrow);
463             bindExtendedFunc(cast(void**)&glVertexAttrib3fv, "glVertexAttrib3fv", doThrow);
464             bindExtendedFunc(cast(void**)&glVertexAttrib3s, "glVertexAttrib3s", doThrow);
465             bindExtendedFunc(cast(void**)&glVertexAttrib3sv, "glVertexAttrib3sv", doThrow);
466             bindExtendedFunc(cast(void**)&glVertexAttrib4Nbv, "glVertexAttrib4Nbv", doThrow);
467             bindExtendedFunc(cast(void**)&glVertexAttrib4Niv, "glVertexAttrib4Niv", doThrow);
468             bindExtendedFunc(cast(void**)&glVertexAttrib4Nsv, "glVertexAttrib4Nsv", doThrow);
469             bindExtendedFunc(cast(void**)&glVertexAttrib4Nub, "glVertexAttrib4Nub", doThrow);
470             bindExtendedFunc(cast(void**)&glVertexAttrib4Nubv, "glVertexAttrib4Nubv", doThrow);
471             bindExtendedFunc(cast(void**)&glVertexAttrib4Nuiv, "glVertexAttrib4Nuiv", doThrow);
472             bindExtendedFunc(cast(void**)&glVertexAttrib4Nusv, "glVertexAttrib4Nusv", doThrow);
473             bindExtendedFunc(cast(void**)&glVertexAttrib4bv, "glVertexAttrib4bv", doThrow);
474             bindExtendedFunc(cast(void**)&glVertexAttrib4d, "glVertexAttrib4d", doThrow);
475             bindExtendedFunc(cast(void**)&glVertexAttrib4dv, "glVertexAttrib4dv", doThrow);
476             bindExtendedFunc(cast(void**)&glVertexAttrib4f, "glVertexAttrib4f", doThrow);
477             bindExtendedFunc(cast(void**)&glVertexAttrib4fv, "glVertexAttrib4fv", doThrow);
478             bindExtendedFunc(cast(void**)&glVertexAttrib4iv, "glVertexAttrib4iv", doThrow);
479             bindExtendedFunc(cast(void**)&glVertexAttrib4s, "glVertexAttrib4s", doThrow);
480             bindExtendedFunc(cast(void**)&glVertexAttrib4sv, "glVertexAttrib4sv", doThrow);
481             bindExtendedFunc(cast(void**)&glVertexAttrib4ubv, "glVertexAttrib4ubv", doThrow);
482             bindExtendedFunc(cast(void**)&glVertexAttrib4uiv, "glVertexAttrib4uiv", doThrow);
483             bindExtendedFunc(cast(void**)&glVertexAttrib4usv, "glVertexAttrib4usv", doThrow);
484             bindExtendedFunc(cast(void**)&glVertexAttribPointer, "glVertexAttribPointer", doThrow);
485 
486             _maxVersion = GLVersion.GL20;
487         }
488 
489         if(maxAvail >= GLVersion.GL21)
490         {
491             doThrow = (targetVersion >= GLVersion.GL21);
492 
493             bindExtendedFunc(cast(void**)&glUniformMatrix2x3fv, "glUniformMatrix2x3fv", doThrow);
494             bindExtendedFunc(cast(void**)&glUniformMatrix3x2fv, "glUniformMatrix3x2fv", doThrow);
495             bindExtendedFunc(cast(void**)&glUniformMatrix2x4fv, "glUniformMatrix2x4fv", doThrow);
496             bindExtendedFunc(cast(void**)&glUniformMatrix4x2fv, "glUniformMatrix4x2fv", doThrow);
497             bindExtendedFunc(cast(void**)&glUniformMatrix3x4fv, "glUniformMatrix3x4fv", doThrow);
498             bindExtendedFunc(cast(void**)&glUniformMatrix4x3fv, "glUniformMatrix4x3fv", doThrow);
499 
500             _maxVersion = GLVersion.GL21;
501         }
502 
503         return _maxVersion;
504     }
505 
506     GLVersion loadModernVersions(GLVersion targetVersion = GLVersion.GL30)
507     {
508         if(!hasValidContext())
509             throw new DerelictException("An OpenGL context must be created and activated before attempting to load modern versions.");
510 
511         GLVersion maxAvail = findMaxAvailable();
512         if(maxAvail < targetVersion)
513             throw new DerelictException("Required GL version " ~ versionToString(targetVersion) ~ " is not available.");
514 
515         bool doThrow = false;
516 
517         // gl 3.0
518         if(maxAvail >= GLVersion.GL30)
519         {
520             doThrow = (targetVersion >= GLVersion.GL30);
521             bindExtendedFunc(cast(void**)&glBeginConditionalRender, "glBeginConditionalRender", doThrow);
522             bindExtendedFunc(cast(void**)&glBeginTransformFeedback, "glBeginTransformFeedback", doThrow);
523             bindExtendedFunc(cast(void**)&glBindFragDataLocation, "glBindFragDataLocation", doThrow);
524             bindExtendedFunc(cast(void**)&glClampColor, "glClampColor", doThrow);
525             bindExtendedFunc(cast(void**)&glClearBufferfi, "glClearBufferfi", doThrow);
526             bindExtendedFunc(cast(void**)&glClearBufferfv, "glClearBufferfv", doThrow);
527             bindExtendedFunc(cast(void**)&glClearBufferiv, "glClearBufferiv", doThrow);
528             bindExtendedFunc(cast(void**)&glClearBufferuiv, "glClearBufferuiv", doThrow);
529             bindExtendedFunc(cast(void**)&glColorMaski, "glColorMaski", doThrow);
530             bindExtendedFunc(cast(void**)&glDisablei, "glDisablei", doThrow);
531             bindExtendedFunc(cast(void**)&glEnablei, "glEnablei", doThrow);
532             bindExtendedFunc(cast(void**)&glEndConditionalRender, "glEndConditionalRender", doThrow);
533             bindExtendedFunc(cast(void**)&glEndTransformFeedback, "glEndTransformFeedback", doThrow);
534             bindExtendedFunc(cast(void**)&glBindBufferRange, "glBindBufferRange", doThrow);
535             bindExtendedFunc(cast(void**)&glBindBufferBase, "glBindBufferBase", doThrow);
536             bindExtendedFunc(cast(void**)&glGetBooleani_v, "glGetBooleani_v", doThrow);
537             bindExtendedFunc(cast(void**)&glGetIntegeri_v, "glGetIntegeri_v", doThrow);
538             bindExtendedFunc(cast(void**)&glGetFragDataLocation, "glGetFragDataLocation", doThrow);
539             bindExtendedFunc(cast(void**)&glGetStringi, "glGetStringi", doThrow);
540             bindExtendedFunc(cast(void**)&glGetTexParameterIiv, "glGetTexParameterIiv", doThrow);
541             bindExtendedFunc(cast(void**)&glGetTexParameterIuiv, "glGetTexParameterIuiv", doThrow);
542             bindExtendedFunc(cast(void**)&glIsEnabledi, "glIsEnabledi", doThrow);
543             bindExtendedFunc(cast(void**)&glTexParameterIiv, "glTexParameterIiv", doThrow);
544             bindExtendedFunc(cast(void**)&glTexParameterIuiv, "glTexParameterIuiv", doThrow);
545             bindExtendedFunc(cast(void**)&glTransformFeedbackVaryings, "glTransformFeedbackVaryings", doThrow);
546             bindExtendedFunc(cast(void**)&glGetTransformFeedbackVarying, "glGetTransformFeedbackVarying", doThrow);
547             bindExtendedFunc(cast(void**)&glUniform1ui, "glUniform1ui", doThrow);
548             bindExtendedFunc(cast(void**)&glUniform1uiv, "glUniform1uiv", doThrow);
549             bindExtendedFunc(cast(void**)&glUniform2ui, "glUniform2ui", doThrow);
550             bindExtendedFunc(cast(void**)&glUniform2uiv, "glUniform2uiv", doThrow);
551             bindExtendedFunc(cast(void**)&glUniform3ui, "glUniform3ui", doThrow);
552             bindExtendedFunc(cast(void**)&glUniform3uiv, "glUniform3uiv", doThrow);
553             bindExtendedFunc(cast(void**)&glUniform4ui, "glUniform4ui", doThrow);
554             bindExtendedFunc(cast(void**)&glUniform4uiv, "glUniform4uiv", doThrow);
555             bindExtendedFunc(cast(void**)&glVertexAttribI1i, "glVertexAttribI1i", doThrow);
556             bindExtendedFunc(cast(void**)&glVertexAttribI1iv, "glVertexAttribI1iv", doThrow);
557             bindExtendedFunc(cast(void**)&glVertexAttribI1ui, "glVertexAttribI1ui", doThrow);
558             bindExtendedFunc(cast(void**)&glVertexAttribI1uiv, "glVertexAttribI1uiv", doThrow);
559             bindExtendedFunc(cast(void**)&glVertexAttribI2i, "glVertexAttribI2i", doThrow);
560             bindExtendedFunc(cast(void**)&glVertexAttribI2iv, "glVertexAttribI2iv", doThrow);
561             bindExtendedFunc(cast(void**)&glVertexAttribI2ui, "glVertexAttribI2ui", doThrow);
562             bindExtendedFunc(cast(void**)&glVertexAttribI2uiv, "glVertexAttribI2uiv", doThrow);
563             bindExtendedFunc(cast(void**)&glVertexAttribI3i, "glVertexAttribI3i", doThrow);
564             bindExtendedFunc(cast(void**)&glVertexAttribI3iv, "glVertexAttribI3iv", doThrow);
565             bindExtendedFunc(cast(void**)&glVertexAttribI3ui, "glVertexAttribI3ui", doThrow);
566             bindExtendedFunc(cast(void**)&glVertexAttribI3uiv, "glVertexAttribI3uiv", doThrow);
567             bindExtendedFunc(cast(void**)&glVertexAttribI4bv, "glVertexAttribI4bv", doThrow);
568             bindExtendedFunc(cast(void**)&glVertexAttribI4i, "glVertexAttribI4i", doThrow);
569             bindExtendedFunc(cast(void**)&glVertexAttribI4iv, "glVertexAttribI4iv", doThrow);
570             bindExtendedFunc(cast(void**)&glVertexAttribI4sv, "glVertexAttribI4sv", doThrow);
571             bindExtendedFunc(cast(void**)&glVertexAttribI4ubv, "glVertexAttribI4ubv", doThrow);
572             bindExtendedFunc(cast(void**)&glVertexAttribI4ui, "glVertexAttribI4ui", doThrow);
573             bindExtendedFunc(cast(void**)&glVertexAttribI4uiv, "glVertexAttribI4uiv", doThrow);
574             bindExtendedFunc(cast(void**)&glVertexAttribI4usv, "glVertexAttribI4usv", doThrow);
575             bindExtendedFunc(cast(void**)&glVertexAttribIPointer, "glVertexAttribIPointer", doThrow);
576             bindExtendedFunc(cast(void**)&glGetVertexAttribIiv, "glGetVertexAttribIiv", doThrow);
577             bindExtendedFunc(cast(void**)&glGetVertexAttribIuiv, "glGetVertexAttribIuiv", doThrow);
578             bindExtendedFunc(cast(void**)&glGetUniformuiv, "glGetUniformuiv", doThrow);
579             bindExtendedFunc(cast(void**)&glGetStringi, "glGetStringi", doThrow);
580 
581             _maxVersion = GLVersion.GL30;
582         }
583 
584         if(maxAvail >= GLVersion.GL31)
585         {
586             bindExtendedFunc(cast(void**)&glDrawArraysInstanced, "glDrawArraysInstanced", doThrow);
587             bindExtendedFunc(cast(void**)&glDrawElementsInstanced, "glDrawElementsInstanced", doThrow);
588             bindExtendedFunc(cast(void**)&glPrimitiveRestartIndex, "glPrimitiveRestartIndex", doThrow);
589             bindExtendedFunc(cast(void**)&glTexBuffer, "glTexBuffer", doThrow);
590 
591             _maxVersion = GLVersion.GL31;
592         }
593 
594         if(maxAvail >= GLVersion.GL32)
595         {
596             bindExtendedFunc(cast(void**)&glFramebufferTexture, "glFramebufferTexture", doThrow);
597             bindExtendedFunc(cast(void**)&glGetBufferParameteri64v, "glGetBufferParameteri64v", doThrow);
598             bindExtendedFunc(cast(void**)&glGetInteger64i_v, "glGetInteger64i_v", doThrow);
599 
600             _maxVersion = GLVersion.GL32;
601         }
602 
603         if(maxAvail >= GLVersion.GL33)
604         {
605             bindExtendedFunc(cast(void**)&glVertexAttribDivisor, "glVertexAttribDivisor", doThrow);
606 
607             _maxVersion = GLVersion.GL33;
608         }
609 
610         if(maxAvail >= GLVersion.GL40)
611         {
612             bindExtendedFunc(cast(void**)&glBlendEquationSeparatei, "glBlendEquationSeparatei", doThrow);
613             bindExtendedFunc(cast(void**)&glBlendEquationi, "glBlendEquationi", doThrow);
614             bindExtendedFunc(cast(void**)&glBlendFuncSeparatei, "glBlendFuncSeparatei", doThrow);
615             bindExtendedFunc(cast(void**)&glBlendFunci, "glBlendFunci", doThrow);
616             bindExtendedFunc(cast(void**)&glMinSampleShading, "glMinSampleShading", doThrow);
617 
618             _maxVersion = GLVersion.GL40;
619         }
620 
621         return _maxVersion;
622     }
623 
624     string versionToString(GLVersion ver)
625     {
626         switch(ver)
627         {
628             case GLVersion.GL40:
629                 return "OpenGL Version 4.0";
630             case GLVersion.GL33:
631                 return "OpenGL Version 3.3";
632             case GLVersion.GL32:
633                 return "OpenGL Version 3.2";
634             case GLVersion.GL31:
635                 return "OpenGL Version 3.1";
636             case GLVersion.GL30:
637                 return "OpenGL Version 3.0";
638             case GLVersion.GL21:
639                 return "OpenGL Version 2.1";
640             case GLVersion.GL20:
641                 return "OpenGL Version 2.0";
642             case GLVersion.GL15:
643                 return "OpenGL Version 1.5";
644             case GLVersion.GL14:
645                 return "OpenGL Version 1.4";
646             case GLVersion.GL13:
647                 return "OpenGL Version 1.3";
648             case GLVersion.GL12:
649                 return "OpenGL Version 1.2";
650             case GLVersion.GL11:
651                 return "OpenGL Version 1.1";
652             case GLVersion.None:
653                 return "OpenGL Version None";
654             default:
655                 break;
656         }
657         return "Uknown OpenGL Version";
658     }
659 
660     bool hasValidContext()
661     {
662         version(Windows)
663         {
664             if(wglGetCurrentContext() is null)
665                 return false;
666         }
667         else version(GLX)
668         {
669             if(glXGetCurrentContext() is null)
670                 return false;
671         }
672         else version(MacOSX)
673         {
674             if(CGLGetCurrentContext() is null)
675                 return false;
676         }
677         else
678         {
679             static assert(0, "DerelictGLLoader.hasValidContext is unimplemented for this platform");
680         }
681 
682         return true;
683     }
684 
685 protected:
686     override void loadSymbols()
687     {
688         // gl 1.0
689         bindFunc(cast(void**)&glClearIndex, "glClearIndex");
690         bindFunc(cast(void**)&glClearColor, "glClearColor");
691         bindFunc(cast(void**)&glClear, "glClear");
692         bindFunc(cast(void**)&glIndexMask, "glIndexMask");
693         bindFunc(cast(void**)&glColorMask, "glColorMask");
694         bindFunc(cast(void**)&glAlphaFunc, "glAlphaFunc");
695         bindFunc(cast(void**)&glBlendFunc, "glBlendFunc");
696         bindFunc(cast(void**)&glLogicOp, "glLogicOp");
697         bindFunc(cast(void**)&glCullFace, "glCullFace");
698         bindFunc(cast(void**)&glFrontFace, "glFrontFace");
699         bindFunc(cast(void**)&glPointSize, "glPointSize");
700         bindFunc(cast(void**)&glLineWidth, "glLineWidth");
701         bindFunc(cast(void**)&glLineStipple, "glLineStipple");
702         bindFunc(cast(void**)&glPolygonMode, "glPolygonMode");
703         bindFunc(cast(void**)&glPolygonOffset, "glPolygonOffset");
704         bindFunc(cast(void**)&glPolygonStipple, "glPolygonStipple");
705         bindFunc(cast(void**)&glGetPolygonStipple, "glGetPolygonStipple");
706         bindFunc(cast(void**)&glEdgeFlag, "glEdgeFlag");
707         bindFunc(cast(void**)&glEdgeFlagv, "glEdgeFlagv");
708         bindFunc(cast(void**)&glScissor, "glScissor");
709         bindFunc(cast(void**)&glClipPlane, "glClipPlane");
710         bindFunc(cast(void**)&glGetClipPlane, "glGetClipPlane");
711         bindFunc(cast(void**)&glDrawBuffer, "glDrawBuffer");
712         bindFunc(cast(void**)&glReadBuffer, "glReadBuffer");
713         bindFunc(cast(void**)&glEnable, "glEnable");
714         bindFunc(cast(void**)&glDisable, "glDisable");
715         bindFunc(cast(void**)&glIsEnabled, "glIsEnabled");
716         bindFunc(cast(void**)&glEnableClientState, "glEnableClientState");
717         bindFunc(cast(void**)&glDisableClientState, "glDisableClientState");
718         bindFunc(cast(void**)&glGetBooleanv, "glGetBooleanv");
719         bindFunc(cast(void**)&glGetDoublev, "glGetDoublev");
720         bindFunc(cast(void**)&glGetFloatv, "glGetFloatv");
721         bindFunc(cast(void**)&glGetIntegerv, "glGetIntegerv");
722         bindFunc(cast(void**)&glPushAttrib, "glPushAttrib");
723         bindFunc(cast(void**)&glPopAttrib, "glPopAttrib");
724         bindFunc(cast(void**)&glPushClientAttrib, "glPushClientAttrib");
725         bindFunc(cast(void**)&glPopClientAttrib, "glPopClientAttrib");
726         bindFunc(cast(void**)&glRenderMode, "glRenderMode");
727         bindFunc(cast(void**)&glGetError, "glGetError");
728         bindFunc(cast(void**)&glGetString, "glGetString");
729         bindFunc(cast(void**)&glFinish, "glFinish");
730         bindFunc(cast(void**)&glFlush, "glFlush");
731         bindFunc(cast(void**)&glHint, "glHint");
732         bindFunc(cast(void**)&glClearDepth, "glClearDepth");
733         bindFunc(cast(void**)&glDepthFunc, "glDepthFunc");
734         bindFunc(cast(void**)&glDepthMask, "glDepthMask");
735         bindFunc(cast(void**)&glDepthRange, "glDepthRange");
736         bindFunc(cast(void**)&glClearAccum, "glClearAccum");
737         bindFunc(cast(void**)&glAccum, "glAccum");
738         bindFunc(cast(void**)&glMatrixMode, "glMatrixMode");
739         bindFunc(cast(void**)&glOrtho, "glOrtho");
740         bindFunc(cast(void**)&glFrustum, "glFrustum");
741         bindFunc(cast(void**)&glViewport, "glViewport");
742         bindFunc(cast(void**)&glPushMatrix, "glPushMatrix");
743         bindFunc(cast(void**)&glPopMatrix, "glPopMatrix");
744         bindFunc(cast(void**)&glLoadIdentity, "glLoadIdentity");
745         bindFunc(cast(void**)&glLoadMatrixd, "glLoadMatrixd");
746         bindFunc(cast(void**)&glLoadMatrixf, "glLoadMatrixf");
747         bindFunc(cast(void**)&glMultMatrixd, "glMultMatrixd");
748         bindFunc(cast(void**)&glMultMatrixf, "glMultMatrixf");
749         bindFunc(cast(void**)&glRotated, "glRotated");
750         bindFunc(cast(void**)&glRotatef, "glRotatef");
751         bindFunc(cast(void**)&glScaled, "glScaled");
752         bindFunc(cast(void**)&glScalef, "glScalef");
753         bindFunc(cast(void**)&glTranslated, "glTranslated");
754         bindFunc(cast(void**)&glTranslatef, "glTranslatef");
755         bindFunc(cast(void**)&glIsList, "glIsList");
756         bindFunc(cast(void**)&glDeleteLists, "glDeleteLists");
757         bindFunc(cast(void**)&glGenLists, "glGenLists");
758         bindFunc(cast(void**)&glNewList, "glNewList");
759         bindFunc(cast(void**)&glEndList, "glEndList");
760         bindFunc(cast(void**)&glCallList, "glCallList");
761         bindFunc(cast(void**)&glCallLists, "glCallLists");
762         bindFunc(cast(void**)&glListBase, "glListBase");
763         bindFunc(cast(void**)&glBegin, "glBegin");
764         bindFunc(cast(void**)&glEnd, "glEnd");
765         bindFunc(cast(void**)&glVertex2d, "glVertex2d");
766         bindFunc(cast(void**)&glVertex2f, "glVertex2f");
767         bindFunc(cast(void**)&glVertex2i, "glVertex2i");
768         bindFunc(cast(void**)&glVertex2s, "glVertex2s");
769         bindFunc(cast(void**)&glVertex3d, "glVertex3d");
770         bindFunc(cast(void**)&glVertex3f, "glVertex3f");
771         bindFunc(cast(void**)&glVertex3i, "glVertex3i");
772         bindFunc(cast(void**)&glVertex3s, "glVertex3s");
773         bindFunc(cast(void**)&glVertex4d, "glVertex4d");
774         bindFunc(cast(void**)&glVertex4f, "glVertex4f");
775         bindFunc(cast(void**)&glVertex4i, "glVertex4i");
776         bindFunc(cast(void**)&glVertex4s, "glVertex4s");
777         bindFunc(cast(void**)&glVertex2dv, "glVertex2dv");
778         bindFunc(cast(void**)&glVertex2fv, "glVertex2fv");
779         bindFunc(cast(void**)&glVertex2iv, "glVertex2iv");
780         bindFunc(cast(void**)&glVertex2sv, "glVertex2sv");
781         bindFunc(cast(void**)&glVertex3dv, "glVertex3dv");
782         bindFunc(cast(void**)&glVertex3fv, "glVertex3fv");
783         bindFunc(cast(void**)&glVertex3iv, "glVertex3iv");
784         bindFunc(cast(void**)&glVertex3sv, "glVertex3sv");
785         bindFunc(cast(void**)&glVertex4dv, "glVertex4dv");
786         bindFunc(cast(void**)&glVertex4fv, "glVertex4fv");
787         bindFunc(cast(void**)&glVertex4iv, "glVertex4iv");
788         bindFunc(cast(void**)&glVertex4sv, "glVertex4sv");
789         bindFunc(cast(void**)&glNormal3b, "glNormal3b");
790         bindFunc(cast(void**)&glNormal3d, "glNormal3d");
791         bindFunc(cast(void**)&glNormal3f, "glNormal3f");
792         bindFunc(cast(void**)&glNormal3i, "glNormal3i");
793         bindFunc(cast(void**)&glNormal3s, "glNormal3s");
794         bindFunc(cast(void**)&glNormal3bv, "glNormal3bv");
795         bindFunc(cast(void**)&glNormal3dv, "glNormal3dv");
796         bindFunc(cast(void**)&glNormal3fv, "glNormal3fv");
797         bindFunc(cast(void**)&glNormal3iv, "glNormal3iv");
798         bindFunc(cast(void**)&glNormal3sv, "glNormal3sv");
799         bindFunc(cast(void**)&glIndexd, "glIndexd");
800         bindFunc(cast(void**)&glIndexf, "glIndexf");
801         bindFunc(cast(void**)&glIndexi, "glIndexi");
802         bindFunc(cast(void**)&glIndexs, "glIndexs");
803         bindFunc(cast(void**)&glIndexub, "glIndexub");
804         bindFunc(cast(void**)&glIndexdv, "glIndexdv");
805         bindFunc(cast(void**)&glIndexfv, "glIndexfv");
806         bindFunc(cast(void**)&glIndexiv, "glIndexiv");
807         bindFunc(cast(void**)&glIndexsv, "glIndexsv");
808         bindFunc(cast(void**)&glIndexubv, "glIndexubv");
809         bindFunc(cast(void**)&glColor3b, "glColor3b");
810         bindFunc(cast(void**)&glColor3d, "glColor3d");
811         bindFunc(cast(void**)&glColor3f, "glColor3f");
812         bindFunc(cast(void**)&glColor3i, "glColor3i");
813         bindFunc(cast(void**)&glColor3s, "glColor3s");
814         bindFunc(cast(void**)&glColor3ub, "glColor3ub");
815         bindFunc(cast(void**)&glColor3ui, "glColor3ui");
816         bindFunc(cast(void**)&glColor3us, "glColor3us");
817         bindFunc(cast(void**)&glColor4b, "glColor4b");
818         bindFunc(cast(void**)&glColor4d, "glColor4d");
819         bindFunc(cast(void**)&glColor4f, "glColor4f");
820         bindFunc(cast(void**)&glColor4i, "glColor4i");
821         bindFunc(cast(void**)&glColor4s, "glColor4s");
822         bindFunc(cast(void**)&glColor4ub, "glColor4ub");
823         bindFunc(cast(void**)&glColor4ui, "glColor4ui");
824         bindFunc(cast(void**)&glColor4us, "glColor4us");
825         bindFunc(cast(void**)&glColor3bv, "glColor3bv");
826         bindFunc(cast(void**)&glColor3dv, "glColor3dv");
827         bindFunc(cast(void**)&glColor3fv, "glColor3fv");
828         bindFunc(cast(void**)&glColor3iv, "glColor3iv");
829         bindFunc(cast(void**)&glColor3sv, "glColor3sv");
830         bindFunc(cast(void**)&glColor3ubv, "glColor3ubv");
831         bindFunc(cast(void**)&glColor3uiv, "glColor3uiv");
832         bindFunc(cast(void**)&glColor3usv, "glColor3usv");
833         bindFunc(cast(void**)&glColor4bv, "glColor4bv");
834         bindFunc(cast(void**)&glColor4dv, "glColor4dv");
835         bindFunc(cast(void**)&glColor4fv, "glColor4fv");
836         bindFunc(cast(void**)&glColor4iv, "glColor4iv");
837         bindFunc(cast(void**)&glColor4sv, "glColor4sv");
838         bindFunc(cast(void**)&glColor4ubv, "glColor4ubv");
839         bindFunc(cast(void**)&glColor4uiv, "glColor4uiv");
840         bindFunc(cast(void**)&glColor4usv, "glColor4usv");
841         bindFunc(cast(void**)&glTexCoord1d, "glTexCoord1d");
842         bindFunc(cast(void**)&glTexCoord1f, "glTexCoord1f");
843         bindFunc(cast(void**)&glTexCoord1i, "glTexCoord1i");
844         bindFunc(cast(void**)&glTexCoord1s, "glTexCoord1s");
845         bindFunc(cast(void**)&glTexCoord2d, "glTexCoord2d");
846         bindFunc(cast(void**)&glTexCoord2f, "glTexCoord2f");
847         bindFunc(cast(void**)&glTexCoord2i, "glTexCoord2i");
848         bindFunc(cast(void**)&glTexCoord2s, "glTexCoord2s");
849         bindFunc(cast(void**)&glTexCoord3d, "glTexCoord3d");
850         bindFunc(cast(void**)&glTexCoord3f, "glTexCoord3f");
851         bindFunc(cast(void**)&glTexCoord3i, "glTexCoord3i");
852         bindFunc(cast(void**)&glTexCoord3s, "glTexCoord3s");
853         bindFunc(cast(void**)&glTexCoord4d, "glTexCoord4d");
854         bindFunc(cast(void**)&glTexCoord4f, "glTexCoord4f");
855         bindFunc(cast(void**)&glTexCoord4i, "glTexCoord4i");
856         bindFunc(cast(void**)&glTexCoord4s, "glTexCoord4s");
857         bindFunc(cast(void**)&glTexCoord1dv, "glTexCoord1dv");
858         bindFunc(cast(void**)&glTexCoord1fv, "glTexCoord1fv");
859         bindFunc(cast(void**)&glTexCoord1iv, "glTexCoord1iv");
860         bindFunc(cast(void**)&glTexCoord1sv, "glTexCoord1sv");
861         bindFunc(cast(void**)&glTexCoord2dv, "glTexCoord2dv");
862         bindFunc(cast(void**)&glTexCoord2fv, "glTexCoord2fv");
863         bindFunc(cast(void**)&glTexCoord2iv, "glTexCoord2iv");
864         bindFunc(cast(void**)&glTexCoord2sv, "glTexCoord2sv");
865         bindFunc(cast(void**)&glTexCoord3dv, "glTexCoord3dv");
866         bindFunc(cast(void**)&glTexCoord3fv, "glTexCoord3fv");
867         bindFunc(cast(void**)&glTexCoord3iv, "glTexCoord3iv");
868         bindFunc(cast(void**)&glTexCoord3sv, "glTexCoord3sv");
869         bindFunc(cast(void**)&glTexCoord4dv, "glTexCoord4dv");
870         bindFunc(cast(void**)&glTexCoord4fv, "glTexCoord4fv");
871         bindFunc(cast(void**)&glTexCoord4iv, "glTexCoord4iv");
872         bindFunc(cast(void**)&glTexCoord4sv, "glTexCoord4sv");
873         bindFunc(cast(void**)&glRasterPos2d, "glRasterPos2d");
874         bindFunc(cast(void**)&glRasterPos2f, "glRasterPos2f");
875         bindFunc(cast(void**)&glRasterPos2i, "glRasterPos2i");
876         bindFunc(cast(void**)&glRasterPos2s, "glRasterPos2s");
877         bindFunc(cast(void**)&glRasterPos3d, "glRasterPos3d");
878         bindFunc(cast(void**)&glRasterPos3f, "glRasterPos3f");
879         bindFunc(cast(void**)&glRasterPos3i, "glRasterPos3i");
880         bindFunc(cast(void**)&glRasterPos3s, "glRasterPos3s");
881         bindFunc(cast(void**)&glRasterPos4d, "glRasterPos4d");
882         bindFunc(cast(void**)&glRasterPos4f, "glRasterPos4f");
883         bindFunc(cast(void**)&glRasterPos4i, "glRasterPos4i");
884         bindFunc(cast(void**)&glRasterPos4s, "glRasterPos4s");
885         bindFunc(cast(void**)&glRasterPos2dv, "glRasterPos2dv");
886         bindFunc(cast(void**)&glRasterPos2fv, "glRasterPos2fv");
887         bindFunc(cast(void**)&glRasterPos2iv, "glRasterPos2iv");
888         bindFunc(cast(void**)&glRasterPos2sv, "glRasterPos2sv");
889         bindFunc(cast(void**)&glRasterPos3dv, "glRasterPos3dv");
890         bindFunc(cast(void**)&glRasterPos3fv, "glRasterPos3fv");
891         bindFunc(cast(void**)&glRasterPos3iv, "glRasterPos3iv");
892         bindFunc(cast(void**)&glRasterPos3sv, "glRasterPos3sv");
893         bindFunc(cast(void**)&glRasterPos4dv, "glRasterPos4dv");
894         bindFunc(cast(void**)&glRasterPos4fv, "glRasterPos4fv");
895         bindFunc(cast(void**)&glRasterPos4iv, "glRasterPos4iv");
896         bindFunc(cast(void**)&glRasterPos4sv, "glRasterPos4sv");
897         bindFunc(cast(void**)&glRectd, "glRectd");
898         bindFunc(cast(void**)&glRectf, "glRectf");
899         bindFunc(cast(void**)&glRecti, "glRecti");
900         bindFunc(cast(void**)&glRects, "glRects");
901         bindFunc(cast(void**)&glRectdv, "glRectdv");
902         bindFunc(cast(void**)&glRectfv, "glRectfv");
903         bindFunc(cast(void**)&glRectiv, "glRectiv");
904         bindFunc(cast(void**)&glRectsv, "glRectsv");
905         bindFunc(cast(void**)&glShadeModel, "glShadeModel");
906         bindFunc(cast(void**)&glLightf, "glLightf");
907         bindFunc(cast(void**)&glLighti, "glLighti");
908         bindFunc(cast(void**)&glLightfv, "glLightfv");
909         bindFunc(cast(void**)&glLightiv, "glLightiv");
910         bindFunc(cast(void**)&glGetLightfv, "glGetLightfv");
911         bindFunc(cast(void**)&glGetLightiv, "glGetLightiv");
912         bindFunc(cast(void**)&glLightModelf, "glLightModelf");
913         bindFunc(cast(void**)&glLightModeli, "glLightModeli");
914         bindFunc(cast(void**)&glLightModelfv, "glLightModelfv");
915         bindFunc(cast(void**)&glLightModeliv, "glLightModeliv");
916         bindFunc(cast(void**)&glMaterialf, "glMaterialf");
917         bindFunc(cast(void**)&glMateriali, "glMateriali");
918         bindFunc(cast(void**)&glMaterialfv, "glMaterialfv");
919         bindFunc(cast(void**)&glMaterialiv, "glMaterialiv");
920         bindFunc(cast(void**)&glGetMaterialfv, "glGetMaterialfv");
921         bindFunc(cast(void**)&glGetMaterialiv, "glGetMaterialiv");
922         bindFunc(cast(void**)&glColorMaterial, "glColorMaterial");
923         bindFunc(cast(void**)&glPixelZoom, "glPixelZoom");
924         bindFunc(cast(void**)&glPixelStoref, "glPixelStoref");
925         bindFunc(cast(void**)&glPixelStorei, "glPixelStorei");
926         bindFunc(cast(void**)&glPixelTransferf, "glPixelTransferf");
927         bindFunc(cast(void**)&glPixelTransferi, "glPixelTransferi");
928         bindFunc(cast(void**)&glPixelMapfv, "glPixelMapfv");
929         bindFunc(cast(void**)&glPixelMapuiv, "glPixelMapuiv");
930         bindFunc(cast(void**)&glPixelMapusv, "glPixelMapusv");
931         bindFunc(cast(void**)&glGetPixelMapfv, "glGetPixelMapfv");
932         bindFunc(cast(void**)&glGetPixelMapuiv, "glGetPixelMapuiv");
933         bindFunc(cast(void**)&glGetPixelMapusv, "glGetPixelMapusv");
934         bindFunc(cast(void**)&glBitmap, "glBitmap");
935         bindFunc(cast(void**)&glReadPixels, "glReadPixels");
936         bindFunc(cast(void**)&glDrawPixels, "glDrawPixels");
937         bindFunc(cast(void**)&glCopyPixels, "glCopyPixels");
938         bindFunc(cast(void**)&glStencilFunc, "glStencilFunc");
939         bindFunc(cast(void**)&glStencilMask, "glStencilMask");
940         bindFunc(cast(void**)&glStencilOp, "glStencilOp");
941         bindFunc(cast(void**)&glClearStencil, "glClearStencil");
942         bindFunc(cast(void**)&glTexGend, "glTexGend");
943         bindFunc(cast(void**)&glTexGenf, "glTexGenf");
944         bindFunc(cast(void**)&glTexGeni, "glTexGeni");
945         bindFunc(cast(void**)&glTexGendv, "glTexGendv");
946         bindFunc(cast(void**)&glTexGenfv, "glTexGenfv");
947         bindFunc(cast(void**)&glTexGeniv, "glTexGeniv");
948         bindFunc(cast(void**)&glTexEnvf, "glTexEnvf");
949         bindFunc(cast(void**)&glTexEnvi, "glTexEnvi");
950         bindFunc(cast(void**)&glTexEnvfv, "glTexEnvfv");
951         bindFunc(cast(void**)&glTexEnviv, "glTexEnviv");
952         bindFunc(cast(void**)&glGetTexEnvfv, "glGetTexEnvfv");
953         bindFunc(cast(void**)&glGetTexEnviv, "glGetTexEnviv");
954         bindFunc(cast(void**)&glTexParameterf, "glTexParameterf");
955         bindFunc(cast(void**)&glTexParameteri, "glTexParameteri");
956         bindFunc(cast(void**)&glTexParameterfv, "glTexParameterfv");
957         bindFunc(cast(void**)&glTexParameteriv, "glTexParameteriv");
958         bindFunc(cast(void**)&glGetTexParameterfv, "glGetTexParameterfv");
959         bindFunc(cast(void**)&glGetTexParameteriv, "glGetTexParameteriv");
960         bindFunc(cast(void**)&glGetTexLevelParameterfv, "glGetTexLevelParameterfv");
961         bindFunc(cast(void**)&glGetTexLevelParameteriv, "glGetTexLevelParameteriv");
962         bindFunc(cast(void**)&glTexImage1D, "glTexImage1D");
963         bindFunc(cast(void**)&glTexImage2D, "glTexImage2D");
964         bindFunc(cast(void**)&glGetTexImage, "glGetTexImage");
965         bindFunc(cast(void**)&glMap1d, "glMap1d");
966         bindFunc(cast(void**)&glMap1f, "glMap1f");
967         bindFunc(cast(void**)&glMap2d, "glMap2d");
968         bindFunc(cast(void**)&glMap2f, "glMap2f");
969         bindFunc(cast(void**)&glGetMapdv, "glGetMapdv");
970         bindFunc(cast(void**)&glGetMapfv, "glGetMapfv");
971         bindFunc(cast(void**)&glEvalCoord1d, "glEvalCoord1d");
972         bindFunc(cast(void**)&glEvalCoord1f, "glEvalCoord1f");
973         bindFunc(cast(void**)&glEvalCoord1dv, "glEvalCoord1dv");
974         bindFunc(cast(void**)&glEvalCoord1fv, "glEvalCoord1fv");
975         bindFunc(cast(void**)&glEvalCoord2d, "glEvalCoord2d");
976         bindFunc(cast(void**)&glEvalCoord2f, "glEvalCoord2f");
977         bindFunc(cast(void**)&glEvalCoord2dv, "glEvalCoord2dv");
978         bindFunc(cast(void**)&glEvalCoord2fv, "glEvalCoord2fv");
979         bindFunc(cast(void**)&glMapGrid1d, "glMapGrid1d");
980         bindFunc(cast(void**)&glMapGrid1f, "glMapGrid1f");
981         bindFunc(cast(void**)&glMapGrid2d, "glMapGrid2d");
982         bindFunc(cast(void**)&glMapGrid2f, "glMapGrid2f");
983         bindFunc(cast(void**)&glEvalPoint1, "glEvalPoint1");
984         bindFunc(cast(void**)&glEvalPoint2, "glEvalPoint2");
985         bindFunc(cast(void**)&glEvalMesh1, "glEvalMesh1");
986         bindFunc(cast(void**)&glEvalMesh2, "glEvalMesh2");
987         bindFunc(cast(void**)&glFogf, "glFogf");
988         bindFunc(cast(void**)&glFogi, "glFogi");
989         bindFunc(cast(void**)&glFogfv, "glFogfv");
990         bindFunc(cast(void**)&glFogiv, "glFogiv");
991         bindFunc(cast(void**)&glFeedbackBuffer, "glFeedbackBuffer");
992         bindFunc(cast(void**)&glPassThrough, "glPassThrough");
993         bindFunc(cast(void**)&glSelectBuffer, "glSelectBuffer");
994         bindFunc(cast(void**)&glInitNames, "glInitNames");
995         bindFunc(cast(void**)&glLoadName, "glLoadName");
996         bindFunc(cast(void**)&glPushName, "glPushName");
997         bindFunc(cast(void**)&glPopName, "glPopName");
998         // gl 1.1
999         bindFunc(cast(void**)&glGenTextures, "glGenTextures");
1000         bindFunc(cast(void**)&glDeleteTextures, "glDeleteTextures");
1001         bindFunc(cast(void**)&glBindTexture, "glBindTexture");
1002         bindFunc(cast(void**)&glPrioritizeTextures, "glPrioritizeTextures");
1003         bindFunc(cast(void**)&glAreTexturesResident, "glAreTexturesResident");
1004         bindFunc(cast(void**)&glIsTexture, "glIsTexture");
1005         bindFunc(cast(void**)&glTexSubImage1D, "glTexSubImage1D");
1006         bindFunc(cast(void**)&glTexSubImage2D, "glTexSubImage2D");
1007         bindFunc(cast(void**)&glCopyTexImage1D, "glCopyTexImage1D");
1008         bindFunc(cast(void**)&glCopyTexImage2D, "glCopyTexImage2D");
1009         bindFunc(cast(void**)&glCopyTexSubImage1D, "glCopyTexSubImage1D");
1010         bindFunc(cast(void**)&glCopyTexSubImage2D, "glCopyTexSubImage2D");
1011         bindFunc(cast(void**)&glVertexPointer, "glVertexPointer");
1012         bindFunc(cast(void**)&glNormalPointer, "glNormalPointer");
1013         bindFunc(cast(void**)&glColorPointer, "glColorPointer");
1014         bindFunc(cast(void**)&glIndexPointer, "glIndexPointer");
1015         bindFunc(cast(void**)&glTexCoordPointer, "glTexCoordPointer");
1016         bindFunc(cast(void**)&glEdgeFlagPointer, "glEdgeFlagPointer");
1017         bindFunc(cast(void**)&glGetPointerv, "glGetPointerv");
1018         bindFunc(cast(void**)&glArrayElement, "glArrayElement");
1019         bindFunc(cast(void**)&glDrawArrays, "glDrawArrays");
1020         bindFunc(cast(void**)&glDrawElements, "glDrawElements");
1021         bindFunc(cast(void**)&glInterleavedArrays, "glInterleavedArrays");
1022 
1023         loadPlatformGL(&bindFunc);
1024 
1025         _maxVersion = GLVersion.GL11;
1026     }
1027 
1028     public void bindExtendedFunc(void** ptr, string funcName, bool doThrow)
1029     {
1030         version(MacOSX)
1031         {
1032             bindFunc(ptr, funcName, doThrow);
1033         }
1034         else
1035         {
1036             void* func = loadGLSymbol(funcName);
1037             if(func is null && doThrow)
1038                 Derelict_HandleMissingSymbol(lib.name, funcName);
1039             else
1040                 *ptr = func;
1041         }
1042     }
1043 }
1044 
1045 DerelictGLLoader DerelictGL;
1046 
1047 static this()
1048 {
1049     DerelictGL = new DerelictGLLoader();
1050 }
1051 
1052 static ~this()
1053 {
1054     if(SharedLibLoader.isAutoUnloadEnabled())
1055         DerelictGL.unload();
1056 }