using System;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
using System.Security;
using SDL2;
using SlatedGameToolkit.Framework.Exceptions;

namespace SlatedGameToolkit.Framework.Graphics.OpenGL
{
    [SuppressUnmanagedCodeSecurity]
    [SuppressMessage("ReSharper", "StringLiteralTypo")]
    [SuppressMessage("ReSharper", "IdentifierTypo")]
    [SuppressMessage("ReSharper", "InconsistentNaming")]
    public class GLContext : IDisposable
    {
        #region OpenGLFunctions
            
        public IntPtr Handle { get; private set; }
        private bool disposed;

        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLCULLFACEPROC(CullFaceMode mode);
        private PFNGLCULLFACEPROC glCullFace;
        
        public void CullFace(CullFaceMode mode)
        {
            glCullFace.Invoke(mode);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLFRONTFACEPROC(FrontFaceDirection mode);
        private PFNGLFRONTFACEPROC glFrontFace;
        
        public void FrontFace(FrontFaceDirection mode)
        {
            glFrontFace.Invoke(mode);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLHINTPROC(HintTarget target, HintMode mode);
        private PFNGLHINTPROC glHint;
        
        public void Hint(HintTarget target, HintMode mode)
        {
            glHint.Invoke(target, mode);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLLINEWIDTHPROC(float width);
        private PFNGLLINEWIDTHPROC glLineWidth;
        
        public void LineWidth(float width)
        {
            glLineWidth.Invoke(width);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLPOINTSIZEPROC(float size);
        private PFNGLPOINTSIZEPROC glPointSize;
        
        public void PointSize(float size)
        {
            glPointSize.Invoke(size);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLPOLYGONMODEPROC(MaterialFace face, PolygonMode mode);
        private PFNGLPOLYGONMODEPROC glPolygonMode;
        
        public void PolygonMode(MaterialFace face, PolygonMode mode)
        {
            glPolygonMode.Invoke(face, mode);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLSCISSORPROC(int x, int y, int width, int height);
        private PFNGLSCISSORPROC glScissor;
        
        public void Scissor(int x, int y, int width, int height)
        {
            glScissor.Invoke(x, y, width, height);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLTEXPARAMETERFPROC(TextureTarget target, TextureParameterName pname, float param);
        private PFNGLTEXPARAMETERFPROC glTexParameterf;
        
        public void TexParameterf(TextureTarget target, TextureParameterName pname, float param)
        {
            glTexParameterf.Invoke(target, pname, param);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLTEXPARAMETERFVPROC(TextureTarget target, TextureParameterName pname, float[] parameters);
        private PFNGLTEXPARAMETERFVPROC glTexParameterfv;
        
        public void TexParameterfv(TextureTarget target, TextureParameterName pname, float[] parameters)
        {
            glTexParameterfv.Invoke(target, pname, parameters);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLTEXPARAMETERIPROC(TextureTarget target, TextureParameterName pname, int param);
        private PFNGLTEXPARAMETERIPROC glTexParameteri;
        
        public void TexParameteri(TextureTarget target, TextureParameterName pname, int param)
        {
            glTexParameteri.Invoke(target, pname, param);
            DetectGLError();
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLTEXPARAMETERIVPROC(TextureTarget target, TextureParameterName pname, int[] parameters);
        private PFNGLTEXPARAMETERIVPROC glTexParameteriv;
        
        public void TexParameteriv(TextureTarget target, TextureParameterName pname, int[] parameters)
        {
            glTexParameteriv.Invoke(target, pname, parameters);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLTEXIMAGE1DPROC(TextureTarget target, int level, int internalformat, int width, int border, PixelFormat format, PixelType type, IntPtr pixels);
        private PFNGLTEXIMAGE1DPROC glTexImage1D;
        
        public void TexImage1D(TextureTarget target, int level, int internalformat, int width, int border, PixelFormat format, PixelType type, IntPtr pixels)
        {
            glTexImage1D.Invoke(target, level, internalformat, width, border, format, type, pixels);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLTEXIMAGE2DPROC(TextureTarget target, int level, InternalFormat internalformat, uint width, uint height, int border, PixelFormat format, PixelType type, IntPtr pixels);
        private PFNGLTEXIMAGE2DPROC glTexImage2D;
        
        public void TexImage2D(TextureTarget target, int level, InternalFormat internalformat, uint width, uint height, int border, PixelFormat format, PixelType type, IntPtr pixels)
        {
            glTexImage2D.Invoke(target, level, internalformat, width, height, border, format, type, pixels);
            DetectGLError();
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLDRAWBUFFERPROC(DrawBufferMode buf);
        private PFNGLDRAWBUFFERPROC glDrawBuffer;
        
        public void DrawBuffer(DrawBufferMode buf)
        {
            glDrawBuffer.Invoke(buf);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLCLEARPROC(ClearBufferMask mask);
        private PFNGLCLEARPROC glClear;
        
        public void Clear(ClearBufferMask mask)
        {
            glClear.Invoke(mask);
            DetectGLError();
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLCLEARCOLORPROC(float red, float green, float blue, float alpha);
        private PFNGLCLEARCOLORPROC glClearColor;
        
        public void ClearColor(float red, float green, float blue, float alpha)
        {
            glClearColor.Invoke(red, green, blue, alpha);
            DetectGLError();
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLCLEARSTENCILPROC(int s);
        private PFNGLCLEARSTENCILPROC glClearStencil;
        
        public void ClearStencil(int s)
        {
            glClearStencil.Invoke(s);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLCLEARDEPTHPROC(double depth);
        private PFNGLCLEARDEPTHPROC glClearDepth;
        
        public void ClearDepth(double depth)
        {
            glClearDepth.Invoke(depth);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLSTENCILMASKPROC(uint mask);
        private PFNGLSTENCILMASKPROC glStencilMask;
        
        public void StencilMask(uint mask)
        {
            glStencilMask.Invoke(mask);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLCOLORMASKPROC(bool red, bool green, bool blue, bool alpha);
        private PFNGLCOLORMASKPROC glColorMask;
        
        public void ColorMask(bool red, bool green, bool blue, bool alpha)
        {
            glColorMask.Invoke(red, green, blue, alpha);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLDEPTHMASKPROC(bool flag);
        private PFNGLDEPTHMASKPROC glDepthMask;
        
        public void DepthMask(bool flag)
        {
            glDepthMask.Invoke(flag);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLDISABLEPROC(EnableCap cap);
        private PFNGLDISABLEPROC glDisable;
        
        public void Disable(EnableCap cap)
        {
            glDisable.Invoke(cap);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLENABLEPROC(EnableCap cap);
        private PFNGLENABLEPROC glEnable;
        
        public void Enable(EnableCap cap)
        {
            glEnable.Invoke(cap);
            DetectGLError();
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLFINISHPROC();
        private PFNGLFINISHPROC glFinish;
        
        public void Finish()
        {
            glFinish.Invoke();
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLFLUSHPROC();
        private PFNGLFLUSHPROC glFlush;
        
        public void Flush()
        {
            glFlush.Invoke();
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLBLENDFUNCPROC(BlendingFactor sfactor, BlendingFactor dfactor);
        private PFNGLBLENDFUNCPROC glBlendFunc;
        
        public void BlendFunc(BlendingFactor sfactor, BlendingFactor dfactor)
        {
            glBlendFunc.Invoke(sfactor, dfactor);
            DetectGLError();
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLLOGICOPPROC(LogicOp opcode);
        private PFNGLLOGICOPPROC glLogicOp;
        
        public void LogicOp(LogicOp opcode)
        {
            glLogicOp.Invoke(opcode);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLSTENCILFUNCPROC(StencilFunction func, int reference, uint mask);
        private PFNGLSTENCILFUNCPROC glStencilFunc;
        
        public void StencilFunc(StencilFunction func, int reference, uint mask)
        {
            glStencilFunc.Invoke(func, reference, mask);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLSTENCILOPPROC(StencilOp fail, StencilOp zfail, StencilOp zpass);
        private PFNGLSTENCILOPPROC glStencilOp;
        
        public void StencilOp(StencilOp fail, StencilOp zfail, StencilOp zpass)
        {
            glStencilOp.Invoke(fail, zfail, zpass);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLDEPTHFUNCPROC(DepthFunction func);
        private PFNGLDEPTHFUNCPROC glDepthFunc;
        
        public void DepthFunc(DepthFunction func)
        {
            glDepthFunc.Invoke(func);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLPIXELSTOREFPROC(PixelStoreParameter pname, float param);
        private PFNGLPIXELSTOREFPROC glPixelStoref;
        
        public void PixelStoref(PixelStoreParameter pname, float param)
        {
            glPixelStoref.Invoke(pname, param);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLPIXELSTOREIPROC(PixelStoreParameter pname, int param);
        private PFNGLPIXELSTOREIPROC glPixelStorei;
        
        public void PixelStorei(PixelStoreParameter pname, int param)
        {
            glPixelStorei.Invoke(pname, param);
            DetectGLError();
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLREADBUFFERPROC(ReadBufferMode src);
        private PFNGLREADBUFFERPROC glReadBuffer;
        
        public void ReadBuffer(ReadBufferMode src)
        {
            glReadBuffer.Invoke(src);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLREADPIXELSPROC(int x, int y, int width, int height, PixelFormat format, PixelType type, out IntPtr pixels);
        private PFNGLREADPIXELSPROC glReadPixels;
        
        public void ReadPixels(int x, int y, int width, int height, PixelFormat format, PixelType type, out IntPtr pixels)
        {
            glReadPixels.Invoke(x, y, width, height, format, type, out pixels);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGETBOOLEANVPROC(GetPName pname, out bool data);
        private PFNGLGETBOOLEANVPROC glGetBooleanv;
        
        public void GetBooleanv(GetPName pname, out bool data)
        {
            glGetBooleanv.Invoke(pname, out data);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGETDOUBLEVPROC(GetPName pname, out double data);
        private PFNGLGETDOUBLEVPROC glGetDoublev;
        
        public void GetDoublev(GetPName pname, out double data)
        {
            glGetDoublev.Invoke(pname, out data);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate ErrorCode PFNGLGETERRORPROC();
        private PFNGLGETERRORPROC glGetError;
        
        public ErrorCode GetError()
        {
            return glGetError.Invoke();
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGETFLOATVPROC(GetPName pname, out float data);
        private PFNGLGETFLOATVPROC glGetFloatv;
        
        public void GetFloatv(GetPName pname, out float data)
        {
            glGetFloatv.Invoke(pname, out data);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGETINTEGERVPROC(GetPName pname, int[] data);
        private PFNGLGETINTEGERVPROC glGetIntegerv;
        
        public void GetIntegerv(GetPName pname, int[] data)
        {
            glGetIntegerv.Invoke(pname, data);
            DetectGLError();
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate IntPtr PFNGLGETSTRINGPROC(StringName name);
        private PFNGLGETSTRINGPROC glGetString;
        
        public IntPtr GetString(StringName name)
        {
            IntPtr res = glGetString.Invoke(name);
            DetectGLError();
            return res;
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGETTEXIMAGEPROC(TextureTarget target, int level, PixelFormat format, PixelType type, out IntPtr pixels);
        private PFNGLGETTEXIMAGEPROC glGetTexImage;
        
        public void GetTexImage(TextureTarget target, int level, PixelFormat format, PixelType type, out IntPtr pixels)
        {
            glGetTexImage.Invoke(target, level, format, type, out pixels);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGETTEXPARAMETERFVPROC(TextureTarget target, GetTextureParameter pname, out float parameters);
        private PFNGLGETTEXPARAMETERFVPROC glGetTexParameterfv;
        
        public void GetTexParameterfv(TextureTarget target, GetTextureParameter pname, out float parameters)
        {
            glGetTexParameterfv.Invoke(target, pname, out parameters);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGETTEXPARAMETERIVPROC(TextureTarget target, GetTextureParameter pname, out int parameters);
        private PFNGLGETTEXPARAMETERIVPROC glGetTexParameteriv;
        
        public void GetTexParameteriv(TextureTarget target, GetTextureParameter pname, out int parameters)
        {
            glGetTexParameteriv.Invoke(target, pname, out parameters);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGETTEXLEVELPARAMETERFVPROC(TextureTarget target, int level, GetTextureParameter pname, out float parameters);
        private PFNGLGETTEXLEVELPARAMETERFVPROC glGetTexLevelParameterfv;
        
        public void GetTexLevelParameterfv(TextureTarget target, int level, GetTextureParameter pname, out float parameters)
        {
            glGetTexLevelParameterfv.Invoke(target, level, pname, out parameters);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGETTEXLEVELPARAMETERIVPROC(TextureTarget target, int level, GetTextureParameter pname, out int parameters);
        private PFNGLGETTEXLEVELPARAMETERIVPROC glGetTexLevelParameteriv;
        
        public void GetTexLevelParameteriv(TextureTarget target, int level, GetTextureParameter pname, out int parameters)
        {
            glGetTexLevelParameteriv.Invoke(target, level, pname, out parameters);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate bool PFNGLISENABLEDPROC(EnableCap cap);
        private PFNGLISENABLEDPROC glIsEnabled;
        
        public bool IsEnabled(EnableCap cap)
        {
            return glIsEnabled.Invoke(cap);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLDEPTHRANGEPROC(double n, double f);
        private PFNGLDEPTHRANGEPROC glDepthRange;
        
        public void DepthRange(double n, double f)
        {
            glDepthRange.Invoke(n, f);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVIEWPORTPROC(int x, int y, int width, int height);
        private PFNGLVIEWPORTPROC glViewport;
        
        public void Viewport(int x, int y, int width, int height)
        {
            glViewport.Invoke(x, y, width, height);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLDRAWARRAYSPROC(PrimitiveType mode, int first, int count);
        private PFNGLDRAWARRAYSPROC glDrawArrays;
        
        public void DrawArrays(PrimitiveType mode, int first, int count)
        {
            glDrawArrays.Invoke(mode, first, count);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLDRAWELEMENTSPROC(PrimitiveType mode, int count, DrawElementsType type, IntPtr indices);
        private PFNGLDRAWELEMENTSPROC glDrawElements;
        
        public void DrawElements(PrimitiveType mode, int count, DrawElementsType type, IntPtr indices)
        {
            glDrawElements.Invoke(mode, count, type, indices);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLPOLYGONOFFSETPROC(float factor, float units);
        private PFNGLPOLYGONOFFSETPROC glPolygonOffset;
        
        public void PolygonOffset(float factor, float units)
        {
            glPolygonOffset.Invoke(factor, units);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLCOPYTEXIMAGE1DPROC(TextureTarget target, int level, InternalFormat internalformat, int x, int y, int width, int border);
        private PFNGLCOPYTEXIMAGE1DPROC glCopyTexImage1D;
        
        public void CopyTexImage1D(TextureTarget target, int level, InternalFormat internalformat, int x, int y, int width, int border)
        {
            glCopyTexImage1D.Invoke(target, level, internalformat, x, y, width, border);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLCOPYTEXIMAGE2DPROC(TextureTarget target, int level, InternalFormat internalformat, int x, int y, int width, int height, int border);
        private PFNGLCOPYTEXIMAGE2DPROC glCopyTexImage2D;
        
        public void CopyTexImage2D(TextureTarget target, int level, InternalFormat internalformat, int x, int y, int width, int height, int border)
        {
            glCopyTexImage2D.Invoke(target, level, internalformat, x, y, width, height, border);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLCOPYTEXSUBIMAGE1DPROC(TextureTarget target, int level, int xoffset, int x, int y, int width);
        private PFNGLCOPYTEXSUBIMAGE1DPROC glCopyTexSubImage1D;
        
        public void CopyTexSubImage1D(TextureTarget target, int level, int xoffset, int x, int y, int width)
        {
            glCopyTexSubImage1D.Invoke(target, level, xoffset, x, y, width);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLCOPYTEXSUBIMAGE2DPROC(TextureTarget target, int level, int xoffset, int yoffset, int x, int y, int width, int height);
        private PFNGLCOPYTEXSUBIMAGE2DPROC glCopyTexSubImage2D;
        
        public void CopyTexSubImage2D(TextureTarget target, int level, int xoffset, int yoffset, int x, int y, int width, int height)
        {
            glCopyTexSubImage2D.Invoke(target, level, xoffset, yoffset, x, y, width, height);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLTEXSUBIMAGE1DPROC(TextureTarget target, int level, int xoffset, int width, PixelFormat format, PixelType type, IntPtr pixels);
        private PFNGLTEXSUBIMAGE1DPROC glTexSubImage1D;
        
        public void TexSubImage1D(TextureTarget target, int level, int xoffset, int width, PixelFormat format, PixelType type, IntPtr pixels)
        {
            glTexSubImage1D.Invoke(target, level, xoffset, width, format, type, pixels);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLTEXSUBIMAGE2DPROC(TextureTarget target, int level, int xoffset, int yoffset, int width, int height, PixelFormat format, PixelType type, IntPtr pixels);
        private PFNGLTEXSUBIMAGE2DPROC glTexSubImage2D;
        
        public void TexSubImage2D(TextureTarget target, int level, int xoffset, int yoffset, int width, int height, PixelFormat format, PixelType type, IntPtr pixels)
        {
            glTexSubImage2D.Invoke(target, level, xoffset, yoffset, width, height, format, type, pixels);
            DetectGLError();
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLBINDTEXTUREPROC(TextureTarget target, uint texture);
        private PFNGLBINDTEXTUREPROC glBindTexture;
        
        public void BindTexture(TextureTarget target, uint texture)
        {
            glBindTexture.Invoke(target, texture);
            DetectGLError();
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLDELETETEXTURESPROC(int n, uint[] textures);
        private PFNGLDELETETEXTURESPROC glDeleteTextures;
        
        public void DeleteTextures(int n, uint[] textures)
        {
            glDeleteTextures.Invoke(n, textures);
            DetectGLError();
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGENTEXTURESPROC(int n, uint[] textures);
        private PFNGLGENTEXTURESPROC glGenTextures;
        
        public void GenTextures(int n, uint[] textures)
        {
            glGenTextures.Invoke(n, textures);
            DetectGLError();
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate bool PFNGLISTEXTUREPROC(uint texture);
        private PFNGLISTEXTUREPROC glIsTexture;
        
        public bool IsTexture(uint texture)
        {
            return glIsTexture.Invoke(texture);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLDRAWRANGEELEMENTSPROC(PrimitiveType mode, uint start, uint end, int count, DrawElementsType type, IntPtr indices);
        private PFNGLDRAWRANGEELEMENTSPROC glDrawRangeElements;
        
        public void DrawRangeElements(PrimitiveType mode, uint start, uint end, int count, DrawElementsType type, IntPtr indices)
        {
            glDrawRangeElements.Invoke(mode, start, end, count, type, indices);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLTEXIMAGE3DPROC(TextureTarget target, int level, int internalformat, int width, int height, int depth, int border, PixelFormat format, PixelType type, IntPtr pixels);
        private PFNGLTEXIMAGE3DPROC glTexImage3D;
        
        public void TexImage3D(TextureTarget target, int level, int internalformat, int width, int height, int depth, int border, PixelFormat format, PixelType type, IntPtr pixels)
        {
            glTexImage3D.Invoke(target, level, internalformat, width, height, depth, border, format, type, pixels);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLTEXSUBIMAGE3DPROC(TextureTarget target, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, PixelFormat format, PixelType type, IntPtr pixels);
        private PFNGLTEXSUBIMAGE3DPROC glTexSubImage3D;
        
        public void TexSubImage3D(TextureTarget target, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, PixelFormat format, PixelType type, IntPtr pixels)
        {
            glTexSubImage3D.Invoke(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLCOPYTEXSUBIMAGE3DPROC(TextureTarget target, int level, int xoffset, int yoffset, int zoffset, int x, int y, int width, int height);
        private PFNGLCOPYTEXSUBIMAGE3DPROC glCopyTexSubImage3D;
        
        public void CopyTexSubImage3D(TextureTarget target, int level, int xoffset, int yoffset, int zoffset, int x, int y, int width, int height)
        {
            glCopyTexSubImage3D.Invoke(target, level, xoffset, yoffset, zoffset, x, y, width, height);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLACTIVETEXTUREPROC(TextureUnit texture);
        private PFNGLACTIVETEXTUREPROC glActiveTexture;
        
        public void ActiveTexture(TextureUnit texture)
        {
            glActiveTexture.Invoke(texture);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLSAMPLECOVERAGEPROC(float value, bool invert);
        private PFNGLSAMPLECOVERAGEPROC glSampleCoverage;
        
        public void SampleCoverage(float value, bool invert)
        {
            glSampleCoverage.Invoke(value, invert);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLCOMPRESSEDTEXIMAGE3DPROC(TextureTarget target, int level, InternalFormat internalformat, int width, int height, int depth, int border, int imageSize, IntPtr data);
        private PFNGLCOMPRESSEDTEXIMAGE3DPROC glCompressedTexImage3D;
        
        public void CompressedTexImage3D(TextureTarget target, int level, InternalFormat internalformat, int width, int height, int depth, int border, int imageSize, IntPtr data)
        {
            glCompressedTexImage3D.Invoke(target, level, internalformat, width, height, depth, border, imageSize, data);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLCOMPRESSEDTEXIMAGE2DPROC(TextureTarget target, int level, InternalFormat internalformat, int width, int height, int border, int imageSize, IntPtr data);
        private PFNGLCOMPRESSEDTEXIMAGE2DPROC glCompressedTexImage2D;
        
        public void CompressedTexImage2D(TextureTarget target, int level, InternalFormat internalformat, int width, int height, int border, int imageSize, IntPtr data)
        {
            glCompressedTexImage2D.Invoke(target, level, internalformat, width, height, border, imageSize, data);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLCOMPRESSEDTEXIMAGE1DPROC(TextureTarget target, int level, InternalFormat internalformat, int width, int border, int imageSize, IntPtr data);
        private PFNGLCOMPRESSEDTEXIMAGE1DPROC glCompressedTexImage1D;
        
        public void CompressedTexImage1D(TextureTarget target, int level, InternalFormat internalformat, int width, int border, int imageSize, IntPtr data)
        {
            glCompressedTexImage1D.Invoke(target, level, internalformat, width, border, imageSize, data);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC(TextureTarget target, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, PixelFormat format, int imageSize, IntPtr data);
        private PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC glCompressedTexSubImage3D;
        
        public void CompressedTexSubImage3D(TextureTarget target, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, PixelFormat format, int imageSize, IntPtr data)
        {
            glCompressedTexSubImage3D.Invoke(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC(TextureTarget target, int level, int xoffset, int yoffset, int width, int height, PixelFormat format, int imageSize, IntPtr data);
        private PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC glCompressedTexSubImage2D;
        
        public void CompressedTexSubImage2D(TextureTarget target, int level, int xoffset, int yoffset, int width, int height, PixelFormat format, int imageSize, IntPtr data)
        {
            glCompressedTexSubImage2D.Invoke(target, level, xoffset, yoffset, width, height, format, imageSize, data);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC(TextureTarget target, int level, int xoffset, int width, PixelFormat format, int imageSize, IntPtr data);
        private PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC glCompressedTexSubImage1D;
        
        public void CompressedTexSubImage1D(TextureTarget target, int level, int xoffset, int width, PixelFormat format, int imageSize, IntPtr data)
        {
            glCompressedTexSubImage1D.Invoke(target, level, xoffset, width, format, imageSize, data);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGETCOMPRESSEDTEXIMAGEPROC(TextureTarget target, int level, out IntPtr img);
        private PFNGLGETCOMPRESSEDTEXIMAGEPROC glGetCompressedTexImage;
        
        public void GetCompressedTexImage(TextureTarget target, int level, out IntPtr img)
        {
            glGetCompressedTexImage.Invoke(target, level, out img);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLBLENDFUNCSEPARATEPROC(BlendingFactor sfactorRGB, BlendingFactor dfactorRGB, BlendingFactor sfactorAlpha, BlendingFactor dfactorAlpha);
        private PFNGLBLENDFUNCSEPARATEPROC glBlendFuncSeparate;
        
        public void BlendFuncSeparate(BlendingFactor sfactorRGB, BlendingFactor dfactorRGB, BlendingFactor sfactorAlpha, BlendingFactor dfactorAlpha)
        {
            glBlendFuncSeparate.Invoke(sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLMULTIDRAWARRAYSPROC(PrimitiveType mode, int[] first, int[] count, int drawcount);
        private PFNGLMULTIDRAWARRAYSPROC glMultiDrawArrays;
        
        public void MultiDrawArrays(PrimitiveType mode, int[] first, int[] count, int drawcount)
        {
            glMultiDrawArrays.Invoke(mode, first, count, drawcount);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLMULTIDRAWELEMENTSPROC(PrimitiveType mode, int[] count, DrawElementsType type, IntPtr indices, int drawcount);
        private PFNGLMULTIDRAWELEMENTSPROC glMultiDrawElements;
        
        public void MultiDrawElements(PrimitiveType mode, int[] count, DrawElementsType type, IntPtr indices, int drawcount)
        {
            glMultiDrawElements.Invoke(mode, count, type, indices, drawcount);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLPOINTPARAMETERFPROC(int pname, float param);
        private PFNGLPOINTPARAMETERFPROC glPointParameterf;
        
        public void PointParameterf(int pname, float param)
        {
            glPointParameterf.Invoke(pname, param);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLPOINTPARAMETERFVPROC(int pname, float[] parameters);
        private PFNGLPOINTPARAMETERFVPROC glPointParameterfv;
        
        public void PointParameterfv(int pname, float[] parameters)
        {
            glPointParameterfv.Invoke(pname, parameters);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLPOINTPARAMETERIPROC(int pname, int param);
        private PFNGLPOINTPARAMETERIPROC glPointParameteri;
        
        public void PointParameteri(int pname, int param)
        {
            glPointParameteri.Invoke(pname, param);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLPOINTPARAMETERIVPROC(int pname, int[] parameters);
        private PFNGLPOINTPARAMETERIVPROC glPointParameteriv;
        
        public void PointParameteriv(int pname, int[] parameters)
        {
            glPointParameteriv.Invoke(pname, parameters);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIBP4UIVPROC(uint index, VertexAttribPointerType type, bool normalized, uint[] value);
        private PFNGLVERTEXATTRIBP4UIVPROC glVertexAttribP4uiv;
        
        public void VertexAttribP4uiv(uint index, VertexAttribPointerType type, bool normalized, uint[] value)
        {
            glVertexAttribP4uiv.Invoke(index, type, normalized, value);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIBP4UIPROC(uint index, VertexAttribPointerType type, bool normalized, uint value);
        private PFNGLVERTEXATTRIBP4UIPROC glVertexAttribP4ui;
        
        public void VertexAttribP4ui(uint index, VertexAttribPointerType type, bool normalized, uint value)
        {
            glVertexAttribP4ui.Invoke(index, type, normalized, value);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIBP3UIVPROC(uint index, VertexAttribPointerType type, bool normalized, uint[] value);
        private PFNGLVERTEXATTRIBP3UIVPROC glVertexAttribP3uiv;
        
        public void VertexAttribP3uiv(uint index, VertexAttribPointerType type, bool normalized, uint[] value)
        {
            glVertexAttribP3uiv.Invoke(index, type, normalized, value);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIBP3UIPROC(uint index, VertexAttribPointerType type, bool normalized, uint value);
        private PFNGLVERTEXATTRIBP3UIPROC glVertexAttribP3ui;
        
        public void VertexAttribP3ui(uint index, VertexAttribPointerType type, bool normalized, uint value)
        {
            glVertexAttribP3ui.Invoke(index, type, normalized, value);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIBP2UIVPROC(uint index, VertexAttribPointerType type, bool normalized, uint[] value);
        private PFNGLVERTEXATTRIBP2UIVPROC glVertexAttribP2uiv;
        
        public void VertexAttribP2uiv(uint index, VertexAttribPointerType type, bool normalized, uint[] value)
        {
            glVertexAttribP2uiv.Invoke(index, type, normalized, value);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIBP2UIPROC(uint index, VertexAttribPointerType type, bool normalized, uint value);
        private PFNGLVERTEXATTRIBP2UIPROC glVertexAttribP2ui;
        
        public void VertexAttribP2ui(uint index, VertexAttribPointerType type, bool normalized, uint value)
        {
            glVertexAttribP2ui.Invoke(index, type, normalized, value);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIBP1UIVPROC(uint index, VertexAttribPointerType type, bool normalized, uint[] value);
        private PFNGLVERTEXATTRIBP1UIVPROC glVertexAttribP1uiv;
        
        public void VertexAttribP1uiv(uint index, VertexAttribPointerType type, bool normalized, uint[] value)
        {
            glVertexAttribP1uiv.Invoke(index, type, normalized, value);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIBP1UIPROC(uint index, VertexAttribPointerType type, bool normalized, uint value);
        private PFNGLVERTEXATTRIBP1UIPROC glVertexAttribP1ui;
        
        public void VertexAttribP1ui(uint index, VertexAttribPointerType type, bool normalized, uint value)
        {
            glVertexAttribP1ui.Invoke(index, type, normalized, value);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIBDIVISORPROC(uint index, uint divisor);
        private PFNGLVERTEXATTRIBDIVISORPROC glVertexAttribDivisor;
        
        public void VertexAttribDivisor(uint index, uint divisor)
        {
            glVertexAttribDivisor.Invoke(index, divisor);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGETQUERYOBJECTUI64VPROC(uint id, QueryObjectParameterName pname, out ulong parameters);
        private PFNGLGETQUERYOBJECTUI64VPROC glGetQueryObjectui64v;
        
        public void GetQueryObjectui64v(uint id, QueryObjectParameterName pname, out ulong parameters)
        {
            glGetQueryObjectui64v.Invoke(id, pname, out parameters);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGETQUERYOBJECTI64VPROC(uint id, QueryObjectParameterName pname, out long parameters);
        private PFNGLGETQUERYOBJECTI64VPROC glGetQueryObjecti64v;
        
        public void GetQueryObjecti64v(uint id, QueryObjectParameterName pname, out long parameters)
        {
            glGetQueryObjecti64v.Invoke(id, pname, out parameters);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLQUERYCOUNTERPROC(uint id, QueryCounterTarget target);
        private PFNGLQUERYCOUNTERPROC glQueryCounter;
        
        public void QueryCounter(uint id, QueryCounterTarget target)
        {
            glQueryCounter.Invoke(id, target);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGETSAMPLERPARAMETERIUIVPROC(uint sampler, SamplerParameterName pname, out uint parameters);
        private PFNGLGETSAMPLERPARAMETERIUIVPROC glGetSamplerParameterIuiv;
        
        public void GetSamplerParameterIuiv(uint sampler, SamplerParameterName pname, out uint parameters)
        {
            glGetSamplerParameterIuiv.Invoke(sampler, pname, out parameters);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGETSAMPLERPARAMETERFVPROC(uint sampler, SamplerParameterName pname, out float parameters);
        private PFNGLGETSAMPLERPARAMETERFVPROC glGetSamplerParameterfv;
        
        public void GetSamplerParameterfv(uint sampler, SamplerParameterName pname, out float parameters)
        {
            glGetSamplerParameterfv.Invoke(sampler, pname, out parameters);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGETSAMPLERPARAMETERIIVPROC(uint sampler, SamplerParameterName pname, out int parameters);
        private PFNGLGETSAMPLERPARAMETERIIVPROC glGetSamplerParameterIiv;
        
        public void GetSamplerParameterIiv(uint sampler, SamplerParameterName pname, out int parameters)
        {
            glGetSamplerParameterIiv.Invoke(sampler, pname, out parameters);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGETSAMPLERPARAMETERIVPROC(uint sampler, SamplerParameterName pname, out int parameters);
        private PFNGLGETSAMPLERPARAMETERIVPROC glGetSamplerParameteriv;
        
        public void GetSamplerParameteriv(uint sampler, SamplerParameterName pname, out int parameters)
        {
            glGetSamplerParameteriv.Invoke(sampler, pname, out parameters);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLSAMPLERPARAMETERIUIVPROC(uint sampler, SamplerParameterName pname, uint[] param);
        private PFNGLSAMPLERPARAMETERIUIVPROC glSamplerParameterIuiv;
        
        public void SamplerParameterIuiv(uint sampler, SamplerParameterName pname, uint[] param)
        {
            glSamplerParameterIuiv.Invoke(sampler, pname, param);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLSAMPLERPARAMETERIIVPROC(uint sampler, SamplerParameterName pname, int[] param);
        private PFNGLSAMPLERPARAMETERIIVPROC glSamplerParameterIiv;
        
        public void SamplerParameterIiv(uint sampler, SamplerParameterName pname, int[] param)
        {
            glSamplerParameterIiv.Invoke(sampler, pname, param);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLSAMPLERPARAMETERFVPROC(uint sampler, SamplerParameterName pname, float[] param);
        private PFNGLSAMPLERPARAMETERFVPROC glSamplerParameterfv;
        
        public void SamplerParameterfv(uint sampler, SamplerParameterName pname, float[] param)
        {
            glSamplerParameterfv.Invoke(sampler, pname, param);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLSAMPLERPARAMETERFPROC(uint sampler, SamplerParameterName pname, float param);
        private PFNGLSAMPLERPARAMETERFPROC glSamplerParameterf;
        
        public void SamplerParameterf(uint sampler, SamplerParameterName pname, float param)
        {
            glSamplerParameterf.Invoke(sampler, pname, param);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLSAMPLERPARAMETERIVPROC(uint sampler, SamplerParameterName pname, int[] param);
        private PFNGLSAMPLERPARAMETERIVPROC glSamplerParameteriv;
        
        public void SamplerParameteriv(uint sampler, SamplerParameterName pname, int[] param)
        {
            glSamplerParameteriv.Invoke(sampler, pname, param);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLSAMPLERPARAMETERIPROC(uint sampler, SamplerParameterName pname, int param);
        private PFNGLSAMPLERPARAMETERIPROC glSamplerParameteri;
        
        public void SamplerParameteri(uint sampler, SamplerParameterName pname, int param)
        {
            glSamplerParameteri.Invoke(sampler, pname, param);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLBINDSAMPLERPROC(uint unit, uint sampler);
        private PFNGLBINDSAMPLERPROC glBindSampler;
        
        public void BindSampler(uint unit, uint sampler)
        {
            glBindSampler.Invoke(unit, sampler);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate bool PFNGLISSAMPLERPROC(uint sampler);
        private PFNGLISSAMPLERPROC glIsSampler;
        
        public bool IsSampler(uint sampler)
        {
            return glIsSampler.Invoke(sampler);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLDELETESAMPLERSPROC(int count, uint[] samplers);
        private PFNGLDELETESAMPLERSPROC glDeleteSamplers;
        
        public void DeleteSamplers(int count, uint[] samplers)
        {
            glDeleteSamplers.Invoke(count, samplers);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGENSAMPLERSPROC(int count, out uint samplers);
        private PFNGLGENSAMPLERSPROC glGenSamplers;
        
        public void GenSamplers(int count, out uint samplers)
        {
            glGenSamplers.Invoke(count, out samplers);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate int PFNGLGETFRAGDATAINDEXPROC(uint program, sbyte[] name);
        private PFNGLGETFRAGDATAINDEXPROC glGetFragDataIndex;
        
        public int GetFragDataIndex(uint program, sbyte[] name)
        {
            return glGetFragDataIndex.Invoke(program, name);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLBINDFRAGDATALOCATIONINDEXEDPROC(uint program, uint colorNumber, uint index, sbyte[] name);
        private PFNGLBINDFRAGDATALOCATIONINDEXEDPROC glBindFragDataLocationIndexed;
        
        public void BindFragDataLocationIndexed(uint program, uint colorNumber, uint index, sbyte[] name)
        {
            glBindFragDataLocationIndexed.Invoke(program, colorNumber, index, name);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLBLENDCOLORPROC(float red, float green, float blue, float alpha);
        private PFNGLBLENDCOLORPROC glBlendColor;
        
        public void BlendColor(float red, float green, float blue, float alpha)
        {
            glBlendColor.Invoke(red, green, blue, alpha);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLBLENDEQUATIONPROC(BlendEquationModeEXT mode);
        private PFNGLBLENDEQUATIONPROC glBlendEquation;
        
        public void BlendEquation(BlendEquationModeEXT mode)
        {
            glBlendEquation.Invoke(mode);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGENQUERIESPROC(int n, out uint ids);
        private PFNGLGENQUERIESPROC glGenQueries;
        
        public void GenQueries(int n, out uint ids)
        {
            glGenQueries.Invoke(n, out ids);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLDELETEQUERIESPROC(int n, uint[] ids);
        private PFNGLDELETEQUERIESPROC glDeleteQueries;
        
        public void DeleteQueries(int n, uint[] ids)
        {
            glDeleteQueries.Invoke(n, ids);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate bool PFNGLISQUERYPROC(uint id);
        private PFNGLISQUERYPROC glIsQuery;
        
        public bool IsQuery(uint id)
        {
            return glIsQuery.Invoke(id);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLBEGINQUERYPROC(QueryTarget target, uint id);
        private PFNGLBEGINQUERYPROC glBeginQuery;
        
        public void BeginQuery(QueryTarget target, uint id)
        {
            glBeginQuery.Invoke(target, id);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLENDQUERYPROC(QueryTarget target);
        private PFNGLENDQUERYPROC glEndQuery;
        
        public void EndQuery(QueryTarget target)
        {
            glEndQuery.Invoke(target);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGETQUERYIVPROC(QueryTarget target, QueryParameterName pname, out int parameters);
        private PFNGLGETQUERYIVPROC glGetQueryiv;
        
        public void GetQueryiv(QueryTarget target, QueryParameterName pname, out int parameters)
        {
            glGetQueryiv.Invoke(target, pname, out parameters);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGETQUERYOBJECTIVPROC(uint id, QueryObjectParameterName pname, out int parameters);
        private PFNGLGETQUERYOBJECTIVPROC glGetQueryObjectiv;
        
        public void GetQueryObjectiv(uint id, QueryObjectParameterName pname, out int parameters)
        {
            glGetQueryObjectiv.Invoke(id, pname, out parameters);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGETQUERYOBJECTUIVPROC(uint id, QueryObjectParameterName pname, out uint parameters);
        private PFNGLGETQUERYOBJECTUIVPROC glGetQueryObjectuiv;
        
        public void GetQueryObjectuiv(uint id, QueryObjectParameterName pname, out uint parameters)
        {
            glGetQueryObjectuiv.Invoke(id, pname, out parameters);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLBINDBUFFERPROC(BufferTargetARB target, uint buffer);
        private PFNGLBINDBUFFERPROC glBindBuffer;
        
        public void BindBuffer(BufferTargetARB target, uint buffer)
        {
            glBindBuffer.Invoke(target, buffer);
            DetectGLError();
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLDELETEBUFFERSPROC(int n, uint[] buffers);
        private PFNGLDELETEBUFFERSPROC glDeleteBuffers;
        
        public void DeleteBuffers(int n, uint[] buffers)
        {
            glDeleteBuffers.Invoke(n, buffers);
            DetectGLError();
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGENBUFFERSPROC(int n, uint[] buffers);
        private PFNGLGENBUFFERSPROC glGenBuffers;
        
        public void GenBuffers(int n, uint[] buffers)
        {
            glGenBuffers.Invoke(n, buffers);
            DetectGLError();
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate bool PFNGLISBUFFERPROC(uint buffer);
        private PFNGLISBUFFERPROC glIsBuffer;
        
        public bool IsBuffer(uint buffer)
        {
            return glIsBuffer.Invoke(buffer);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLBUFFERDATAPROC(BufferTargetARB target, uint size, IntPtr data, BufferUsageARB usage);
        private PFNGLBUFFERDATAPROC glBufferData;
        
        public void BufferData(BufferTargetARB target, uint size, IntPtr data, BufferUsageARB usage)
        {
            glBufferData.Invoke(target, size, data, usage);
            DetectGLError();
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLBUFFERSUBDATAPROC(BufferTargetARB target, IntPtr offset, UIntPtr size, IntPtr data);
        private PFNGLBUFFERSUBDATAPROC glBufferSubData;
        
        public void BufferSubData(BufferTargetARB target, IntPtr offset, UIntPtr size, IntPtr data)
        {
            glBufferSubData.Invoke(target, offset, size, data);
            DetectGLError();
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGETBUFFERSUBDATAPROC(BufferTargetARB target, IntPtr offset, IntPtr size, out IntPtr data);
        private PFNGLGETBUFFERSUBDATAPROC glGetBufferSubData;
        
        public void GetBufferSubData(BufferTargetARB target, IntPtr offset, IntPtr size, out IntPtr data)
        {
            glGetBufferSubData.Invoke(target, offset, size, out data);
            DetectGLError();
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate IntPtr PFNGLMAPBUFFERPROC(BufferTargetARB target, BufferAccessARB access);
        private PFNGLMAPBUFFERPROC glMapBuffer;
        
        public IntPtr MapBuffer(BufferTargetARB target, BufferAccessARB access)
        {
            return glMapBuffer.Invoke(target, access);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate bool PFNGLUNMAPBUFFERPROC(BufferTargetARB target);
        private PFNGLUNMAPBUFFERPROC glUnmapBuffer;
        
        public bool UnmapBuffer(BufferTargetARB target)
        {
            return glUnmapBuffer.Invoke(target);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGETBUFFERPARAMETERIVPROC(BufferTargetARB target, int pname, out int parameters);
        private PFNGLGETBUFFERPARAMETERIVPROC glGetBufferParameteriv;
        
        public void GetBufferParameteriv(BufferTargetARB target, int pname, out int parameters)
        {
            glGetBufferParameteriv.Invoke(target, pname, out parameters);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGETBUFFERPOINTERVPROC(BufferTargetARB target, int pname, out IntPtr parameters);
        private PFNGLGETBUFFERPOINTERVPROC glGetBufferPointerv;
        
        public void GetBufferPointerv(BufferTargetARB target, int pname, out IntPtr parameters)
        {
            glGetBufferPointerv.Invoke(target, pname, out parameters);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLBLENDEQUATIONSEPARATEPROC(BlendEquationModeEXT modeRGB, BlendEquationModeEXT modeAlpha);
        private PFNGLBLENDEQUATIONSEPARATEPROC glBlendEquationSeparate;
        
        public void BlendEquationSeparate(BlendEquationModeEXT modeRGB, BlendEquationModeEXT modeAlpha)
        {
            glBlendEquationSeparate.Invoke(modeRGB, modeAlpha);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLDRAWBUFFERSPROC(int n, int[] bufs);
        private PFNGLDRAWBUFFERSPROC glDrawBuffers;
        
        public void DrawBuffers(int n, int[] bufs)
        {
            glDrawBuffers.Invoke(n, bufs);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLSTENCILOPSEPARATEPROC(StencilFaceDirection face, StencilOp sfail, StencilOp dpfail, StencilOp dppass);
        private PFNGLSTENCILOPSEPARATEPROC glStencilOpSeparate;
        
        public void StencilOpSeparate(StencilFaceDirection face, StencilOp sfail, StencilOp dpfail, StencilOp dppass)
        {
            glStencilOpSeparate.Invoke(face, sfail, dpfail, dppass);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLSTENCILFUNCSEPARATEPROC(StencilFaceDirection face, StencilFunction func, int reference, uint mask);
        private PFNGLSTENCILFUNCSEPARATEPROC glStencilFuncSeparate;
        
        public void StencilFuncSeparate(StencilFaceDirection face, StencilFunction func, int reference, uint mask)
        {
            glStencilFuncSeparate.Invoke(face, func, reference, mask);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLSTENCILMASKSEPARATEPROC(StencilFaceDirection face, uint mask);
        private PFNGLSTENCILMASKSEPARATEPROC glStencilMaskSeparate;
        
        public void StencilMaskSeparate(StencilFaceDirection face, uint mask)
        {
            glStencilMaskSeparate.Invoke(face, mask);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLATTACHSHADERPROC(uint program, uint shader);
        private PFNGLATTACHSHADERPROC glAttachShader;
        
        public void AttachShader(uint program, uint shader)
        {
            glAttachShader.Invoke(program, shader);
            DetectGLError();
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLBINDATTRIBLOCATIONPROC(uint program, uint index, sbyte[] name);
        private PFNGLBINDATTRIBLOCATIONPROC glBindAttribLocation;
        
        public void BindAttribLocation(uint program, uint index, sbyte[] name)
        {
            glBindAttribLocation.Invoke(program, index, name);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLCOMPILESHADERPROC(uint shader);
        private PFNGLCOMPILESHADERPROC glCompileShader;
        
        public void CompileShader(uint shader)
        {
            glCompileShader.Invoke(shader);
            DetectGLError();
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate uint PFNGLCREATEPROGRAMPROC();
        private PFNGLCREATEPROGRAMPROC glCreateProgram;
        
        public uint CreateProgram()
        {
            uint handle = glCreateProgram.Invoke();
            DetectGLError();
            return handle;
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate uint PFNGLCREATESHADERPROC(ShaderType type);
        private PFNGLCREATESHADERPROC glCreateShader;
        
        public uint CreateShader(ShaderType type)
        {
            uint handle = glCreateShader.Invoke(type);
            DetectGLError();
            return handle;
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLDELETEPROGRAMPROC(uint program);
        private PFNGLDELETEPROGRAMPROC glDeleteProgram;
        
        public void DeleteProgram(uint program)
        {
            glDeleteProgram.Invoke(program);
            DetectGLError();
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLDELETESHADERPROC(uint shader);
        private PFNGLDELETESHADERPROC glDeleteShader;
        
        public void DeleteShader(uint shader)
        {
            glDeleteShader.Invoke(shader);
            DetectGLError();
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLDETACHSHADERPROC(uint program, uint shader);
        private PFNGLDETACHSHADERPROC glDetachShader;
        
        public void DetachShader(uint program, uint shader)
        {
            glDetachShader.Invoke(program, shader);
            DetectGLError();
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLDISABLEVERTEXATTRIBARRAYPROC(uint index);
        private PFNGLDISABLEVERTEXATTRIBARRAYPROC glDisableVertexAttribArray;
        
        public void DisableVertexAttribArray(uint index)
        {
            glDisableVertexAttribArray.Invoke(index);
            DetectGLError();
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLENABLEVERTEXATTRIBARRAYPROC(uint index);
        private PFNGLENABLEVERTEXATTRIBARRAYPROC glEnableVertexAttribArray;
        
        public void EnableVertexAttribArray(uint index)
        {
            glEnableVertexAttribArray.Invoke(index);
            DetectGLError();
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGETACTIVEATTRIBPROC(uint program, uint index, int bufSize, out int length, out int size, out AttributeType type, out sbyte name);
        private PFNGLGETACTIVEATTRIBPROC glGetActiveAttrib;
        
        public void GetActiveAttrib(uint program, uint index, int bufSize, out int length, out int size, out AttributeType type, out sbyte name)
        {
            glGetActiveAttrib.Invoke(program, index, bufSize, out length, out size, out type, out name);
            DetectGLError();
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGETACTIVEUNIFORMPROC(uint program, uint index, int bufSize, out int length, out int size, out AttributeType type, out sbyte name);
        private PFNGLGETACTIVEUNIFORMPROC glGetActiveUniform;
        
        public void GetActiveUniform(uint program, uint index, int bufSize, out int length, out int size, out AttributeType type, out sbyte name)
        {
            glGetActiveUniform.Invoke(program, index, bufSize, out length, out size, out type, out name);
            DetectGLError();
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGETATTACHEDSHADERSPROC(uint program, int maxCount, out int count, out uint shaders);
        private PFNGLGETATTACHEDSHADERSPROC glGetAttachedShaders;
        
        public void GetAttachedShaders(uint program, int maxCount, out int count, out uint shaders)
        {
            glGetAttachedShaders.Invoke(program, maxCount, out count, out shaders);
            DetectGLError();
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate int PFNGLGETATTRIBLOCATIONPROC(uint program, string name);
        private PFNGLGETATTRIBLOCATIONPROC glGetAttribLocation;
        
        public int GetAttribLocation(uint program, string name)
        {
            int loc = glGetAttribLocation.Invoke(program, name);
            DetectGLError();
            return loc;
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGETPROGRAMIVPROC(uint program, ProgramPropertyARB pname, out int parameters);
        private PFNGLGETPROGRAMIVPROC glGetProgramiv;
        
        public void GetProgramiv(uint program, ProgramPropertyARB pname, out int parameters)
        {
            glGetProgramiv.Invoke(program, pname, out parameters);
            DetectGLError();
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGETPROGRAMINFOLOGPROC(uint program, int bufSize, out int length, byte[] infoLog);
        private PFNGLGETPROGRAMINFOLOGPROC glGetProgramInfoLog;
        
        public void GetProgramInfoLog(uint program, int bufSize, out int length, byte[] infoLog)
        {
            glGetProgramInfoLog.Invoke(program, bufSize, out length, infoLog);
            DetectGLError();
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGETSHADERIVPROC(uint shader, ShaderParameterName pname, out int parameters);
        private PFNGLGETSHADERIVPROC glGetShaderiv;
        
        public void GetShaderiv(uint shader, ShaderParameterName pname, out int parameters)
        {
            glGetShaderiv.Invoke(shader, pname, out parameters);
            DetectGLError();
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGETSHADERINFOLOGPROC(uint shader, int bufSize, out int length, byte[] infoLog);
        private PFNGLGETSHADERINFOLOGPROC glGetShaderInfoLog;
        
        public void GetShaderInfoLog(uint shader, int bufSize, out int length, byte[] infoLog)
        {
            glGetShaderInfoLog.Invoke(shader, bufSize, out length, infoLog);
            DetectGLError();
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGETSHADERSOURCEPROC(uint shader, int bufSize, out int length, out sbyte source);
        private PFNGLGETSHADERSOURCEPROC glGetShaderSource;
        
        public void GetShaderSource(uint shader, int bufSize, out int length, out sbyte source)
        {
            glGetShaderSource.Invoke(shader, bufSize, out length, out source);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate int PFNGLGETUNIFORMLOCATIONPROC(uint program, string name);
        private PFNGLGETUNIFORMLOCATIONPROC glGetUniformLocation;
        
        public int GetUniformLocation(uint program, string name)
        {
            int loc = glGetUniformLocation.Invoke(program, name);
            DetectGLError();
            return loc;
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGETUNIFORMFVPROC(uint program, int location, out float parameters);
        private PFNGLGETUNIFORMFVPROC glGetUniformfv;
        
        public void GetUniformfv(uint program, int location, out float parameters)
        {
            glGetUniformfv.Invoke(program, location, out parameters);
            DetectGLError();
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGETUNIFORMIVPROC(uint program, int location, out int parameters);
        private PFNGLGETUNIFORMIVPROC glGetUniformiv;
        
        public void GetUniformiv(uint program, int location, out int parameters)
        {
            glGetUniformiv.Invoke(program, location, out parameters);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGETVERTEXATTRIBDVPROC(uint index, int pname, out double parameters);
        private PFNGLGETVERTEXATTRIBDVPROC glGetVertexAttribdv;
        
        public void GetVertexAttribdv(uint index, int pname, out double parameters)
        {
            glGetVertexAttribdv.Invoke(index, pname, out parameters);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGETVERTEXATTRIBFVPROC(uint index, int pname, out float parameters);
        private PFNGLGETVERTEXATTRIBFVPROC glGetVertexAttribfv;
        
        public void GetVertexAttribfv(uint index, int pname, out float parameters)
        {
            glGetVertexAttribfv.Invoke(index, pname, out parameters);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGETVERTEXATTRIBIVPROC(uint index, int pname, out int parameters);
        private PFNGLGETVERTEXATTRIBIVPROC glGetVertexAttribiv;
        
        public void GetVertexAttribiv(uint index, int pname, out int parameters)
        {
            glGetVertexAttribiv.Invoke(index, pname, out parameters);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGETVERTEXATTRIBPOINTERVPROC(uint index, int pname, out IntPtr pointer);
        private PFNGLGETVERTEXATTRIBPOINTERVPROC glGetVertexAttribPointerv;
        
        public void GetVertexAttribPointerv(uint index, int pname, out IntPtr pointer)
        {
            glGetVertexAttribPointerv.Invoke(index, pname, out pointer);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate bool PFNGLISPROGRAMPROC(uint program);
        private PFNGLISPROGRAMPROC glIsProgram;
        
        public bool IsProgram(uint program)
        {
            return glIsProgram.Invoke(program);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate bool PFNGLISSHADERPROC(uint shader);
        private PFNGLISSHADERPROC glIsShader;
        
        public bool IsShader(uint shader)
        {
            return glIsShader.Invoke(shader);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLLINKPROGRAMPROC(uint program);
        private PFNGLLINKPROGRAMPROC glLinkProgram;
        
        public void LinkProgram(uint program)
        {
            glLinkProgram.Invoke(program);
            DetectGLError();
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLSHADERSOURCEPROC(uint shader, int count, string[] str, int[] length);
        private PFNGLSHADERSOURCEPROC glShaderSource;
        
        public void ShaderSource(uint shader, int count, string[] str, int[] length)
        {
            glShaderSource.Invoke(shader, count, str, length);
            DetectGLError();
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLUSEPROGRAMPROC(uint program);
        private PFNGLUSEPROGRAMPROC glUseProgram;
        
        public void UseProgram(uint program)
        {
            glUseProgram.Invoke(program);
            DetectGLError();
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLUNIFORM1FPROC(int location, float v0);
        private PFNGLUNIFORM1FPROC glUniform1f;
        
        public void Uniform1f(int location, float v0)
        {
            glUniform1f.Invoke(location, v0);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLUNIFORM2FPROC(int location, float v0, float v1);
        private PFNGLUNIFORM2FPROC glUniform2f;
        
        public void Uniform2f(int location, float v0, float v1)
        {
            glUniform2f.Invoke(location, v0, v1);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLUNIFORM3FPROC(int location, float v0, float v1, float v2);
        private PFNGLUNIFORM3FPROC glUniform3f;
        
        public void Uniform3f(int location, float v0, float v1, float v2)
        {
            glUniform3f.Invoke(location, v0, v1, v2);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLUNIFORM4FPROC(int location, float v0, float v1, float v2, float v3);
        private PFNGLUNIFORM4FPROC glUniform4f;
        
        public void Uniform4f(int location, float v0, float v1, float v2, float v3)
        {
            glUniform4f.Invoke(location, v0, v1, v2, v3);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLUNIFORM1IPROC(int location, int v0);
        private PFNGLUNIFORM1IPROC glUniform1i;
        
        public void Uniform1i(int location, int v0)
        {
            glUniform1i.Invoke(location, v0);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLUNIFORM2IPROC(int location, int v0, int v1);
        private PFNGLUNIFORM2IPROC glUniform2i;
        
        public void Uniform2i(int location, int v0, int v1)
        {
            glUniform2i.Invoke(location, v0, v1);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLUNIFORM3IPROC(int location, int v0, int v1, int v2);
        private PFNGLUNIFORM3IPROC glUniform3i;
        
        public void Uniform3i(int location, int v0, int v1, int v2)
        {
            glUniform3i.Invoke(location, v0, v1, v2);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLUNIFORM4IPROC(int location, int v0, int v1, int v2, int v3);
        private PFNGLUNIFORM4IPROC glUniform4i;
        
        public void Uniform4i(int location, int v0, int v1, int v2, int v3)
        {
            glUniform4i.Invoke(location, v0, v1, v2, v3);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLUNIFORM1FVPROC(int location, int count, float[] value);
        private PFNGLUNIFORM1FVPROC glUniform1fv;
        
        public void Uniform1fv(int location, int count, float[] value)
        {
            glUniform1fv.Invoke(location, count, value);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLUNIFORM2FVPROC(int location, int count, float[] value);
        private PFNGLUNIFORM2FVPROC glUniform2fv;
        
        public void Uniform2fv(int location, int count, float[] value)
        {
            glUniform2fv.Invoke(location, count, value);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLUNIFORM3FVPROC(int location, int count, float[] value);
        private PFNGLUNIFORM3FVPROC glUniform3fv;
        
        public void Uniform3fv(int location, int count, float[] value)
        {
            glUniform3fv.Invoke(location, count, value);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLUNIFORM4FVPROC(int location, int count, float[] value);
        private PFNGLUNIFORM4FVPROC glUniform4fv;
        
        public void Uniform4fv(int location, int count, float[] value)
        {
            glUniform4fv.Invoke(location, count, value);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLUNIFORM1IVPROC(int location, int count, int[] value);
        private PFNGLUNIFORM1IVPROC glUniform1iv;
        
        public void Uniform1iv(int location, int count, int[] value)
        {
            glUniform1iv.Invoke(location, count, value);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLUNIFORM2IVPROC(int location, int count, int[] value);
        private PFNGLUNIFORM2IVPROC glUniform2iv;
        
        public void Uniform2iv(int location, int count, int[] value)
        {
            glUniform2iv.Invoke(location, count, value);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLUNIFORM3IVPROC(int location, int count, int[] value);
        private PFNGLUNIFORM3IVPROC glUniform3iv;
        
        public void Uniform3iv(int location, int count, int[] value)
        {
            glUniform3iv.Invoke(location, count, value);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLUNIFORM4IVPROC(int location, int count, int[] value);
        private PFNGLUNIFORM4IVPROC glUniform4iv;
        
        public void Uniform4iv(int location, int count, int[] value)
        {
            glUniform4iv.Invoke(location, count, value);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLUNIFORMMATRIX2FVPROC(int location, int count, bool transpose, float[] value);
        private PFNGLUNIFORMMATRIX2FVPROC glUniformMatrix2fv;
        
        public void UniformMatrix2fv(int location, int count, bool transpose, float[] value)
        {
            glUniformMatrix2fv.Invoke(location, count, transpose, value);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLUNIFORMMATRIX3FVPROC(int location, int count, bool transpose, float[] value);
        private PFNGLUNIFORMMATRIX3FVPROC glUniformMatrix3fv;
        
        public void UniformMatrix3fv(int location, int count, bool transpose, float[] value)
        {
            glUniformMatrix3fv.Invoke(location, count, transpose, value);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLUNIFORMMATRIX4FVPROC(int location, int count, bool transpose, float[] value);
        private PFNGLUNIFORMMATRIX4FVPROC glUniformMatrix4fv;
        
        public void UniformMatrix4fv(int location, int count, bool transpose, float[] value)
        {
            glUniformMatrix4fv.Invoke(location, count, transpose, value);
            DetectGLError();
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVALIDATEPROGRAMPROC(uint program);
        private PFNGLVALIDATEPROGRAMPROC glValidateProgram;
        
        public void ValidateProgram(uint program)
        {
            glValidateProgram.Invoke(program);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIB1DPROC(uint index, double x);
        private PFNGLVERTEXATTRIB1DPROC glVertexAttrib1d;
        
        public void VertexAttrib1d(uint index, double x)
        {
            glVertexAttrib1d.Invoke(index, x);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIB1DVPROC(uint index, double[] v);
        private PFNGLVERTEXATTRIB1DVPROC glVertexAttrib1dv;
        
        public void VertexAttrib1dv(uint index, double[] v)
        {
            glVertexAttrib1dv.Invoke(index, v);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIB1FPROC(uint index, float x);
        private PFNGLVERTEXATTRIB1FPROC glVertexAttrib1f;
        
        public void VertexAttrib1f(uint index, float x)
        {
            glVertexAttrib1f.Invoke(index, x);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIB1FVPROC(uint index, float[] v);
        private PFNGLVERTEXATTRIB1FVPROC glVertexAttrib1fv;
        
        public void VertexAttrib1fv(uint index, float[] v)
        {
            glVertexAttrib1fv.Invoke(index, v);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIB1SPROC(uint index, short x);
        private PFNGLVERTEXATTRIB1SPROC glVertexAttrib1s;
        
        public void VertexAttrib1s(uint index, short x)
        {
            glVertexAttrib1s.Invoke(index, x);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIB1SVPROC(uint index, short[] v);
        private PFNGLVERTEXATTRIB1SVPROC glVertexAttrib1sv;
        
        public void VertexAttrib1sv(uint index, short[] v)
        {
            glVertexAttrib1sv.Invoke(index, v);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIB2DPROC(uint index, double x, double y);
        private PFNGLVERTEXATTRIB2DPROC glVertexAttrib2d;
        
        public void VertexAttrib2d(uint index, double x, double y)
        {
            glVertexAttrib2d.Invoke(index, x, y);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIB2DVPROC(uint index, double[] v);
        private PFNGLVERTEXATTRIB2DVPROC glVertexAttrib2dv;
        
        public void VertexAttrib2dv(uint index, double[] v)
        {
            glVertexAttrib2dv.Invoke(index, v);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIB2FPROC(uint index, float x, float y);
        private PFNGLVERTEXATTRIB2FPROC glVertexAttrib2f;
        
        public void VertexAttrib2f(uint index, float x, float y)
        {
            glVertexAttrib2f.Invoke(index, x, y);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIB2FVPROC(uint index, float[] v);
        private PFNGLVERTEXATTRIB2FVPROC glVertexAttrib2fv;
        
        public void VertexAttrib2fv(uint index, float[] v)
        {
            glVertexAttrib2fv.Invoke(index, v);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIB2SPROC(uint index, short x, short y);
        private PFNGLVERTEXATTRIB2SPROC glVertexAttrib2s;
        
        public void VertexAttrib2s(uint index, short x, short y)
        {
            glVertexAttrib2s.Invoke(index, x, y);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIB2SVPROC(uint index, short[] v);
        private PFNGLVERTEXATTRIB2SVPROC glVertexAttrib2sv;
        
        public void VertexAttrib2sv(uint index, short[] v)
        {
            glVertexAttrib2sv.Invoke(index, v);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIB3DPROC(uint index, double x, double y, double z);
        private PFNGLVERTEXATTRIB3DPROC glVertexAttrib3d;
        
        public void VertexAttrib3d(uint index, double x, double y, double z)
        {
            glVertexAttrib3d.Invoke(index, x, y, z);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIB3DVPROC(uint index, double[] v);
        private PFNGLVERTEXATTRIB3DVPROC glVertexAttrib3dv;
        
        public void VertexAttrib3dv(uint index, double[] v)
        {
            glVertexAttrib3dv.Invoke(index, v);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIB3FPROC(uint index, float x, float y, float z);
        private PFNGLVERTEXATTRIB3FPROC glVertexAttrib3f;
        
        public void VertexAttrib3f(uint index, float x, float y, float z)
        {
            glVertexAttrib3f.Invoke(index, x, y, z);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIB3FVPROC(uint index, float[] v);
        private PFNGLVERTEXATTRIB3FVPROC glVertexAttrib3fv;
        
        public void VertexAttrib3fv(uint index, float[] v)
        {
            glVertexAttrib3fv.Invoke(index, v);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIB3SPROC(uint index, short x, short y, short z);
        private PFNGLVERTEXATTRIB3SPROC glVertexAttrib3s;
        
        public void VertexAttrib3s(uint index, short x, short y, short z)
        {
            glVertexAttrib3s.Invoke(index, x, y, z);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIB3SVPROC(uint index, short[] v);
        private PFNGLVERTEXATTRIB3SVPROC glVertexAttrib3sv;
        
        public void VertexAttrib3sv(uint index, short[] v)
        {
            glVertexAttrib3sv.Invoke(index, v);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIB4NBVPROC(uint index, sbyte[] v);
        private PFNGLVERTEXATTRIB4NBVPROC glVertexAttrib4Nbv;
        
        public void VertexAttrib4Nbv(uint index, sbyte[] v)
        {
            glVertexAttrib4Nbv.Invoke(index, v);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIB4NIVPROC(uint index, int[] v);
        private PFNGLVERTEXATTRIB4NIVPROC glVertexAttrib4Niv;
        
        public void VertexAttrib4Niv(uint index, int[] v)
        {
            glVertexAttrib4Niv.Invoke(index, v);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIB4NSVPROC(uint index, short[] v);
        private PFNGLVERTEXATTRIB4NSVPROC glVertexAttrib4Nsv;
        
        public void VertexAttrib4Nsv(uint index, short[] v)
        {
            glVertexAttrib4Nsv.Invoke(index, v);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIB4NUBPROC(uint index, byte x, byte y, byte z, byte w);
        private PFNGLVERTEXATTRIB4NUBPROC glVertexAttrib4Nub;
        
        public void VertexAttrib4Nub(uint index, byte x, byte y, byte z, byte w)
        {
            glVertexAttrib4Nub.Invoke(index, x, y, z, w);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIB4NUBVPROC(uint index, byte[] v);
        private PFNGLVERTEXATTRIB4NUBVPROC glVertexAttrib4Nubv;
        
        public void VertexAttrib4Nubv(uint index, byte[] v)
        {
            glVertexAttrib4Nubv.Invoke(index, v);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIB4NUIVPROC(uint index, uint[] v);
        private PFNGLVERTEXATTRIB4NUIVPROC glVertexAttrib4Nuiv;
        
        public void VertexAttrib4Nuiv(uint index, uint[] v)
        {
            glVertexAttrib4Nuiv.Invoke(index, v);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIB4NUSVPROC(uint index, ushort[] v);
        private PFNGLVERTEXATTRIB4NUSVPROC glVertexAttrib4Nusv;
        
        public void VertexAttrib4Nusv(uint index, ushort[] v)
        {
            glVertexAttrib4Nusv.Invoke(index, v);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIB4BVPROC(uint index, sbyte[] v);
        private PFNGLVERTEXATTRIB4BVPROC glVertexAttrib4bv;
        
        public void VertexAttrib4bv(uint index, sbyte[] v)
        {
            glVertexAttrib4bv.Invoke(index, v);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIB4DPROC(uint index, double x, double y, double z, double w);
        private PFNGLVERTEXATTRIB4DPROC glVertexAttrib4d;
        
        public void VertexAttrib4d(uint index, double x, double y, double z, double w)
        {
            glVertexAttrib4d.Invoke(index, x, y, z, w);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIB4DVPROC(uint index, double[] v);
        private PFNGLVERTEXATTRIB4DVPROC glVertexAttrib4dv;
        
        public void VertexAttrib4dv(uint index, double[] v)
        {
            glVertexAttrib4dv.Invoke(index, v);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIB4FPROC(uint index, float x, float y, float z, float w);
        private PFNGLVERTEXATTRIB4FPROC glVertexAttrib4f;
        
        public void VertexAttrib4f(uint index, float x, float y, float z, float w)
        {
            glVertexAttrib4f.Invoke(index, x, y, z, w);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIB4FVPROC(uint index, float[] v);
        private PFNGLVERTEXATTRIB4FVPROC glVertexAttrib4fv;
        
        public void VertexAttrib4fv(uint index, float[] v)
        {
            glVertexAttrib4fv.Invoke(index, v);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIB4IVPROC(uint index, int[] v);
        private PFNGLVERTEXATTRIB4IVPROC glVertexAttrib4iv;
        
        public void VertexAttrib4iv(uint index, int[] v)
        {
            glVertexAttrib4iv.Invoke(index, v);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIB4SPROC(uint index, short x, short y, short z, short w);
        private PFNGLVERTEXATTRIB4SPROC glVertexAttrib4s;
        
        public void VertexAttrib4s(uint index, short x, short y, short z, short w)
        {
            glVertexAttrib4s.Invoke(index, x, y, z, w);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIB4SVPROC(uint index, short[] v);
        private PFNGLVERTEXATTRIB4SVPROC glVertexAttrib4sv;
        
        public void VertexAttrib4sv(uint index, short[] v)
        {
            glVertexAttrib4sv.Invoke(index, v);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIB4UBVPROC(uint index, byte[] v);
        private PFNGLVERTEXATTRIB4UBVPROC glVertexAttrib4ubv;
        
        public void VertexAttrib4ubv(uint index, byte[] v)
        {
            glVertexAttrib4ubv.Invoke(index, v);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIB4UIVPROC(uint index, uint[] v);
        private PFNGLVERTEXATTRIB4UIVPROC glVertexAttrib4uiv;
        
        public void VertexAttrib4uiv(uint index, uint[] v)
        {
            glVertexAttrib4uiv.Invoke(index, v);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIB4USVPROC(uint index, ushort[] v);
        private PFNGLVERTEXATTRIB4USVPROC glVertexAttrib4usv;
        
        public void VertexAttrib4usv(uint index, ushort[] v)
        {
            glVertexAttrib4usv.Invoke(index, v);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIBPOINTERPROC(uint index, int size, VertexAttribPointerType type, bool normalized, uint stride, IntPtr pointer);
        private PFNGLVERTEXATTRIBPOINTERPROC glVertexAttribPointer;
        
        public void VertexAttribPointer(uint index, int size, VertexAttribPointerType type, bool normalized, uint stride, IntPtr pointer)
        {
            glVertexAttribPointer.Invoke(index, size, type, normalized, stride, pointer);
            DetectGLError();
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLUNIFORMMATRIX2X3FVPROC(int location, int count, bool transpose, float[] value);
        private PFNGLUNIFORMMATRIX2X3FVPROC glUniformMatrix2x3fv;
        
        public void UniformMatrix2x3fv(int location, int count, bool transpose, float[] value)
        {
            glUniformMatrix2x3fv.Invoke(location, count, transpose, value);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLUNIFORMMATRIX3X2FVPROC(int location, int count, bool transpose, float[] value);
        private PFNGLUNIFORMMATRIX3X2FVPROC glUniformMatrix3x2fv;
        
        public void UniformMatrix3x2fv(int location, int count, bool transpose, float[] value)
        {
            glUniformMatrix3x2fv.Invoke(location, count, transpose, value);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLUNIFORMMATRIX2X4FVPROC(int location, int count, bool transpose, float[] value);
        private PFNGLUNIFORMMATRIX2X4FVPROC glUniformMatrix2x4fv;
        
        public void UniformMatrix2x4fv(int location, int count, bool transpose, float[] value)
        {
            glUniformMatrix2x4fv.Invoke(location, count, transpose, value);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLUNIFORMMATRIX4X2FVPROC(int location, int count, bool transpose, float[] value);
        private PFNGLUNIFORMMATRIX4X2FVPROC glUniformMatrix4x2fv;
        
        public void UniformMatrix4x2fv(int location, int count, bool transpose, float[] value)
        {
            glUniformMatrix4x2fv.Invoke(location, count, transpose, value);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLUNIFORMMATRIX3X4FVPROC(int location, int count, bool transpose, float[] value);
        private PFNGLUNIFORMMATRIX3X4FVPROC glUniformMatrix3x4fv;
        
        public void UniformMatrix3x4fv(int location, int count, bool transpose, float[] value)
        {
            glUniformMatrix3x4fv.Invoke(location, count, transpose, value);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLUNIFORMMATRIX4X3FVPROC(int location, int count, bool transpose, float[] value);
        private PFNGLUNIFORMMATRIX4X3FVPROC glUniformMatrix4x3fv;
        
        public void UniformMatrix4x3fv(int location, int count, bool transpose, float[] value)
        {
            glUniformMatrix4x3fv.Invoke(location, count, transpose, value);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLCOLORMASKIPROC(uint index, bool r, bool g, bool b, bool a);
        private PFNGLCOLORMASKIPROC glColorMaski;
        
        public void ColorMaski(uint index, bool r, bool g, bool b, bool a)
        {
            glColorMaski.Invoke(index, r, g, b, a);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGETBOOLEANI_VPROC(BufferTargetARB target, uint index, out bool data);
        private PFNGLGETBOOLEANI_VPROC glGetBooleani_v;
        
        public void GetBooleani_v(BufferTargetARB target, uint index, out bool data)
        {
            glGetBooleani_v.Invoke(target, index, out data);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGETINTEGERI_VPROC(TypeEnum target, uint index, out int data);
        private PFNGLGETINTEGERI_VPROC glGetIntegeri_v;
        
        public void GetIntegeri_v(TypeEnum target, uint index, out int data)
        {
            glGetIntegeri_v.Invoke(target, index, out data);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLENABLEIPROC(EnableCap target, uint index);
        private PFNGLENABLEIPROC glEnablei;
        
        public void Enablei(EnableCap target, uint index)
        {
            glEnablei.Invoke(target, index);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLDISABLEIPROC(EnableCap target, uint index);
        private PFNGLDISABLEIPROC glDisablei;
        
        public void Disablei(EnableCap target, uint index)
        {
            glDisablei.Invoke(target, index);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate bool PFNGLISENABLEDIPROC(EnableCap target, uint index);
        private PFNGLISENABLEDIPROC glIsEnabledi;
        
        public bool IsEnabledi(EnableCap target, uint index)
        {
            return glIsEnabledi.Invoke(target, index);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLBEGINTRANSFORMFEEDBACKPROC(PrimitiveType primitiveMode);
        private PFNGLBEGINTRANSFORMFEEDBACKPROC glBeginTransformFeedback;
        
        public void BeginTransformFeedback(PrimitiveType primitiveMode)
        {
            glBeginTransformFeedback.Invoke(primitiveMode);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLENDTRANSFORMFEEDBACKPROC();
        private PFNGLENDTRANSFORMFEEDBACKPROC glEndTransformFeedback;
        
        public void EndTransformFeedback()
        {
            glEndTransformFeedback.Invoke();
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLBINDBUFFERRANGEPROC(BufferTargetARB target, uint index, uint buffer, IntPtr offset, IntPtr size);
        private PFNGLBINDBUFFERRANGEPROC glBindBufferRange;
        
        public void BindBufferRange(BufferTargetARB target, uint index, uint buffer, IntPtr offset, IntPtr size)
        {
            glBindBufferRange.Invoke(target, index, buffer, offset, size);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLBINDBUFFERBASEPROC(BufferTargetARB target, uint index, uint buffer);
        private PFNGLBINDBUFFERBASEPROC glBindBufferBase;
        
        public void BindBufferBase(BufferTargetARB target, uint index, uint buffer)
        {
            glBindBufferBase.Invoke(target, index, buffer);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLTRANSFORMFEEDBACKVARYINGSPROC(uint program, int count, sbyte varyings, int bufferMode);
        private PFNGLTRANSFORMFEEDBACKVARYINGSPROC glTransformFeedbackVaryings;
        
        public void TransformFeedbackVaryings(uint program, int count, sbyte varyings, int bufferMode)
        {
            glTransformFeedbackVaryings.Invoke(program, count, varyings, bufferMode);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGETTRANSFORMFEEDBACKVARYINGPROC(uint program, uint index, int bufSize, out int length, out int size, out int type, out sbyte name);
        private PFNGLGETTRANSFORMFEEDBACKVARYINGPROC glGetTransformFeedbackVarying;
        
        public void GetTransformFeedbackVarying(uint program, uint index, int bufSize, out int length, out int size, out int type, out sbyte name)
        {
            glGetTransformFeedbackVarying.Invoke(program, index, bufSize, out length, out size, out type, out name);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLCLAMPCOLORPROC(int target, int clamp);
        private PFNGLCLAMPCOLORPROC glClampColor;
        
        public void ClampColor(int target, int clamp)
        {
            glClampColor.Invoke(target, clamp);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLBEGINCONDITIONALRENDERPROC(uint id, TypeEnum mode);
        private PFNGLBEGINCONDITIONALRENDERPROC glBeginConditionalRender;
        
        public void BeginConditionalRender(uint id, TypeEnum mode)
        {
            glBeginConditionalRender.Invoke(id, mode);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLENDCONDITIONALRENDERPROC();
        private PFNGLENDCONDITIONALRENDERPROC glEndConditionalRender;
        
        public void EndConditionalRender()
        {
            glEndConditionalRender.Invoke();
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIBIPOINTERPROC(uint index, int size, VertexAttribPointerType type, int stride, IntPtr pointer);
        private PFNGLVERTEXATTRIBIPOINTERPROC glVertexAttribIPointer;
        
        public void VertexAttribIPointer(uint index, int size, VertexAttribPointerType type, int stride, IntPtr pointer)
        {
            glVertexAttribIPointer.Invoke(index, size, type, stride, pointer);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGETVERTEXATTRIBIIVPROC(uint index, VertexAttribEnum pname, out int parameters);
        private PFNGLGETVERTEXATTRIBIIVPROC glGetVertexAttribIiv;
        
        public void GetVertexAttribIiv(uint index, VertexAttribEnum pname, out int parameters)
        {
            glGetVertexAttribIiv.Invoke(index, pname, out parameters);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGETVERTEXATTRIBIUIVPROC(uint index, VertexAttribEnum pname, out uint parameters);
        private PFNGLGETVERTEXATTRIBIUIVPROC glGetVertexAttribIuiv;
        
        public void GetVertexAttribIuiv(uint index, VertexAttribEnum pname, out uint parameters)
        {
            glGetVertexAttribIuiv.Invoke(index, pname, out parameters);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIBI1IPROC(uint index, int x);
        private PFNGLVERTEXATTRIBI1IPROC glVertexAttribI1i;
        
        public void VertexAttribI1i(uint index, int x)
        {
            glVertexAttribI1i.Invoke(index, x);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIBI2IPROC(uint index, int x, int y);
        private PFNGLVERTEXATTRIBI2IPROC glVertexAttribI2i;
        
        public void VertexAttribI2i(uint index, int x, int y)
        {
            glVertexAttribI2i.Invoke(index, x, y);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIBI3IPROC(uint index, int x, int y, int z);
        private PFNGLVERTEXATTRIBI3IPROC glVertexAttribI3i;
        
        public void VertexAttribI3i(uint index, int x, int y, int z)
        {
            glVertexAttribI3i.Invoke(index, x, y, z);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIBI4IPROC(uint index, int x, int y, int z, int w);
        private PFNGLVERTEXATTRIBI4IPROC glVertexAttribI4i;
        
        public void VertexAttribI4i(uint index, int x, int y, int z, int w)
        {
            glVertexAttribI4i.Invoke(index, x, y, z, w);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIBI1UIPROC(uint index, uint x);
        private PFNGLVERTEXATTRIBI1UIPROC glVertexAttribI1ui;
        
        public void VertexAttribI1ui(uint index, uint x)
        {
            glVertexAttribI1ui.Invoke(index, x);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIBI2UIPROC(uint index, uint x, uint y);
        private PFNGLVERTEXATTRIBI2UIPROC glVertexAttribI2ui;
        
        public void VertexAttribI2ui(uint index, uint x, uint y)
        {
            glVertexAttribI2ui.Invoke(index, x, y);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIBI3UIPROC(uint index, uint x, uint y, uint z);
        private PFNGLVERTEXATTRIBI3UIPROC glVertexAttribI3ui;
        
        public void VertexAttribI3ui(uint index, uint x, uint y, uint z)
        {
            glVertexAttribI3ui.Invoke(index, x, y, z);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIBI4UIPROC(uint index, uint x, uint y, uint z, uint w);
        private PFNGLVERTEXATTRIBI4UIPROC glVertexAttribI4ui;
        
        public void VertexAttribI4ui(uint index, uint x, uint y, uint z, uint w)
        {
            glVertexAttribI4ui.Invoke(index, x, y, z, w);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIBI1IVPROC(uint index, int[] v);
        private PFNGLVERTEXATTRIBI1IVPROC glVertexAttribI1iv;
        
        public void VertexAttribI1iv(uint index, int[] v)
        {
            glVertexAttribI1iv.Invoke(index, v);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIBI2IVPROC(uint index, int[] v);
        private PFNGLVERTEXATTRIBI2IVPROC glVertexAttribI2iv;
        
        public void VertexAttribI2iv(uint index, int[] v)
        {
            glVertexAttribI2iv.Invoke(index, v);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIBI3IVPROC(uint index, int[] v);
        private PFNGLVERTEXATTRIBI3IVPROC glVertexAttribI3iv;
        
        public void VertexAttribI3iv(uint index, int[] v)
        {
            glVertexAttribI3iv.Invoke(index, v);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIBI4IVPROC(uint index, int[] v);
        private PFNGLVERTEXATTRIBI4IVPROC glVertexAttribI4iv;
        
        public void VertexAttribI4iv(uint index, int[] v)
        {
            glVertexAttribI4iv.Invoke(index, v);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIBI1UIVPROC(uint index, uint[] v);
        private PFNGLVERTEXATTRIBI1UIVPROC glVertexAttribI1uiv;
        
        public void VertexAttribI1uiv(uint index, uint[] v)
        {
            glVertexAttribI1uiv.Invoke(index, v);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIBI2UIVPROC(uint index, uint[] v);
        private PFNGLVERTEXATTRIBI2UIVPROC glVertexAttribI2uiv;
        
        public void VertexAttribI2uiv(uint index, uint[] v)
        {
            glVertexAttribI2uiv.Invoke(index, v);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIBI3UIVPROC(uint index, uint[] v);
        private PFNGLVERTEXATTRIBI3UIVPROC glVertexAttribI3uiv;
        
        public void VertexAttribI3uiv(uint index, uint[] v)
        {
            glVertexAttribI3uiv.Invoke(index, v);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIBI4UIVPROC(uint index, uint[] v);
        private PFNGLVERTEXATTRIBI4UIVPROC glVertexAttribI4uiv;
        
        public void VertexAttribI4uiv(uint index, uint[] v)
        {
            glVertexAttribI4uiv.Invoke(index, v);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIBI4BVPROC(uint index, sbyte[] v);
        private PFNGLVERTEXATTRIBI4BVPROC glVertexAttribI4bv;
        
        public void VertexAttribI4bv(uint index, sbyte[] v)
        {
            glVertexAttribI4bv.Invoke(index, v);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIBI4SVPROC(uint index, short[] v);
        private PFNGLVERTEXATTRIBI4SVPROC glVertexAttribI4sv;
        
        public void VertexAttribI4sv(uint index, short[] v)
        {
            glVertexAttribI4sv.Invoke(index, v);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIBI4UBVPROC(uint index, byte[] v);
        private PFNGLVERTEXATTRIBI4UBVPROC glVertexAttribI4ubv;
        
        public void VertexAttribI4ubv(uint index, byte[] v)
        {
            glVertexAttribI4ubv.Invoke(index, v);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLVERTEXATTRIBI4USVPROC(uint index, ushort[] v);
        private PFNGLVERTEXATTRIBI4USVPROC glVertexAttribI4usv;
        
        public void VertexAttribI4usv(uint index, ushort[] v)
        {
            glVertexAttribI4usv.Invoke(index, v);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGETUNIFORMUIVPROC(uint program, int location, out uint parameters);
        private PFNGLGETUNIFORMUIVPROC glGetUniformuiv;
        
        public void GetUniformuiv(uint program, int location, out uint parameters)
        {
            glGetUniformuiv.Invoke(program, location, out parameters);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLBINDFRAGDATALOCATIONPROC(uint program, uint color, sbyte[] name);
        private PFNGLBINDFRAGDATALOCATIONPROC glBindFragDataLocation;
        
        public void BindFragDataLocation(uint program, uint color, sbyte[] name)
        {
            glBindFragDataLocation.Invoke(program, color, name);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate int PFNGLGETFRAGDATALOCATIONPROC(uint program, sbyte[] name);
        private PFNGLGETFRAGDATALOCATIONPROC glGetFragDataLocation;
        
        public int GetFragDataLocation(uint program, sbyte[] name)
        {
            return glGetFragDataLocation.Invoke(program, name);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLUNIFORM1UIPROC(int location, uint v0);
        private PFNGLUNIFORM1UIPROC glUniform1ui;
        
        public void Uniform1ui(int location, uint v0)
        {
            glUniform1ui.Invoke(location, v0);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLUNIFORM2UIPROC(int location, uint v0, uint v1);
        private PFNGLUNIFORM2UIPROC glUniform2ui;
        
        public void Uniform2ui(int location, uint v0, uint v1)
        {
            glUniform2ui.Invoke(location, v0, v1);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLUNIFORM3UIPROC(int location, uint v0, uint v1, uint v2);
        private PFNGLUNIFORM3UIPROC glUniform3ui;
        
        public void Uniform3ui(int location, uint v0, uint v1, uint v2)
        {
            glUniform3ui.Invoke(location, v0, v1, v2);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLUNIFORM4UIPROC(int location, uint v0, uint v1, uint v2, uint v3);
        private PFNGLUNIFORM4UIPROC glUniform4ui;
        
        public void Uniform4ui(int location, uint v0, uint v1, uint v2, uint v3)
        {
            glUniform4ui.Invoke(location, v0, v1, v2, v3);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLUNIFORM1UIVPROC(int location, int count, uint[] value);
        private PFNGLUNIFORM1UIVPROC glUniform1uiv;
        
        public void Uniform1uiv(int location, int count, uint[] value)
        {
            glUniform1uiv.Invoke(location, count, value);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLUNIFORM2UIVPROC(int location, int count, uint[] value);
        private PFNGLUNIFORM2UIVPROC glUniform2uiv;
        
        public void Uniform2uiv(int location, int count, uint[] value)
        {
            glUniform2uiv.Invoke(location, count, value);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLUNIFORM3UIVPROC(int location, int count, uint[] value);
        private PFNGLUNIFORM3UIVPROC glUniform3uiv;
        
        public void Uniform3uiv(int location, int count, uint[] value)
        {
            glUniform3uiv.Invoke(location, count, value);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLUNIFORM4UIVPROC(int location, int count, uint[] value);
        private PFNGLUNIFORM4UIVPROC glUniform4uiv;
        
        public void Uniform4uiv(int location, int count, uint[] value)
        {
            glUniform4uiv.Invoke(location, count, value);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLTEXPARAMETERIIVPROC(TextureTarget target, TextureParameterName pname, int[] parameters);
        private PFNGLTEXPARAMETERIIVPROC glTexParameterIiv;
        
        public void TexParameterIiv(TextureTarget target, TextureParameterName pname, int[] parameters)
        {
            glTexParameterIiv.Invoke(target, pname, parameters);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLTEXPARAMETERIUIVPROC(TextureTarget target, TextureParameterName pname, uint[] parameters);
        private PFNGLTEXPARAMETERIUIVPROC glTexParameterIuiv;
        
        public void TexParameterIuiv(TextureTarget target, TextureParameterName pname, uint[] parameters)
        {
            glTexParameterIuiv.Invoke(target, pname, parameters);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGETTEXPARAMETERIIVPROC(TextureTarget target, GetTextureParameter pname, out int parameters);
        private PFNGLGETTEXPARAMETERIIVPROC glGetTexParameterIiv;
        
        public void GetTexParameterIiv(TextureTarget target, GetTextureParameter pname, out int parameters)
        {
            glGetTexParameterIiv.Invoke(target, pname, out parameters);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGETTEXPARAMETERIUIVPROC(TextureTarget target, GetTextureParameter pname, out uint parameters);
        private PFNGLGETTEXPARAMETERIUIVPROC glGetTexParameterIuiv;
        
        public void GetTexParameterIuiv(TextureTarget target, GetTextureParameter pname, out uint parameters)
        {
            glGetTexParameterIuiv.Invoke(target, pname, out parameters);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLCLEARBUFFERIVPROC(Buffer buffer, int drawbuffer, int[] value);
        private PFNGLCLEARBUFFERIVPROC glClearBufferiv;
        
        public void ClearBufferiv(Buffer buffer, int drawbuffer, int[] value)
        {
            glClearBufferiv.Invoke(buffer, drawbuffer, value);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLCLEARBUFFERUIVPROC(Buffer buffer, int drawbuffer, uint[] value);
        private PFNGLCLEARBUFFERUIVPROC glClearBufferuiv;
        
        public void ClearBufferuiv(Buffer buffer, int drawbuffer, uint[] value)
        {
            glClearBufferuiv.Invoke(buffer, drawbuffer, value);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLCLEARBUFFERFVPROC(Buffer buffer, int drawbuffer, float[] value);
        private PFNGLCLEARBUFFERFVPROC glClearBufferfv;
        
        public void ClearBufferfv(Buffer buffer, int drawbuffer, float[] value)
        {
            glClearBufferfv.Invoke(buffer, drawbuffer, value);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLCLEARBUFFERFIPROC(Buffer buffer, int drawbuffer, float depth, int stencil);
        private PFNGLCLEARBUFFERFIPROC glClearBufferfi;
        
        public void ClearBufferfi(Buffer buffer, int drawbuffer, float depth, int stencil)
        {
            glClearBufferfi.Invoke(buffer, drawbuffer, depth, stencil);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate IntPtr PFNGLGETSTRINGIPROC(StringName name, uint index);
        private PFNGLGETSTRINGIPROC glGetStringi;
        
        public IntPtr GetStringi(StringName name, uint index)
        {
            return glGetStringi.Invoke(name, index);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate bool PFNGLISRENDERBUFFERPROC(uint renderbuffer);
        private PFNGLISRENDERBUFFERPROC glIsRenderbuffer;
        
        public bool IsRenderbuffer(uint renderbuffer)
        {
            return glIsRenderbuffer.Invoke(renderbuffer);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLBINDRENDERBUFFERPROC(RenderbufferTarget target, uint renderbuffer);
        private PFNGLBINDRENDERBUFFERPROC glBindRenderbuffer;
        
        public void BindRenderbuffer(RenderbufferTarget target, uint renderbuffer)
        {
            glBindRenderbuffer.Invoke(target, renderbuffer);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLDELETERENDERBUFFERSPROC(int n, uint[] renderbuffers);
        private PFNGLDELETERENDERBUFFERSPROC glDeleteRenderbuffers;
        
        public void DeleteRenderbuffers(int n, uint[] renderbuffers)
        {
            glDeleteRenderbuffers.Invoke(n, renderbuffers);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGENRENDERBUFFERSPROC(int n, out uint renderbuffers);
        private PFNGLGENRENDERBUFFERSPROC glGenRenderbuffers;
        
        public void GenRenderbuffers(int n, out uint renderbuffers)
        {
            glGenRenderbuffers.Invoke(n, out renderbuffers);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLRENDERBUFFERSTORAGEPROC(RenderbufferTarget target, InternalFormat internalformat, int width, int height);
        private PFNGLRENDERBUFFERSTORAGEPROC glRenderbufferStorage;
        
        public void RenderbufferStorage(RenderbufferTarget target, InternalFormat internalformat, int width, int height)
        {
            glRenderbufferStorage.Invoke(target, internalformat, width, height);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGETRENDERBUFFERPARAMETERIVPROC(RenderbufferTarget target, RenderbufferParameterName pname, out int parameters);
        private PFNGLGETRENDERBUFFERPARAMETERIVPROC glGetRenderbufferParameteriv;
        
        public void GetRenderbufferParameteriv(RenderbufferTarget target, RenderbufferParameterName pname, out int parameters)
        {
            glGetRenderbufferParameteriv.Invoke(target, pname, out parameters);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate bool PFNGLISFRAMEBUFFERPROC(uint framebuffer);
        private PFNGLISFRAMEBUFFERPROC glIsFramebuffer;
        
        public bool IsFramebuffer(uint framebuffer)
        {
            return glIsFramebuffer.Invoke(framebuffer);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLBINDFRAMEBUFFERPROC(FramebufferTarget target, uint framebuffer);
        private PFNGLBINDFRAMEBUFFERPROC glBindFramebuffer;
        
        public void BindFramebuffer(FramebufferTarget target, uint framebuffer)
        {
            glBindFramebuffer.Invoke(target, framebuffer);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLDELETEFRAMEBUFFERSPROC(int n, uint[] framebuffers);
        private PFNGLDELETEFRAMEBUFFERSPROC glDeleteFramebuffers;
        
        public void DeleteFramebuffers(int n, uint[] framebuffers)
        {
            glDeleteFramebuffers.Invoke(n, framebuffers);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGENFRAMEBUFFERSPROC(int n, out uint framebuffers);
        private PFNGLGENFRAMEBUFFERSPROC glGenFramebuffers;
        
        public void GenFramebuffers(int n, out uint framebuffers)
        {
            glGenFramebuffers.Invoke(n, out framebuffers);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate FramebufferStatus PFNGLCHECKFRAMEBUFFERSTATUSPROC(FramebufferTarget target);
        private PFNGLCHECKFRAMEBUFFERSTATUSPROC glCheckFramebufferStatus;
        
        public FramebufferStatus CheckFramebufferStatus(FramebufferTarget target)
        {
            return glCheckFramebufferStatus.Invoke(target);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLFRAMEBUFFERTEXTURE1DPROC(FramebufferTarget target, FramebufferAttachment attachment, TextureTarget textarget, uint texture, int level);
        private PFNGLFRAMEBUFFERTEXTURE1DPROC glFramebufferTexture1D;
        
        public void FramebufferTexture1D(FramebufferTarget target, FramebufferAttachment attachment, TextureTarget textarget, uint texture, int level)
        {
            glFramebufferTexture1D.Invoke(target, attachment, textarget, texture, level);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLFRAMEBUFFERTEXTURE2DPROC(FramebufferTarget target, FramebufferAttachment attachment, TextureTarget textarget, uint texture, int level);
        private PFNGLFRAMEBUFFERTEXTURE2DPROC glFramebufferTexture2D;
        
        public void FramebufferTexture2D(FramebufferTarget target, FramebufferAttachment attachment, TextureTarget textarget, uint texture, int level)
        {
            glFramebufferTexture2D.Invoke(target, attachment, textarget, texture, level);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLFRAMEBUFFERTEXTURE3DPROC(FramebufferTarget target, FramebufferAttachment attachment, TextureTarget textarget, uint texture, int level, int zoffset);
        private PFNGLFRAMEBUFFERTEXTURE3DPROC glFramebufferTexture3D;
        
        public void FramebufferTexture3D(FramebufferTarget target, FramebufferAttachment attachment, TextureTarget textarget, uint texture, int level, int zoffset)
        {
            glFramebufferTexture3D.Invoke(target, attachment, textarget, texture, level, zoffset);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLFRAMEBUFFERRENDERBUFFERPROC(FramebufferTarget target, FramebufferAttachment attachment, RenderbufferTarget renderbuffertarget, uint renderbuffer);
        private PFNGLFRAMEBUFFERRENDERBUFFERPROC glFramebufferRenderbuffer;
        
        public void FramebufferRenderbuffer(FramebufferTarget target, FramebufferAttachment attachment, RenderbufferTarget renderbuffertarget, uint renderbuffer)
        {
            glFramebufferRenderbuffer.Invoke(target, attachment, renderbuffertarget, renderbuffer);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC(FramebufferTarget target, FramebufferAttachment attachment, FramebufferAttachmentParameterName pname, out int parameters);
        private PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC glGetFramebufferAttachmentParameteriv;
        
        public void GetFramebufferAttachmentParameteriv(FramebufferTarget target, FramebufferAttachment attachment, FramebufferAttachmentParameterName pname, out int parameters)
        {
            glGetFramebufferAttachmentParameteriv.Invoke(target, attachment, pname, out parameters);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGENERATEMIPMAPPROC(TextureTarget target);
        private PFNGLGENERATEMIPMAPPROC glGenerateMipmap;
        
        public void GenerateMipmap(TextureTarget target)
        {
            glGenerateMipmap.Invoke(target);
            DetectGLError();
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLBLITFRAMEBUFFERPROC(int srcX0, int srcY0, int srcX1, int srcY1, int dstX0, int dstY0, int dstX1, int dstY1, ClearBufferMask mask, BlitFramebufferFilter filter);
        private PFNGLBLITFRAMEBUFFERPROC glBlitFramebuffer;
        
        public void BlitFramebuffer(int srcX0, int srcY0, int srcX1, int srcY1, int dstX0, int dstY0, int dstX1, int dstY1, ClearBufferMask mask, BlitFramebufferFilter filter)
        {
            glBlitFramebuffer.Invoke(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC(RenderbufferTarget target, int samples, InternalFormat internalformat, int width, int height);
        private PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC glRenderbufferStorageMultisample;
        
        public void RenderbufferStorageMultisample(RenderbufferTarget target, int samples, InternalFormat internalformat, int width, int height)
        {
            glRenderbufferStorageMultisample.Invoke(target, samples, internalformat, width, height);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLFRAMEBUFFERTEXTURELAYERPROC(FramebufferTarget target, FramebufferAttachment attachment, uint texture, int level, int layer);
        private PFNGLFRAMEBUFFERTEXTURELAYERPROC glFramebufferTextureLayer;
        
        public void FramebufferTextureLayer(FramebufferTarget target, FramebufferAttachment attachment, uint texture, int level, int layer)
        {
            glFramebufferTextureLayer.Invoke(target, attachment, texture, level, layer);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate IntPtr PFNGLMAPBUFFERRANGEPROC(BufferTargetARB target, IntPtr offset, IntPtr length, MapBufferAccessMask access);
        private PFNGLMAPBUFFERRANGEPROC glMapBufferRange;
        
        public IntPtr MapBufferRange(BufferTargetARB target, IntPtr offset, IntPtr length, MapBufferAccessMask access)
        {
            return glMapBufferRange.Invoke(target, offset, length, access);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLFLUSHMAPPEDBUFFERRANGEPROC(BufferTargetARB target, IntPtr offset, IntPtr length);
        private PFNGLFLUSHMAPPEDBUFFERRANGEPROC glFlushMappedBufferRange;
        
        public void FlushMappedBufferRange(BufferTargetARB target, IntPtr offset, IntPtr length)
        {
            glFlushMappedBufferRange.Invoke(target, offset, length);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLBINDVERTEXARRAYPROC(uint array);
        private PFNGLBINDVERTEXARRAYPROC glBindVertexArray;
        
        public void BindVertexArray(uint array)
        {
            glBindVertexArray.Invoke(array);
            DetectGLError();
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLDELETEVERTEXARRAYSPROC(int n, uint[] arrays);
        private PFNGLDELETEVERTEXARRAYSPROC glDeleteVertexArrays;
        
        public void DeleteVertexArrays(int n, uint[] arrays)
        {
            glDeleteVertexArrays.Invoke(n, arrays);
            DetectGLError();
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGENVERTEXARRAYSPROC(int n, uint[] arrays);
        private PFNGLGENVERTEXARRAYSPROC glGenVertexArrays;
        
        public void GenVertexArrays(int n, uint[] arrays)
        {
            glGenVertexArrays.Invoke(n, arrays);
            DetectGLError();
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate bool PFNGLISVERTEXARRAYPROC(uint array);
        private PFNGLISVERTEXARRAYPROC glIsVertexArray;
        
        public bool IsVertexArray(uint array)
        {
            return glIsVertexArray.Invoke(array);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLDRAWARRAYSINSTANCEDPROC(PrimitiveType mode, int first, int count, int instancecount);
        private PFNGLDRAWARRAYSINSTANCEDPROC glDrawArraysInstanced;
        
        public void DrawArraysInstanced(PrimitiveType mode, int first, int count, int instancecount)
        {
            glDrawArraysInstanced.Invoke(mode, first, count, instancecount);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLDRAWELEMENTSINSTANCEDPROC(PrimitiveType mode, int count, DrawElementsType type, IntPtr indices, int instancecount);
        private PFNGLDRAWELEMENTSINSTANCEDPROC glDrawElementsInstanced;
        
        public void DrawElementsInstanced(PrimitiveType mode, int count, DrawElementsType type, IntPtr indices, int instancecount)
        {
            glDrawElementsInstanced.Invoke(mode, count, type, indices, instancecount);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLTEXBUFFERPROC(TextureTarget target, InternalFormat internalformat, uint buffer);
        private PFNGLTEXBUFFERPROC glTexBuffer;
        
        public void TexBuffer(TextureTarget target, InternalFormat internalformat, uint buffer)
        {
            glTexBuffer.Invoke(target, internalformat, buffer);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLPRIMITIVERESTARTINDEXPROC(uint index);
        private PFNGLPRIMITIVERESTARTINDEXPROC glPrimitiveRestartIndex;
        
        public void PrimitiveRestartIndex(uint index)
        {
            glPrimitiveRestartIndex.Invoke(index);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLCOPYBUFFERSUBDATAPROC(CopyBufferSubDataTarget readTarget, CopyBufferSubDataTarget writeTarget, IntPtr readOffset, IntPtr writeOffset, IntPtr size);
        private PFNGLCOPYBUFFERSUBDATAPROC glCopyBufferSubData;
        
        public void CopyBufferSubData(CopyBufferSubDataTarget readTarget, CopyBufferSubDataTarget writeTarget, IntPtr readOffset, IntPtr writeOffset, IntPtr size)
        {
            glCopyBufferSubData.Invoke(readTarget, writeTarget, readOffset, writeOffset, size);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGETUNIFORMINDICESPROC(uint program, int uniformCount, sbyte uniformNames, out uint uniformIndices);
        private PFNGLGETUNIFORMINDICESPROC glGetUniformIndices;
        
        public void GetUniformIndices(uint program, int uniformCount, sbyte uniformNames, out uint uniformIndices)
        {
            glGetUniformIndices.Invoke(program, uniformCount, uniformNames, out uniformIndices);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGETACTIVEUNIFORMSIVPROC(uint program, int uniformCount, uint[] uniformIndices, UniformPName pname, out int parameters);
        private PFNGLGETACTIVEUNIFORMSIVPROC glGetActiveUniformsiv;
        
        public void GetActiveUniformsiv(uint program, int uniformCount, uint[] uniformIndices, UniformPName pname, out int parameters)
        {
            glGetActiveUniformsiv.Invoke(program, uniformCount, uniformIndices, pname, out parameters);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGETACTIVEUNIFORMNAMEPROC(uint program, uint uniformIndex, int bufSize, out int length, out sbyte uniformName);
        private PFNGLGETACTIVEUNIFORMNAMEPROC glGetActiveUniformName;
        
        public void GetActiveUniformName(uint program, uint uniformIndex, int bufSize, out int length, out sbyte uniformName)
        {
            glGetActiveUniformName.Invoke(program, uniformIndex, bufSize, out length, out uniformName);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate uint PFNGLGETUNIFORMBLOCKINDEXPROC(uint program, sbyte[] uniformBlockName);
        private PFNGLGETUNIFORMBLOCKINDEXPROC glGetUniformBlockIndex;
        
        public uint GetUniformBlockIndex(uint program, sbyte[] uniformBlockName)
        {
            return glGetUniformBlockIndex.Invoke(program, uniformBlockName);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGETACTIVEUNIFORMBLOCKIVPROC(uint program, uint uniformBlockIndex, UniformBlockPName pname, out int parameters);
        private PFNGLGETACTIVEUNIFORMBLOCKIVPROC glGetActiveUniformBlockiv;
        
        public void GetActiveUniformBlockiv(uint program, uint uniformBlockIndex, UniformBlockPName pname, out int parameters)
        {
            glGetActiveUniformBlockiv.Invoke(program, uniformBlockIndex, pname, out parameters);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC(uint program, uint uniformBlockIndex, int bufSize, out int length, out sbyte uniformBlockName);
        private PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC glGetActiveUniformBlockName;
        
        public void GetActiveUniformBlockName(uint program, uint uniformBlockIndex, int bufSize, out int length, out sbyte uniformBlockName)
        {
            glGetActiveUniformBlockName.Invoke(program, uniformBlockIndex, bufSize, out length, out uniformBlockName);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLUNIFORMBLOCKBINDINGPROC(uint program, uint uniformBlockIndex, uint uniformBlockBinding);
        private PFNGLUNIFORMBLOCKBINDINGPROC glUniformBlockBinding;
        
        public void UniformBlockBinding(uint program, uint uniformBlockIndex, uint uniformBlockBinding)
        {
            glUniformBlockBinding.Invoke(program, uniformBlockIndex, uniformBlockBinding);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLDRAWELEMENTSBASEVERTEXPROC(PrimitiveType mode, int count, DrawElementsType type, IntPtr indices, int basevertex);
        private PFNGLDRAWELEMENTSBASEVERTEXPROC glDrawElementsBaseVertex;
        
        public void DrawElementsBaseVertex(PrimitiveType mode, int count, DrawElementsType type, IntPtr indices, int basevertex)
        {
            glDrawElementsBaseVertex.Invoke(mode, count, type, indices, basevertex);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC(PrimitiveType mode, uint start, uint end, int count, DrawElementsType type, IntPtr indices, int basevertex);
        private PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC glDrawRangeElementsBaseVertex;
        
        public void DrawRangeElementsBaseVertex(PrimitiveType mode, uint start, uint end, int count, DrawElementsType type, IntPtr indices, int basevertex)
        {
            glDrawRangeElementsBaseVertex.Invoke(mode, start, end, count, type, indices, basevertex);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC(PrimitiveType mode, int count, DrawElementsType type, IntPtr indices, int instancecount, int basevertex);
        private PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC glDrawElementsInstancedBaseVertex;
        
        public void DrawElementsInstancedBaseVertex(PrimitiveType mode, int count, DrawElementsType type, IntPtr indices, int instancecount, int basevertex)
        {
            glDrawElementsInstancedBaseVertex.Invoke(mode, count, type, indices, instancecount, basevertex);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC(PrimitiveType mode, int[] count, DrawElementsType type, int[] indices, int drawcount, int[] basevertex);
        private PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC glMultiDrawElementsBaseVertex;
        
        public void MultiDrawElementsBaseVertex(PrimitiveType mode, int[] count, DrawElementsType type, int[] indices, int drawcount, int[] basevertex)
        {
            glMultiDrawElementsBaseVertex.Invoke(mode, count, type, indices, drawcount, basevertex);
            DetectGLError();
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLPROVOKINGVERTEXPROC(VertexProvokingMode mode);
        private PFNGLPROVOKINGVERTEXPROC glProvokingVertex;
        
        public void ProvokingVertex(VertexProvokingMode mode)
        {
            glProvokingVertex.Invoke(mode);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate IntPtr PFNGLFENCESYNCPROC(SyncCondition condition, uint flags);
        private PFNGLFENCESYNCPROC glFenceSync;
        
        public IntPtr FenceSync(SyncCondition condition, uint flags)
        {
            return glFenceSync.Invoke(condition, flags);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate bool PFNGLISSYNCPROC(IntPtr sync);
        private PFNGLISSYNCPROC glIsSync;
        
        public bool IsSync(IntPtr sync)
        {
            return glIsSync.Invoke(sync);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLDELETESYNCPROC(IntPtr sync);
        private PFNGLDELETESYNCPROC glDeleteSync;
        
        public void DeleteSync(IntPtr sync)
        {
            glDeleteSync.Invoke(sync);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate SyncStatus PFNGLCLIENTWAITSYNCPROC(IntPtr sync, SyncObjectMask flags, ulong timeout);
        private PFNGLCLIENTWAITSYNCPROC glClientWaitSync;
        
        public SyncStatus ClientWaitSync(IntPtr sync, SyncObjectMask flags, ulong timeout)
        {
            return glClientWaitSync.Invoke(sync, flags, timeout);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLWAITSYNCPROC(IntPtr sync, uint flags, ulong timeout);
        private PFNGLWAITSYNCPROC glWaitSync;
        
        public void WaitSync(IntPtr sync, uint flags, ulong timeout)
        {
            glWaitSync.Invoke(sync, flags, timeout);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGETINTEGER64VPROC(GetPName pname, out long data);
        private PFNGLGETINTEGER64VPROC glGetInteger64v;
        
        public void GetInteger64v(GetPName pname, out long data)
        {
            glGetInteger64v.Invoke(pname, out data);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGETSYNCIVPROC(IntPtr sync, SyncParameterName pname, int bufSize, out int length, out int values);
        private PFNGLGETSYNCIVPROC glGetSynciv;
        
        public void GetSynciv(IntPtr sync, SyncParameterName pname, int bufSize, out int length, out int values)
        {
            glGetSynciv.Invoke(sync, pname, bufSize, out length, out values);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGETINTEGER64I_VPROC(TypeEnum target, uint index, out long data);
        private PFNGLGETINTEGER64I_VPROC glGetInteger64i_v;
        
        public void GetInteger64i_v(TypeEnum target, uint index, out long data)
        {
            glGetInteger64i_v.Invoke(target, index, out data);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGETBUFFERPARAMETERI64VPROC(BufferTargetARB target, int pname, out long parameters);
        private PFNGLGETBUFFERPARAMETERI64VPROC glGetBufferParameteri64v;
        
        public void GetBufferParameteri64v(BufferTargetARB target, int pname, out long parameters)
        {
            glGetBufferParameteri64v.Invoke(target, pname, out parameters);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLFRAMEBUFFERTEXTUREPROC(FramebufferTarget target, FramebufferAttachment attachment, uint texture, int level);
        private PFNGLFRAMEBUFFERTEXTUREPROC glFramebufferTexture;
        
        public void FramebufferTexture(FramebufferTarget target, FramebufferAttachment attachment, uint texture, int level)
        {
            glFramebufferTexture.Invoke(target, attachment, texture, level);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLTEXIMAGE2DMULTISAMPLEPROC(TextureTarget target, int samples, InternalFormat internalformat, int width, int height, bool fixedsamplelocations);
        private PFNGLTEXIMAGE2DMULTISAMPLEPROC glTexImage2DMultisample;
        
        public void TexImage2DMultisample(TextureTarget target, int samples, InternalFormat internalformat, int width, int height, bool fixedsamplelocations)
        {
            glTexImage2DMultisample.Invoke(target, samples, internalformat, width, height, fixedsamplelocations);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLTEXIMAGE3DMULTISAMPLEPROC(TextureTarget target, int samples, InternalFormat internalformat, int width, int height, int depth, bool fixedsamplelocations);
        private PFNGLTEXIMAGE3DMULTISAMPLEPROC glTexImage3DMultisample;
        
        public void TexImage3DMultisample(TextureTarget target, int samples, InternalFormat internalformat, int width, int height, int depth, bool fixedsamplelocations)
        {
            glTexImage3DMultisample.Invoke(target, samples, internalformat, width, height, depth, fixedsamplelocations);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLGETMULTISAMPLEFVPROC(int pname, uint index, out float val);
        private PFNGLGETMULTISAMPLEFVPROC glGetMultisamplefv;
        
        public void GetMultisamplefv(int pname, uint index, out float val)
        {
            glGetMultisamplefv.Invoke(pname, index, out val);
        }
        
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        private delegate void PFNGLSAMPLEMASKIPROC(uint maskNumber, uint mask);
        private PFNGLSAMPLEMASKIPROC glSampleMaski;

        public void SampleMaski(uint maskNumber, uint mask)
        {
            glSampleMaski.Invoke(maskNumber, mask);
        }
        #endregion
        
        public GLContext(IntPtr windowHandle)
        {
            GetProcAddressHandler loader = SDL.SDL_GL_GetProcAddress;
            Handle = SDL.SDL_GL_CreateContext(windowHandle);
            if (Handle == null) {
                throw new FrameworkSDLException();
            }
            
            #region OpenGLDelegateAssignment
            glCullFace = Marshal.GetDelegateForFunctionPointer<PFNGLCULLFACEPROC>(loader.Invoke("glCullFace"));
            glFrontFace = Marshal.GetDelegateForFunctionPointer<PFNGLFRONTFACEPROC>(loader.Invoke("glFrontFace"));
            glHint = Marshal.GetDelegateForFunctionPointer<PFNGLHINTPROC>(loader.Invoke("glHint"));
            glLineWidth = Marshal.GetDelegateForFunctionPointer<PFNGLLINEWIDTHPROC>(loader.Invoke("glLineWidth"));
            glPointSize = Marshal.GetDelegateForFunctionPointer<PFNGLPOINTSIZEPROC>(loader.Invoke("glPointSize"));
            glPolygonMode = Marshal.GetDelegateForFunctionPointer<PFNGLPOLYGONMODEPROC>(loader.Invoke("glPolygonMode"));
            glScissor = Marshal.GetDelegateForFunctionPointer<PFNGLSCISSORPROC>(loader.Invoke("glScissor"));
            glTexParameterf = Marshal.GetDelegateForFunctionPointer<PFNGLTEXPARAMETERFPROC>(loader.Invoke("glTexParameterf"));
            glTexParameterfv = Marshal.GetDelegateForFunctionPointer<PFNGLTEXPARAMETERFVPROC>(loader.Invoke("glTexParameterfv"));
            glTexParameteri = Marshal.GetDelegateForFunctionPointer<PFNGLTEXPARAMETERIPROC>(loader.Invoke("glTexParameteri"));
            glTexParameteriv = Marshal.GetDelegateForFunctionPointer<PFNGLTEXPARAMETERIVPROC>(loader.Invoke("glTexParameteriv"));
            glTexImage1D = Marshal.GetDelegateForFunctionPointer<PFNGLTEXIMAGE1DPROC>(loader.Invoke("glTexImage1D"));
            glTexImage2D = Marshal.GetDelegateForFunctionPointer<PFNGLTEXIMAGE2DPROC>(loader.Invoke("glTexImage2D"));
            glDrawBuffer = Marshal.GetDelegateForFunctionPointer<PFNGLDRAWBUFFERPROC>(loader.Invoke("glDrawBuffer"));
            glClear = Marshal.GetDelegateForFunctionPointer<PFNGLCLEARPROC>(loader.Invoke("glClear"));
            glClearColor = Marshal.GetDelegateForFunctionPointer<PFNGLCLEARCOLORPROC>(loader.Invoke("glClearColor"));
            glClearStencil = Marshal.GetDelegateForFunctionPointer<PFNGLCLEARSTENCILPROC>(loader.Invoke("glClearStencil"));
            glClearDepth = Marshal.GetDelegateForFunctionPointer<PFNGLCLEARDEPTHPROC>(loader.Invoke("glClearDepth"));
            glStencilMask = Marshal.GetDelegateForFunctionPointer<PFNGLSTENCILMASKPROC>(loader.Invoke("glStencilMask"));
            glColorMask = Marshal.GetDelegateForFunctionPointer<PFNGLCOLORMASKPROC>(loader.Invoke("glColorMask"));
            glDepthMask = Marshal.GetDelegateForFunctionPointer<PFNGLDEPTHMASKPROC>(loader.Invoke("glDepthMask"));
            glDisable = Marshal.GetDelegateForFunctionPointer<PFNGLDISABLEPROC>(loader.Invoke("glDisable"));
            glEnable = Marshal.GetDelegateForFunctionPointer<PFNGLENABLEPROC>(loader.Invoke("glEnable"));
            glFinish = Marshal.GetDelegateForFunctionPointer<PFNGLFINISHPROC>(loader.Invoke("glFinish"));
            glFlush = Marshal.GetDelegateForFunctionPointer<PFNGLFLUSHPROC>(loader.Invoke("glFlush"));
            glBlendFunc = Marshal.GetDelegateForFunctionPointer<PFNGLBLENDFUNCPROC>(loader.Invoke("glBlendFunc"));
            glLogicOp = Marshal.GetDelegateForFunctionPointer<PFNGLLOGICOPPROC>(loader.Invoke("glLogicOp"));
            glStencilFunc = Marshal.GetDelegateForFunctionPointer<PFNGLSTENCILFUNCPROC>(loader.Invoke("glStencilFunc"));
            glStencilOp = Marshal.GetDelegateForFunctionPointer<PFNGLSTENCILOPPROC>(loader.Invoke("glStencilOp"));
            glDepthFunc = Marshal.GetDelegateForFunctionPointer<PFNGLDEPTHFUNCPROC>(loader.Invoke("glDepthFunc"));
            glPixelStoref = Marshal.GetDelegateForFunctionPointer<PFNGLPIXELSTOREFPROC>(loader.Invoke("glPixelStoref"));
            glPixelStorei = Marshal.GetDelegateForFunctionPointer<PFNGLPIXELSTOREIPROC>(loader.Invoke("glPixelStorei"));
            glReadBuffer = Marshal.GetDelegateForFunctionPointer<PFNGLREADBUFFERPROC>(loader.Invoke("glReadBuffer"));
            glReadPixels = Marshal.GetDelegateForFunctionPointer<PFNGLREADPIXELSPROC>(loader.Invoke("glReadPixels"));
            glGetBooleanv = Marshal.GetDelegateForFunctionPointer<PFNGLGETBOOLEANVPROC>(loader.Invoke("glGetBooleanv"));
            glGetDoublev = Marshal.GetDelegateForFunctionPointer<PFNGLGETDOUBLEVPROC>(loader.Invoke("glGetDoublev"));
            glGetError = Marshal.GetDelegateForFunctionPointer<PFNGLGETERRORPROC>(loader.Invoke("glGetError"));
            glGetFloatv = Marshal.GetDelegateForFunctionPointer<PFNGLGETFLOATVPROC>(loader.Invoke("glGetFloatv"));
            glGetIntegerv = Marshal.GetDelegateForFunctionPointer<PFNGLGETINTEGERVPROC>(loader.Invoke("glGetIntegerv"));
            glGetString = Marshal.GetDelegateForFunctionPointer<PFNGLGETSTRINGPROC>(loader.Invoke("glGetString"));
            glGetTexImage = Marshal.GetDelegateForFunctionPointer<PFNGLGETTEXIMAGEPROC>(loader.Invoke("glGetTexImage"));
            glGetTexParameterfv = Marshal.GetDelegateForFunctionPointer<PFNGLGETTEXPARAMETERFVPROC>(loader.Invoke("glGetTexParameterfv"));
            glGetTexParameteriv = Marshal.GetDelegateForFunctionPointer<PFNGLGETTEXPARAMETERIVPROC>(loader.Invoke("glGetTexParameteriv"));
            glGetTexLevelParameterfv = Marshal.GetDelegateForFunctionPointer<PFNGLGETTEXLEVELPARAMETERFVPROC>(loader.Invoke("glGetTexLevelParameterfv"));
            glGetTexLevelParameteriv = Marshal.GetDelegateForFunctionPointer<PFNGLGETTEXLEVELPARAMETERIVPROC>(loader.Invoke("glGetTexLevelParameteriv"));
            glIsEnabled = Marshal.GetDelegateForFunctionPointer<PFNGLISENABLEDPROC>(loader.Invoke("glIsEnabled"));
            glDepthRange = Marshal.GetDelegateForFunctionPointer<PFNGLDEPTHRANGEPROC>(loader.Invoke("glDepthRange"));
            glViewport = Marshal.GetDelegateForFunctionPointer<PFNGLVIEWPORTPROC>(loader.Invoke("glViewport"));
            glDrawArrays = Marshal.GetDelegateForFunctionPointer<PFNGLDRAWARRAYSPROC>(loader.Invoke("glDrawArrays"));
            glDrawElements = Marshal.GetDelegateForFunctionPointer<PFNGLDRAWELEMENTSPROC>(loader.Invoke("glDrawElements"));
            glPolygonOffset = Marshal.GetDelegateForFunctionPointer<PFNGLPOLYGONOFFSETPROC>(loader.Invoke("glPolygonOffset"));
            glCopyTexImage1D = Marshal.GetDelegateForFunctionPointer<PFNGLCOPYTEXIMAGE1DPROC>(loader.Invoke("glCopyTexImage1D"));
            glCopyTexImage2D = Marshal.GetDelegateForFunctionPointer<PFNGLCOPYTEXIMAGE2DPROC>(loader.Invoke("glCopyTexImage2D"));
            glCopyTexSubImage1D = Marshal.GetDelegateForFunctionPointer<PFNGLCOPYTEXSUBIMAGE1DPROC>(loader.Invoke("glCopyTexSubImage1D"));
            glCopyTexSubImage2D = Marshal.GetDelegateForFunctionPointer<PFNGLCOPYTEXSUBIMAGE2DPROC>(loader.Invoke("glCopyTexSubImage2D"));
            glTexSubImage1D = Marshal.GetDelegateForFunctionPointer<PFNGLTEXSUBIMAGE1DPROC>(loader.Invoke("glTexSubImage1D"));
            glTexSubImage2D = Marshal.GetDelegateForFunctionPointer<PFNGLTEXSUBIMAGE2DPROC>(loader.Invoke("glTexSubImage2D"));
            glBindTexture = Marshal.GetDelegateForFunctionPointer<PFNGLBINDTEXTUREPROC>(loader.Invoke("glBindTexture"));
            glDeleteTextures = Marshal.GetDelegateForFunctionPointer<PFNGLDELETETEXTURESPROC>(loader.Invoke("glDeleteTextures"));
            glGenTextures = Marshal.GetDelegateForFunctionPointer<PFNGLGENTEXTURESPROC>(loader.Invoke("glGenTextures"));
            glIsTexture = Marshal.GetDelegateForFunctionPointer<PFNGLISTEXTUREPROC>(loader.Invoke("glIsTexture"));
            glDrawRangeElements = Marshal.GetDelegateForFunctionPointer<PFNGLDRAWRANGEELEMENTSPROC>(loader.Invoke("glDrawRangeElements"));
            glTexImage3D = Marshal.GetDelegateForFunctionPointer<PFNGLTEXIMAGE3DPROC>(loader.Invoke("glTexImage3D"));
            glTexSubImage3D = Marshal.GetDelegateForFunctionPointer<PFNGLTEXSUBIMAGE3DPROC>(loader.Invoke("glTexSubImage3D"));
            glCopyTexSubImage3D = Marshal.GetDelegateForFunctionPointer<PFNGLCOPYTEXSUBIMAGE3DPROC>(loader.Invoke("glCopyTexSubImage3D"));
            glActiveTexture = Marshal.GetDelegateForFunctionPointer<PFNGLACTIVETEXTUREPROC>(loader.Invoke("glActiveTexture"));
            glSampleCoverage = Marshal.GetDelegateForFunctionPointer<PFNGLSAMPLECOVERAGEPROC>(loader.Invoke("glSampleCoverage"));
            glCompressedTexImage3D = Marshal.GetDelegateForFunctionPointer<PFNGLCOMPRESSEDTEXIMAGE3DPROC>(loader.Invoke("glCompressedTexImage3D"));
            glCompressedTexImage2D = Marshal.GetDelegateForFunctionPointer<PFNGLCOMPRESSEDTEXIMAGE2DPROC>(loader.Invoke("glCompressedTexImage2D"));
            glCompressedTexImage1D = Marshal.GetDelegateForFunctionPointer<PFNGLCOMPRESSEDTEXIMAGE1DPROC>(loader.Invoke("glCompressedTexImage1D"));
            glCompressedTexSubImage3D = Marshal.GetDelegateForFunctionPointer<PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC>(loader.Invoke("glCompressedTexSubImage3D"));
            glCompressedTexSubImage2D = Marshal.GetDelegateForFunctionPointer<PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC>(loader.Invoke("glCompressedTexSubImage2D"));
            glCompressedTexSubImage1D = Marshal.GetDelegateForFunctionPointer<PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC>(loader.Invoke("glCompressedTexSubImage1D"));
            glGetCompressedTexImage = Marshal.GetDelegateForFunctionPointer<PFNGLGETCOMPRESSEDTEXIMAGEPROC>(loader.Invoke("glGetCompressedTexImage"));
            glBlendFuncSeparate = Marshal.GetDelegateForFunctionPointer<PFNGLBLENDFUNCSEPARATEPROC>(loader.Invoke("glBlendFuncSeparate"));
            glMultiDrawArrays = Marshal.GetDelegateForFunctionPointer<PFNGLMULTIDRAWARRAYSPROC>(loader.Invoke("glMultiDrawArrays"));
            glMultiDrawElements = Marshal.GetDelegateForFunctionPointer<PFNGLMULTIDRAWELEMENTSPROC>(loader.Invoke("glMultiDrawElements"));
            glPointParameterf = Marshal.GetDelegateForFunctionPointer<PFNGLPOINTPARAMETERFPROC>(loader.Invoke("glPointParameterf"));
            glPointParameterfv = Marshal.GetDelegateForFunctionPointer<PFNGLPOINTPARAMETERFVPROC>(loader.Invoke("glPointParameterfv"));
            glPointParameteri = Marshal.GetDelegateForFunctionPointer<PFNGLPOINTPARAMETERIPROC>(loader.Invoke("glPointParameteri"));
            glPointParameteriv = Marshal.GetDelegateForFunctionPointer<PFNGLPOINTPARAMETERIVPROC>(loader.Invoke("glPointParameteriv"));
            glVertexAttribP4uiv = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIBP4UIVPROC>(loader.Invoke("glVertexAttribP4uiv"));
            glVertexAttribP4ui = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIBP4UIPROC>(loader.Invoke("glVertexAttribP4ui"));
            glVertexAttribP3uiv = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIBP3UIVPROC>(loader.Invoke("glVertexAttribP3uiv"));
            glVertexAttribP3ui = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIBP3UIPROC>(loader.Invoke("glVertexAttribP3ui"));
            glVertexAttribP2uiv = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIBP2UIVPROC>(loader.Invoke("glVertexAttribP2uiv"));
            glVertexAttribP2ui = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIBP2UIPROC>(loader.Invoke("glVertexAttribP2ui"));
            glVertexAttribP1uiv = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIBP1UIVPROC>(loader.Invoke("glVertexAttribP1uiv"));
            glVertexAttribP1ui = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIBP1UIPROC>(loader.Invoke("glVertexAttribP1ui"));
            glVertexAttribDivisor = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIBDIVISORPROC>(loader.Invoke("glVertexAttribDivisor"));
            glGetQueryObjectui64v = Marshal.GetDelegateForFunctionPointer<PFNGLGETQUERYOBJECTUI64VPROC>(loader.Invoke("glGetQueryObjectui64v"));
            glGetQueryObjecti64v = Marshal.GetDelegateForFunctionPointer<PFNGLGETQUERYOBJECTI64VPROC>(loader.Invoke("glGetQueryObjecti64v"));
            glQueryCounter = Marshal.GetDelegateForFunctionPointer<PFNGLQUERYCOUNTERPROC>(loader.Invoke("glQueryCounter"));
            glGetSamplerParameterIuiv = Marshal.GetDelegateForFunctionPointer<PFNGLGETSAMPLERPARAMETERIUIVPROC>(loader.Invoke("glGetSamplerParameterIuiv"));
            glGetSamplerParameterfv = Marshal.GetDelegateForFunctionPointer<PFNGLGETSAMPLERPARAMETERFVPROC>(loader.Invoke("glGetSamplerParameterfv"));
            glGetSamplerParameterIiv = Marshal.GetDelegateForFunctionPointer<PFNGLGETSAMPLERPARAMETERIIVPROC>(loader.Invoke("glGetSamplerParameterIiv"));
            glGetSamplerParameteriv = Marshal.GetDelegateForFunctionPointer<PFNGLGETSAMPLERPARAMETERIVPROC>(loader.Invoke("glGetSamplerParameteriv"));
            glSamplerParameterIuiv = Marshal.GetDelegateForFunctionPointer<PFNGLSAMPLERPARAMETERIUIVPROC>(loader.Invoke("glSamplerParameterIuiv"));
            glSamplerParameterIiv = Marshal.GetDelegateForFunctionPointer<PFNGLSAMPLERPARAMETERIIVPROC>(loader.Invoke("glSamplerParameterIiv"));
            glSamplerParameterfv = Marshal.GetDelegateForFunctionPointer<PFNGLSAMPLERPARAMETERFVPROC>(loader.Invoke("glSamplerParameterfv"));
            glSamplerParameterf = Marshal.GetDelegateForFunctionPointer<PFNGLSAMPLERPARAMETERFPROC>(loader.Invoke("glSamplerParameterf"));
            glSamplerParameteriv = Marshal.GetDelegateForFunctionPointer<PFNGLSAMPLERPARAMETERIVPROC>(loader.Invoke("glSamplerParameteriv"));
            glSamplerParameteri = Marshal.GetDelegateForFunctionPointer<PFNGLSAMPLERPARAMETERIPROC>(loader.Invoke("glSamplerParameteri"));
            glBindSampler = Marshal.GetDelegateForFunctionPointer<PFNGLBINDSAMPLERPROC>(loader.Invoke("glBindSampler"));
            glIsSampler = Marshal.GetDelegateForFunctionPointer<PFNGLISSAMPLERPROC>(loader.Invoke("glIsSampler"));
            glDeleteSamplers = Marshal.GetDelegateForFunctionPointer<PFNGLDELETESAMPLERSPROC>(loader.Invoke("glDeleteSamplers"));
            glGenSamplers = Marshal.GetDelegateForFunctionPointer<PFNGLGENSAMPLERSPROC>(loader.Invoke("glGenSamplers"));
            glGetFragDataIndex = Marshal.GetDelegateForFunctionPointer<PFNGLGETFRAGDATAINDEXPROC>(loader.Invoke("glGetFragDataIndex"));
            glBindFragDataLocationIndexed = Marshal.GetDelegateForFunctionPointer<PFNGLBINDFRAGDATALOCATIONINDEXEDPROC>(loader.Invoke("glBindFragDataLocationIndexed"));
            glBlendColor = Marshal.GetDelegateForFunctionPointer<PFNGLBLENDCOLORPROC>(loader.Invoke("glBlendColor"));
            glBlendEquation = Marshal.GetDelegateForFunctionPointer<PFNGLBLENDEQUATIONPROC>(loader.Invoke("glBlendEquation"));
            glGenQueries = Marshal.GetDelegateForFunctionPointer<PFNGLGENQUERIESPROC>(loader.Invoke("glGenQueries"));
            glDeleteQueries = Marshal.GetDelegateForFunctionPointer<PFNGLDELETEQUERIESPROC>(loader.Invoke("glDeleteQueries"));
            glIsQuery = Marshal.GetDelegateForFunctionPointer<PFNGLISQUERYPROC>(loader.Invoke("glIsQuery"));
            glBeginQuery = Marshal.GetDelegateForFunctionPointer<PFNGLBEGINQUERYPROC>(loader.Invoke("glBeginQuery"));
            glEndQuery = Marshal.GetDelegateForFunctionPointer<PFNGLENDQUERYPROC>(loader.Invoke("glEndQuery"));
            glGetQueryiv = Marshal.GetDelegateForFunctionPointer<PFNGLGETQUERYIVPROC>(loader.Invoke("glGetQueryiv"));
            glGetQueryObjectiv = Marshal.GetDelegateForFunctionPointer<PFNGLGETQUERYOBJECTIVPROC>(loader.Invoke("glGetQueryObjectiv"));
            glGetQueryObjectuiv = Marshal.GetDelegateForFunctionPointer<PFNGLGETQUERYOBJECTUIVPROC>(loader.Invoke("glGetQueryObjectuiv"));
            glBindBuffer = Marshal.GetDelegateForFunctionPointer<PFNGLBINDBUFFERPROC>(loader.Invoke("glBindBuffer"));
            glDeleteBuffers = Marshal.GetDelegateForFunctionPointer<PFNGLDELETEBUFFERSPROC>(loader.Invoke("glDeleteBuffers"));
            glGenBuffers = Marshal.GetDelegateForFunctionPointer<PFNGLGENBUFFERSPROC>(loader.Invoke("glGenBuffers"));
            glIsBuffer = Marshal.GetDelegateForFunctionPointer<PFNGLISBUFFERPROC>(loader.Invoke("glIsBuffer"));
            glBufferData = Marshal.GetDelegateForFunctionPointer<PFNGLBUFFERDATAPROC>(loader.Invoke("glBufferData"));
            glBufferSubData = Marshal.GetDelegateForFunctionPointer<PFNGLBUFFERSUBDATAPROC>(loader.Invoke("glBufferSubData"));
            glGetBufferSubData = Marshal.GetDelegateForFunctionPointer<PFNGLGETBUFFERSUBDATAPROC>(loader.Invoke("glGetBufferSubData"));
            glMapBuffer = Marshal.GetDelegateForFunctionPointer<PFNGLMAPBUFFERPROC>(loader.Invoke("glMapBuffer"));
            glUnmapBuffer = Marshal.GetDelegateForFunctionPointer<PFNGLUNMAPBUFFERPROC>(loader.Invoke("glUnmapBuffer"));
            glGetBufferParameteriv = Marshal.GetDelegateForFunctionPointer<PFNGLGETBUFFERPARAMETERIVPROC>(loader.Invoke("glGetBufferParameteriv"));
            glGetBufferPointerv = Marshal.GetDelegateForFunctionPointer<PFNGLGETBUFFERPOINTERVPROC>(loader.Invoke("glGetBufferPointerv"));
            glBlendEquationSeparate = Marshal.GetDelegateForFunctionPointer<PFNGLBLENDEQUATIONSEPARATEPROC>(loader.Invoke("glBlendEquationSeparate"));
            glDrawBuffers = Marshal.GetDelegateForFunctionPointer<PFNGLDRAWBUFFERSPROC>(loader.Invoke("glDrawBuffers"));
            glStencilOpSeparate = Marshal.GetDelegateForFunctionPointer<PFNGLSTENCILOPSEPARATEPROC>(loader.Invoke("glStencilOpSeparate"));
            glStencilFuncSeparate = Marshal.GetDelegateForFunctionPointer<PFNGLSTENCILFUNCSEPARATEPROC>(loader.Invoke("glStencilFuncSeparate"));
            glStencilMaskSeparate = Marshal.GetDelegateForFunctionPointer<PFNGLSTENCILMASKSEPARATEPROC>(loader.Invoke("glStencilMaskSeparate"));
            glAttachShader = Marshal.GetDelegateForFunctionPointer<PFNGLATTACHSHADERPROC>(loader.Invoke("glAttachShader"));
            glBindAttribLocation = Marshal.GetDelegateForFunctionPointer<PFNGLBINDATTRIBLOCATIONPROC>(loader.Invoke("glBindAttribLocation"));
            glCompileShader = Marshal.GetDelegateForFunctionPointer<PFNGLCOMPILESHADERPROC>(loader.Invoke("glCompileShader"));
            glCreateProgram = Marshal.GetDelegateForFunctionPointer<PFNGLCREATEPROGRAMPROC>(loader.Invoke("glCreateProgram"));
            glCreateShader = Marshal.GetDelegateForFunctionPointer<PFNGLCREATESHADERPROC>(loader.Invoke("glCreateShader"));
            glDeleteProgram = Marshal.GetDelegateForFunctionPointer<PFNGLDELETEPROGRAMPROC>(loader.Invoke("glDeleteProgram"));
            glDeleteShader = Marshal.GetDelegateForFunctionPointer<PFNGLDELETESHADERPROC>(loader.Invoke("glDeleteShader"));
            glDetachShader = Marshal.GetDelegateForFunctionPointer<PFNGLDETACHSHADERPROC>(loader.Invoke("glDetachShader"));
            glDisableVertexAttribArray = Marshal.GetDelegateForFunctionPointer<PFNGLDISABLEVERTEXATTRIBARRAYPROC>(loader.Invoke("glDisableVertexAttribArray"));
            glEnableVertexAttribArray = Marshal.GetDelegateForFunctionPointer<PFNGLENABLEVERTEXATTRIBARRAYPROC>(loader.Invoke("glEnableVertexAttribArray"));
            glGetActiveAttrib = Marshal.GetDelegateForFunctionPointer<PFNGLGETACTIVEATTRIBPROC>(loader.Invoke("glGetActiveAttrib"));
            glGetActiveUniform = Marshal.GetDelegateForFunctionPointer<PFNGLGETACTIVEUNIFORMPROC>(loader.Invoke("glGetActiveUniform"));
            glGetAttachedShaders = Marshal.GetDelegateForFunctionPointer<PFNGLGETATTACHEDSHADERSPROC>(loader.Invoke("glGetAttachedShaders"));
            glGetAttribLocation = Marshal.GetDelegateForFunctionPointer<PFNGLGETATTRIBLOCATIONPROC>(loader.Invoke("glGetAttribLocation"));
            glGetProgramiv = Marshal.GetDelegateForFunctionPointer<PFNGLGETPROGRAMIVPROC>(loader.Invoke("glGetProgramiv"));
            glGetProgramInfoLog = Marshal.GetDelegateForFunctionPointer<PFNGLGETPROGRAMINFOLOGPROC>(loader.Invoke("glGetProgramInfoLog"));
            glGetShaderiv = Marshal.GetDelegateForFunctionPointer<PFNGLGETSHADERIVPROC>(loader.Invoke("glGetShaderiv"));
            glGetShaderInfoLog = Marshal.GetDelegateForFunctionPointer<PFNGLGETSHADERINFOLOGPROC>(loader.Invoke("glGetShaderInfoLog"));
            glGetShaderSource = Marshal.GetDelegateForFunctionPointer<PFNGLGETSHADERSOURCEPROC>(loader.Invoke("glGetShaderSource"));
            glGetUniformLocation = Marshal.GetDelegateForFunctionPointer<PFNGLGETUNIFORMLOCATIONPROC>(loader.Invoke("glGetUniformLocation"));
            glGetUniformfv = Marshal.GetDelegateForFunctionPointer<PFNGLGETUNIFORMFVPROC>(loader.Invoke("glGetUniformfv"));
            glGetUniformiv = Marshal.GetDelegateForFunctionPointer<PFNGLGETUNIFORMIVPROC>(loader.Invoke("glGetUniformiv"));
            glGetVertexAttribdv = Marshal.GetDelegateForFunctionPointer<PFNGLGETVERTEXATTRIBDVPROC>(loader.Invoke("glGetVertexAttribdv"));
            glGetVertexAttribfv = Marshal.GetDelegateForFunctionPointer<PFNGLGETVERTEXATTRIBFVPROC>(loader.Invoke("glGetVertexAttribfv"));
            glGetVertexAttribiv = Marshal.GetDelegateForFunctionPointer<PFNGLGETVERTEXATTRIBIVPROC>(loader.Invoke("glGetVertexAttribiv"));
            glGetVertexAttribPointerv = Marshal.GetDelegateForFunctionPointer<PFNGLGETVERTEXATTRIBPOINTERVPROC>(loader.Invoke("glGetVertexAttribPointerv"));
            glIsProgram = Marshal.GetDelegateForFunctionPointer<PFNGLISPROGRAMPROC>(loader.Invoke("glIsProgram"));
            glIsShader = Marshal.GetDelegateForFunctionPointer<PFNGLISSHADERPROC>(loader.Invoke("glIsShader"));
            glLinkProgram = Marshal.GetDelegateForFunctionPointer<PFNGLLINKPROGRAMPROC>(loader.Invoke("glLinkProgram"));
            glShaderSource = Marshal.GetDelegateForFunctionPointer<PFNGLSHADERSOURCEPROC>(loader.Invoke("glShaderSource"));
            glUseProgram = Marshal.GetDelegateForFunctionPointer<PFNGLUSEPROGRAMPROC>(loader.Invoke("glUseProgram"));
            glUniform1f = Marshal.GetDelegateForFunctionPointer<PFNGLUNIFORM1FPROC>(loader.Invoke("glUniform1f"));
            glUniform2f = Marshal.GetDelegateForFunctionPointer<PFNGLUNIFORM2FPROC>(loader.Invoke("glUniform2f"));
            glUniform3f = Marshal.GetDelegateForFunctionPointer<PFNGLUNIFORM3FPROC>(loader.Invoke("glUniform3f"));
            glUniform4f = Marshal.GetDelegateForFunctionPointer<PFNGLUNIFORM4FPROC>(loader.Invoke("glUniform4f"));
            glUniform1i = Marshal.GetDelegateForFunctionPointer<PFNGLUNIFORM1IPROC>(loader.Invoke("glUniform1i"));
            glUniform2i = Marshal.GetDelegateForFunctionPointer<PFNGLUNIFORM2IPROC>(loader.Invoke("glUniform2i"));
            glUniform3i = Marshal.GetDelegateForFunctionPointer<PFNGLUNIFORM3IPROC>(loader.Invoke("glUniform3i"));
            glUniform4i = Marshal.GetDelegateForFunctionPointer<PFNGLUNIFORM4IPROC>(loader.Invoke("glUniform4i"));
            glUniform1fv = Marshal.GetDelegateForFunctionPointer<PFNGLUNIFORM1FVPROC>(loader.Invoke("glUniform1fv"));
            glUniform2fv = Marshal.GetDelegateForFunctionPointer<PFNGLUNIFORM2FVPROC>(loader.Invoke("glUniform2fv"));
            glUniform3fv = Marshal.GetDelegateForFunctionPointer<PFNGLUNIFORM3FVPROC>(loader.Invoke("glUniform3fv"));
            glUniform4fv = Marshal.GetDelegateForFunctionPointer<PFNGLUNIFORM4FVPROC>(loader.Invoke("glUniform4fv"));
            glUniform1iv = Marshal.GetDelegateForFunctionPointer<PFNGLUNIFORM1IVPROC>(loader.Invoke("glUniform1iv"));
            glUniform2iv = Marshal.GetDelegateForFunctionPointer<PFNGLUNIFORM2IVPROC>(loader.Invoke("glUniform2iv"));
            glUniform3iv = Marshal.GetDelegateForFunctionPointer<PFNGLUNIFORM3IVPROC>(loader.Invoke("glUniform3iv"));
            glUniform4iv = Marshal.GetDelegateForFunctionPointer<PFNGLUNIFORM4IVPROC>(loader.Invoke("glUniform4iv"));
            glUniformMatrix2fv = Marshal.GetDelegateForFunctionPointer<PFNGLUNIFORMMATRIX2FVPROC>(loader.Invoke("glUniformMatrix2fv"));
            glUniformMatrix3fv = Marshal.GetDelegateForFunctionPointer<PFNGLUNIFORMMATRIX3FVPROC>(loader.Invoke("glUniformMatrix3fv"));
            glUniformMatrix4fv = Marshal.GetDelegateForFunctionPointer<PFNGLUNIFORMMATRIX4FVPROC>(loader.Invoke("glUniformMatrix4fv"));
            glValidateProgram = Marshal.GetDelegateForFunctionPointer<PFNGLVALIDATEPROGRAMPROC>(loader.Invoke("glValidateProgram"));
            glVertexAttrib1d = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIB1DPROC>(loader.Invoke("glVertexAttrib1d"));
            glVertexAttrib1dv = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIB1DVPROC>(loader.Invoke("glVertexAttrib1dv"));
            glVertexAttrib1f = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIB1FPROC>(loader.Invoke("glVertexAttrib1f"));
            glVertexAttrib1fv = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIB1FVPROC>(loader.Invoke("glVertexAttrib1fv"));
            glVertexAttrib1s = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIB1SPROC>(loader.Invoke("glVertexAttrib1s"));
            glVertexAttrib1sv = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIB1SVPROC>(loader.Invoke("glVertexAttrib1sv"));
            glVertexAttrib2d = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIB2DPROC>(loader.Invoke("glVertexAttrib2d"));
            glVertexAttrib2dv = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIB2DVPROC>(loader.Invoke("glVertexAttrib2dv"));
            glVertexAttrib2f = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIB2FPROC>(loader.Invoke("glVertexAttrib2f"));
            glVertexAttrib2fv = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIB2FVPROC>(loader.Invoke("glVertexAttrib2fv"));
            glVertexAttrib2s = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIB2SPROC>(loader.Invoke("glVertexAttrib2s"));
            glVertexAttrib2sv = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIB2SVPROC>(loader.Invoke("glVertexAttrib2sv"));
            glVertexAttrib3d = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIB3DPROC>(loader.Invoke("glVertexAttrib3d"));
            glVertexAttrib3dv = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIB3DVPROC>(loader.Invoke("glVertexAttrib3dv"));
            glVertexAttrib3f = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIB3FPROC>(loader.Invoke("glVertexAttrib3f"));
            glVertexAttrib3fv = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIB3FVPROC>(loader.Invoke("glVertexAttrib3fv"));
            glVertexAttrib3s = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIB3SPROC>(loader.Invoke("glVertexAttrib3s"));
            glVertexAttrib3sv = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIB3SVPROC>(loader.Invoke("glVertexAttrib3sv"));
            glVertexAttrib4Nbv = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIB4NBVPROC>(loader.Invoke("glVertexAttrib4Nbv"));
            glVertexAttrib4Niv = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIB4NIVPROC>(loader.Invoke("glVertexAttrib4Niv"));
            glVertexAttrib4Nsv = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIB4NSVPROC>(loader.Invoke("glVertexAttrib4Nsv"));
            glVertexAttrib4Nub = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIB4NUBPROC>(loader.Invoke("glVertexAttrib4Nub"));
            glVertexAttrib4Nubv = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIB4NUBVPROC>(loader.Invoke("glVertexAttrib4Nubv"));
            glVertexAttrib4Nuiv = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIB4NUIVPROC>(loader.Invoke("glVertexAttrib4Nuiv"));
            glVertexAttrib4Nusv = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIB4NUSVPROC>(loader.Invoke("glVertexAttrib4Nusv"));
            glVertexAttrib4bv = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIB4BVPROC>(loader.Invoke("glVertexAttrib4bv"));
            glVertexAttrib4d = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIB4DPROC>(loader.Invoke("glVertexAttrib4d"));
            glVertexAttrib4dv = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIB4DVPROC>(loader.Invoke("glVertexAttrib4dv"));
            glVertexAttrib4f = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIB4FPROC>(loader.Invoke("glVertexAttrib4f"));
            glVertexAttrib4fv = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIB4FVPROC>(loader.Invoke("glVertexAttrib4fv"));
            glVertexAttrib4iv = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIB4IVPROC>(loader.Invoke("glVertexAttrib4iv"));
            glVertexAttrib4s = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIB4SPROC>(loader.Invoke("glVertexAttrib4s"));
            glVertexAttrib4sv = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIB4SVPROC>(loader.Invoke("glVertexAttrib4sv"));
            glVertexAttrib4ubv = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIB4UBVPROC>(loader.Invoke("glVertexAttrib4ubv"));
            glVertexAttrib4uiv = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIB4UIVPROC>(loader.Invoke("glVertexAttrib4uiv"));
            glVertexAttrib4usv = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIB4USVPROC>(loader.Invoke("glVertexAttrib4usv"));
            glVertexAttribPointer = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIBPOINTERPROC>(loader.Invoke("glVertexAttribPointer"));
            glUniformMatrix2x3fv = Marshal.GetDelegateForFunctionPointer<PFNGLUNIFORMMATRIX2X3FVPROC>(loader.Invoke("glUniformMatrix2x3fv"));
            glUniformMatrix3x2fv = Marshal.GetDelegateForFunctionPointer<PFNGLUNIFORMMATRIX3X2FVPROC>(loader.Invoke("glUniformMatrix3x2fv"));
            glUniformMatrix2x4fv = Marshal.GetDelegateForFunctionPointer<PFNGLUNIFORMMATRIX2X4FVPROC>(loader.Invoke("glUniformMatrix2x4fv"));
            glUniformMatrix4x2fv = Marshal.GetDelegateForFunctionPointer<PFNGLUNIFORMMATRIX4X2FVPROC>(loader.Invoke("glUniformMatrix4x2fv"));
            glUniformMatrix3x4fv = Marshal.GetDelegateForFunctionPointer<PFNGLUNIFORMMATRIX3X4FVPROC>(loader.Invoke("glUniformMatrix3x4fv"));
            glUniformMatrix4x3fv = Marshal.GetDelegateForFunctionPointer<PFNGLUNIFORMMATRIX4X3FVPROC>(loader.Invoke("glUniformMatrix4x3fv"));
            glColorMaski = Marshal.GetDelegateForFunctionPointer<PFNGLCOLORMASKIPROC>(loader.Invoke("glColorMaski"));
            glGetBooleani_v = Marshal.GetDelegateForFunctionPointer<PFNGLGETBOOLEANI_VPROC>(loader.Invoke("glGetBooleani_v"));
            glGetIntegeri_v = Marshal.GetDelegateForFunctionPointer<PFNGLGETINTEGERI_VPROC>(loader.Invoke("glGetIntegeri_v"));
            glEnablei = Marshal.GetDelegateForFunctionPointer<PFNGLENABLEIPROC>(loader.Invoke("glEnablei"));
            glDisablei = Marshal.GetDelegateForFunctionPointer<PFNGLDISABLEIPROC>(loader.Invoke("glDisablei"));
            glIsEnabledi = Marshal.GetDelegateForFunctionPointer<PFNGLISENABLEDIPROC>(loader.Invoke("glIsEnabledi"));
            glBeginTransformFeedback = Marshal.GetDelegateForFunctionPointer<PFNGLBEGINTRANSFORMFEEDBACKPROC>(loader.Invoke("glBeginTransformFeedback"));
            glEndTransformFeedback = Marshal.GetDelegateForFunctionPointer<PFNGLENDTRANSFORMFEEDBACKPROC>(loader.Invoke("glEndTransformFeedback"));
            glBindBufferRange = Marshal.GetDelegateForFunctionPointer<PFNGLBINDBUFFERRANGEPROC>(loader.Invoke("glBindBufferRange"));
            glBindBufferBase = Marshal.GetDelegateForFunctionPointer<PFNGLBINDBUFFERBASEPROC>(loader.Invoke("glBindBufferBase"));
            glTransformFeedbackVaryings = Marshal.GetDelegateForFunctionPointer<PFNGLTRANSFORMFEEDBACKVARYINGSPROC>(loader.Invoke("glTransformFeedbackVaryings"));
            glGetTransformFeedbackVarying = Marshal.GetDelegateForFunctionPointer<PFNGLGETTRANSFORMFEEDBACKVARYINGPROC>(loader.Invoke("glGetTransformFeedbackVarying"));
            glClampColor = Marshal.GetDelegateForFunctionPointer<PFNGLCLAMPCOLORPROC>(loader.Invoke("glClampColor"));
            glBeginConditionalRender = Marshal.GetDelegateForFunctionPointer<PFNGLBEGINCONDITIONALRENDERPROC>(loader.Invoke("glBeginConditionalRender"));
            glEndConditionalRender = Marshal.GetDelegateForFunctionPointer<PFNGLENDCONDITIONALRENDERPROC>(loader.Invoke("glEndConditionalRender"));
            glVertexAttribIPointer = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIBIPOINTERPROC>(loader.Invoke("glVertexAttribIPointer"));
            glGetVertexAttribIiv = Marshal.GetDelegateForFunctionPointer<PFNGLGETVERTEXATTRIBIIVPROC>(loader.Invoke("glGetVertexAttribIiv"));
            glGetVertexAttribIuiv = Marshal.GetDelegateForFunctionPointer<PFNGLGETVERTEXATTRIBIUIVPROC>(loader.Invoke("glGetVertexAttribIuiv"));
            glVertexAttribI1i = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIBI1IPROC>(loader.Invoke("glVertexAttribI1i"));
            glVertexAttribI2i = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIBI2IPROC>(loader.Invoke("glVertexAttribI2i"));
            glVertexAttribI3i = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIBI3IPROC>(loader.Invoke("glVertexAttribI3i"));
            glVertexAttribI4i = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIBI4IPROC>(loader.Invoke("glVertexAttribI4i"));
            glVertexAttribI1ui = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIBI1UIPROC>(loader.Invoke("glVertexAttribI1ui"));
            glVertexAttribI2ui = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIBI2UIPROC>(loader.Invoke("glVertexAttribI2ui"));
            glVertexAttribI3ui = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIBI3UIPROC>(loader.Invoke("glVertexAttribI3ui"));
            glVertexAttribI4ui = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIBI4UIPROC>(loader.Invoke("glVertexAttribI4ui"));
            glVertexAttribI1iv = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIBI1IVPROC>(loader.Invoke("glVertexAttribI1iv"));
            glVertexAttribI2iv = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIBI2IVPROC>(loader.Invoke("glVertexAttribI2iv"));
            glVertexAttribI3iv = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIBI3IVPROC>(loader.Invoke("glVertexAttribI3iv"));
            glVertexAttribI4iv = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIBI4IVPROC>(loader.Invoke("glVertexAttribI4iv"));
            glVertexAttribI1uiv = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIBI1UIVPROC>(loader.Invoke("glVertexAttribI1uiv"));
            glVertexAttribI2uiv = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIBI2UIVPROC>(loader.Invoke("glVertexAttribI2uiv"));
            glVertexAttribI3uiv = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIBI3UIVPROC>(loader.Invoke("glVertexAttribI3uiv"));
            glVertexAttribI4uiv = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIBI4UIVPROC>(loader.Invoke("glVertexAttribI4uiv"));
            glVertexAttribI4bv = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIBI4BVPROC>(loader.Invoke("glVertexAttribI4bv"));
            glVertexAttribI4sv = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIBI4SVPROC>(loader.Invoke("glVertexAttribI4sv"));
            glVertexAttribI4ubv = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIBI4UBVPROC>(loader.Invoke("glVertexAttribI4ubv"));
            glVertexAttribI4usv = Marshal.GetDelegateForFunctionPointer<PFNGLVERTEXATTRIBI4USVPROC>(loader.Invoke("glVertexAttribI4usv"));
            glGetUniformuiv = Marshal.GetDelegateForFunctionPointer<PFNGLGETUNIFORMUIVPROC>(loader.Invoke("glGetUniformuiv"));
            glBindFragDataLocation = Marshal.GetDelegateForFunctionPointer<PFNGLBINDFRAGDATALOCATIONPROC>(loader.Invoke("glBindFragDataLocation"));
            glGetFragDataLocation = Marshal.GetDelegateForFunctionPointer<PFNGLGETFRAGDATALOCATIONPROC>(loader.Invoke("glGetFragDataLocation"));
            glUniform1ui = Marshal.GetDelegateForFunctionPointer<PFNGLUNIFORM1UIPROC>(loader.Invoke("glUniform1ui"));
            glUniform2ui = Marshal.GetDelegateForFunctionPointer<PFNGLUNIFORM2UIPROC>(loader.Invoke("glUniform2ui"));
            glUniform3ui = Marshal.GetDelegateForFunctionPointer<PFNGLUNIFORM3UIPROC>(loader.Invoke("glUniform3ui"));
            glUniform4ui = Marshal.GetDelegateForFunctionPointer<PFNGLUNIFORM4UIPROC>(loader.Invoke("glUniform4ui"));
            glUniform1uiv = Marshal.GetDelegateForFunctionPointer<PFNGLUNIFORM1UIVPROC>(loader.Invoke("glUniform1uiv"));
            glUniform2uiv = Marshal.GetDelegateForFunctionPointer<PFNGLUNIFORM2UIVPROC>(loader.Invoke("glUniform2uiv"));
            glUniform3uiv = Marshal.GetDelegateForFunctionPointer<PFNGLUNIFORM3UIVPROC>(loader.Invoke("glUniform3uiv"));
            glUniform4uiv = Marshal.GetDelegateForFunctionPointer<PFNGLUNIFORM4UIVPROC>(loader.Invoke("glUniform4uiv"));
            glTexParameterIiv = Marshal.GetDelegateForFunctionPointer<PFNGLTEXPARAMETERIIVPROC>(loader.Invoke("glTexParameterIiv"));
            glTexParameterIuiv = Marshal.GetDelegateForFunctionPointer<PFNGLTEXPARAMETERIUIVPROC>(loader.Invoke("glTexParameterIuiv"));
            glGetTexParameterIiv = Marshal.GetDelegateForFunctionPointer<PFNGLGETTEXPARAMETERIIVPROC>(loader.Invoke("glGetTexParameterIiv"));
            glGetTexParameterIuiv = Marshal.GetDelegateForFunctionPointer<PFNGLGETTEXPARAMETERIUIVPROC>(loader.Invoke("glGetTexParameterIuiv"));
            glClearBufferiv = Marshal.GetDelegateForFunctionPointer<PFNGLCLEARBUFFERIVPROC>(loader.Invoke("glClearBufferiv"));
            glClearBufferuiv = Marshal.GetDelegateForFunctionPointer<PFNGLCLEARBUFFERUIVPROC>(loader.Invoke("glClearBufferuiv"));
            glClearBufferfv = Marshal.GetDelegateForFunctionPointer<PFNGLCLEARBUFFERFVPROC>(loader.Invoke("glClearBufferfv"));
            glClearBufferfi = Marshal.GetDelegateForFunctionPointer<PFNGLCLEARBUFFERFIPROC>(loader.Invoke("glClearBufferfi"));
            glGetStringi = Marshal.GetDelegateForFunctionPointer<PFNGLGETSTRINGIPROC>(loader.Invoke("glGetStringi"));
            glIsRenderbuffer = Marshal.GetDelegateForFunctionPointer<PFNGLISRENDERBUFFERPROC>(loader.Invoke("glIsRenderbuffer"));
            glBindRenderbuffer = Marshal.GetDelegateForFunctionPointer<PFNGLBINDRENDERBUFFERPROC>(loader.Invoke("glBindRenderbuffer"));
            glDeleteRenderbuffers = Marshal.GetDelegateForFunctionPointer<PFNGLDELETERENDERBUFFERSPROC>(loader.Invoke("glDeleteRenderbuffers"));
            glGenRenderbuffers = Marshal.GetDelegateForFunctionPointer<PFNGLGENRENDERBUFFERSPROC>(loader.Invoke("glGenRenderbuffers"));
            glRenderbufferStorage = Marshal.GetDelegateForFunctionPointer<PFNGLRENDERBUFFERSTORAGEPROC>(loader.Invoke("glRenderbufferStorage"));
            glGetRenderbufferParameteriv = Marshal.GetDelegateForFunctionPointer<PFNGLGETRENDERBUFFERPARAMETERIVPROC>(loader.Invoke("glGetRenderbufferParameteriv"));
            glIsFramebuffer = Marshal.GetDelegateForFunctionPointer<PFNGLISFRAMEBUFFERPROC>(loader.Invoke("glIsFramebuffer"));
            glBindFramebuffer = Marshal.GetDelegateForFunctionPointer<PFNGLBINDFRAMEBUFFERPROC>(loader.Invoke("glBindFramebuffer"));
            glDeleteFramebuffers = Marshal.GetDelegateForFunctionPointer<PFNGLDELETEFRAMEBUFFERSPROC>(loader.Invoke("glDeleteFramebuffers"));
            glGenFramebuffers = Marshal.GetDelegateForFunctionPointer<PFNGLGENFRAMEBUFFERSPROC>(loader.Invoke("glGenFramebuffers"));
            glCheckFramebufferStatus = Marshal.GetDelegateForFunctionPointer<PFNGLCHECKFRAMEBUFFERSTATUSPROC>(loader.Invoke("glCheckFramebufferStatus"));
            glFramebufferTexture1D = Marshal.GetDelegateForFunctionPointer<PFNGLFRAMEBUFFERTEXTURE1DPROC>(loader.Invoke("glFramebufferTexture1D"));
            glFramebufferTexture2D = Marshal.GetDelegateForFunctionPointer<PFNGLFRAMEBUFFERTEXTURE2DPROC>(loader.Invoke("glFramebufferTexture2D"));
            glFramebufferTexture3D = Marshal.GetDelegateForFunctionPointer<PFNGLFRAMEBUFFERTEXTURE3DPROC>(loader.Invoke("glFramebufferTexture3D"));
            glFramebufferRenderbuffer = Marshal.GetDelegateForFunctionPointer<PFNGLFRAMEBUFFERRENDERBUFFERPROC>(loader.Invoke("glFramebufferRenderbuffer"));
            glGetFramebufferAttachmentParameteriv = Marshal.GetDelegateForFunctionPointer<PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC>(loader.Invoke("glGetFramebufferAttachmentParameteriv"));
            glGenerateMipmap = Marshal.GetDelegateForFunctionPointer<PFNGLGENERATEMIPMAPPROC>(loader.Invoke("glGenerateMipmap"));
            glBlitFramebuffer = Marshal.GetDelegateForFunctionPointer<PFNGLBLITFRAMEBUFFERPROC>(loader.Invoke("glBlitFramebuffer"));
            glRenderbufferStorageMultisample = Marshal.GetDelegateForFunctionPointer<PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC>(loader.Invoke("glRenderbufferStorageMultisample"));
            glFramebufferTextureLayer = Marshal.GetDelegateForFunctionPointer<PFNGLFRAMEBUFFERTEXTURELAYERPROC>(loader.Invoke("glFramebufferTextureLayer"));
            glMapBufferRange = Marshal.GetDelegateForFunctionPointer<PFNGLMAPBUFFERRANGEPROC>(loader.Invoke("glMapBufferRange"));
            glFlushMappedBufferRange = Marshal.GetDelegateForFunctionPointer<PFNGLFLUSHMAPPEDBUFFERRANGEPROC>(loader.Invoke("glFlushMappedBufferRange"));
            glBindVertexArray = Marshal.GetDelegateForFunctionPointer<PFNGLBINDVERTEXARRAYPROC>(loader.Invoke("glBindVertexArray"));
            glDeleteVertexArrays = Marshal.GetDelegateForFunctionPointer<PFNGLDELETEVERTEXARRAYSPROC>(loader.Invoke("glDeleteVertexArrays"));
            glGenVertexArrays = Marshal.GetDelegateForFunctionPointer<PFNGLGENVERTEXARRAYSPROC>(loader.Invoke("glGenVertexArrays"));
            glIsVertexArray = Marshal.GetDelegateForFunctionPointer<PFNGLISVERTEXARRAYPROC>(loader.Invoke("glIsVertexArray"));
            glDrawArraysInstanced = Marshal.GetDelegateForFunctionPointer<PFNGLDRAWARRAYSINSTANCEDPROC>(loader.Invoke("glDrawArraysInstanced"));
            glDrawElementsInstanced = Marshal.GetDelegateForFunctionPointer<PFNGLDRAWELEMENTSINSTANCEDPROC>(loader.Invoke("glDrawElementsInstanced"));
            glTexBuffer = Marshal.GetDelegateForFunctionPointer<PFNGLTEXBUFFERPROC>(loader.Invoke("glTexBuffer"));
            glPrimitiveRestartIndex = Marshal.GetDelegateForFunctionPointer<PFNGLPRIMITIVERESTARTINDEXPROC>(loader.Invoke("glPrimitiveRestartIndex"));
            glCopyBufferSubData = Marshal.GetDelegateForFunctionPointer<PFNGLCOPYBUFFERSUBDATAPROC>(loader.Invoke("glCopyBufferSubData"));
            glGetUniformIndices = Marshal.GetDelegateForFunctionPointer<PFNGLGETUNIFORMINDICESPROC>(loader.Invoke("glGetUniformIndices"));
            glGetActiveUniformsiv = Marshal.GetDelegateForFunctionPointer<PFNGLGETACTIVEUNIFORMSIVPROC>(loader.Invoke("glGetActiveUniformsiv"));
            glGetActiveUniformName = Marshal.GetDelegateForFunctionPointer<PFNGLGETACTIVEUNIFORMNAMEPROC>(loader.Invoke("glGetActiveUniformName"));
            glGetUniformBlockIndex = Marshal.GetDelegateForFunctionPointer<PFNGLGETUNIFORMBLOCKINDEXPROC>(loader.Invoke("glGetUniformBlockIndex"));
            glGetActiveUniformBlockiv = Marshal.GetDelegateForFunctionPointer<PFNGLGETACTIVEUNIFORMBLOCKIVPROC>(loader.Invoke("glGetActiveUniformBlockiv"));
            glGetActiveUniformBlockName = Marshal.GetDelegateForFunctionPointer<PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC>(loader.Invoke("glGetActiveUniformBlockName"));
            glUniformBlockBinding = Marshal.GetDelegateForFunctionPointer<PFNGLUNIFORMBLOCKBINDINGPROC>(loader.Invoke("glUniformBlockBinding"));
            glDrawElementsBaseVertex = Marshal.GetDelegateForFunctionPointer<PFNGLDRAWELEMENTSBASEVERTEXPROC>(loader.Invoke("glDrawElementsBaseVertex"));
            glDrawRangeElementsBaseVertex = Marshal.GetDelegateForFunctionPointer<PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC>(loader.Invoke("glDrawRangeElementsBaseVertex"));
            glDrawElementsInstancedBaseVertex = Marshal.GetDelegateForFunctionPointer<PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC>(loader.Invoke("glDrawElementsInstancedBaseVertex"));
            glMultiDrawElementsBaseVertex = Marshal.GetDelegateForFunctionPointer<PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC>(loader.Invoke("glMultiDrawElementsBaseVertex"));
            glProvokingVertex = Marshal.GetDelegateForFunctionPointer<PFNGLPROVOKINGVERTEXPROC>(loader.Invoke("glProvokingVertex"));
            glFenceSync = Marshal.GetDelegateForFunctionPointer<PFNGLFENCESYNCPROC>(loader.Invoke("glFenceSync"));
            glIsSync = Marshal.GetDelegateForFunctionPointer<PFNGLISSYNCPROC>(loader.Invoke("glIsSync"));
            glDeleteSync = Marshal.GetDelegateForFunctionPointer<PFNGLDELETESYNCPROC>(loader.Invoke("glDeleteSync"));
            glClientWaitSync = Marshal.GetDelegateForFunctionPointer<PFNGLCLIENTWAITSYNCPROC>(loader.Invoke("glClientWaitSync"));
            glWaitSync = Marshal.GetDelegateForFunctionPointer<PFNGLWAITSYNCPROC>(loader.Invoke("glWaitSync"));
            glGetInteger64v = Marshal.GetDelegateForFunctionPointer<PFNGLGETINTEGER64VPROC>(loader.Invoke("glGetInteger64v"));
            glGetSynciv = Marshal.GetDelegateForFunctionPointer<PFNGLGETSYNCIVPROC>(loader.Invoke("glGetSynciv"));
            glGetInteger64i_v = Marshal.GetDelegateForFunctionPointer<PFNGLGETINTEGER64I_VPROC>(loader.Invoke("glGetInteger64i_v"));
            glGetBufferParameteri64v = Marshal.GetDelegateForFunctionPointer<PFNGLGETBUFFERPARAMETERI64VPROC>(loader.Invoke("glGetBufferParameteri64v"));
            glFramebufferTexture = Marshal.GetDelegateForFunctionPointer<PFNGLFRAMEBUFFERTEXTUREPROC>(loader.Invoke("glFramebufferTexture"));
            glTexImage2DMultisample = Marshal.GetDelegateForFunctionPointer<PFNGLTEXIMAGE2DMULTISAMPLEPROC>(loader.Invoke("glTexImage2DMultisample"));
            glTexImage3DMultisample = Marshal.GetDelegateForFunctionPointer<PFNGLTEXIMAGE3DMULTISAMPLEPROC>(loader.Invoke("glTexImage3DMultisample"));
            glGetMultisamplefv = Marshal.GetDelegateForFunctionPointer<PFNGLGETMULTISAMPLEFVPROC>(loader.Invoke("glGetMultisamplefv"));
            glSampleMaski = Marshal.GetDelegateForFunctionPointer<PFNGLSAMPLEMASKIPROC>(loader.Invoke("glSampleMaski"));
            #endregion
        }

        /// <summary>
        /// Checks for any issues in this OpenGL Context and throws an exception if it detects one.
        /// May throw OpenGLException.
        /// </summary>
        public void DetectGLError() {
            OpenGL.ErrorCode code = GetError();
            if (code != OpenGL.ErrorCode.NoError) {
                throw new OpenGLErrorException(code);
            }
        }

        public void GetViewport(out int x, out int y, out int width, out int height) {
            int[] viewport = new int[4];
            GetIntegerv(GetPName.Viewport, viewport);
            x = viewport[0];
            y = viewport[1];
            width = viewport[2];
            height = viewport[3];
        }

        protected virtual void Dispose(bool disposing)
        {
            if (!disposed)
            {
                if (disposing)
                {
                }
                SDL.SDL_GL_DeleteContext(Handle);
                disposed = true;
            }
        }

        ~GLContext()
        {
            Dispose(disposing: false);
        }

        public void Dispose()
        {
            Dispose(disposing: true);
            GC.SuppressFinalize(this);
        }
    }
}