4#define GL_CLAMP_TO_EDGE 0x812F
5#define GL_FRAGMENT_SHADER 0x8B30
6#define GL_VERTEX_SHADER 0x8B31
7#define GL_COMPILE_STATUS 0x8B81
8#define GL_LINK_STATUS 0x8B82
9#define GL_INFO_LOG_LENGTH 0x8B84
10#define GL_CURRENT_PROGRAM 0x8B8D
11#define GL_SHADING_LANGUAGE_VERSION 0x8B8C
12#define GL_NUM_EXTENSIONS 0x821D
13#define GL_INVALID_INDEX 0xFFFFFFFFu
14#define GL_FLOAT_VEC2 0x8B50
15#define GL_FLOAT_VEC3 0x8B51
16#define GL_FLOAT_VEC4 0x8B52
17#define GL_INT_VEC2 0x8B53
18#define GL_INT_VEC3 0x8B54
19#define GL_INT_VEC4 0x8B55
22#define GL_TEXTURE0 0x84C0
23#define GL_TEXTURE1 0x84C1
24#define GL_TEXTURE2 0x84C2
25#define GL_TEXTURE3 0x84C3
26#define GL_TEXTURE4 0x84C4
27#define GL_TEXTURE5 0x84C5
28#define GL_TEXTURE6 0x84C6
29#define GL_TEXTURE7 0x84C7
30#define GL_TEXTURE8 0x84C8
31#define GL_TEXTURE9 0x84C9
32#define GL_TEXTURE10 0x84CA
33#define GL_TEXTURE11 0x84CB
34#define GL_TEXTURE12 0x84CC
35#define GL_TEXTURE13 0x84CD
36#define GL_TEXTURE14 0x84CE
37#define GL_TEXTURE15 0x84CF
38#define GL_TEXTURE16 0x84D0
39#define GL_TEXTURE17 0x84D1
40#define GL_TEXTURE18 0x84D2
41#define GL_TEXTURE19 0x84D3
42#define GL_TEXTURE20 0x84D4
43#define GL_TEXTURE21 0x84D5
44#define GL_TEXTURE22 0x84D6
45#define GL_TEXTURE23 0x84D7
46#define GL_TEXTURE24 0x84D8
47#define GL_TEXTURE25 0x84D9
48#define GL_TEXTURE26 0x84DA
49#define GL_TEXTURE27 0x84DB
50#define GL_TEXTURE28 0x84DC
51#define GL_TEXTURE29 0x84DD
52#define GL_TEXTURE30 0x84DE
53#define GL_TEXTURE31 0x84DF
54#define GL_ACTIVE_TEXTURE 0x84E0
55#define GL_TEXTURE_2D_ARRAY 0x8C1A
58#define GL_ARRAY_BUFFER 0x8892
59#define GL_ELEMENT_ARRAY_BUFFER 0x8893
60#define GL_ARRAY_BUFFER_BINDING 0x8894
61#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895
62#define GL_UNIFORM_BUFFER 0x8A11
63#define GL_ACTIVE_ATTRIBUTES 0x8B89
65#define GL_STREAM_DRAW 0x88E0
66#define GL_STATIC_DRAW 0x88E4
67#define GL_DYNAMIC_DRAW 0x88E8
69#define GL_FRAMEBUFFER 0x8D40
70#define GL_RENDERBUFFER 0x8D41
71#define GL_FRAMEBUFFER_BINDING 0x8CA6
72#define GL_DRAW_FRAMEBUFFER 0x8CA9
73#define GL_FRAMEBUFFER_COMPLETE 0x8CD5
74#define GL_COLOR_ATTACHMENT0 0x8CE0
75#define GL_DEPTH_ATTACHMENT 0x8D00
76#define GL_STENCIL_ATTACHMENT 0x8D20
77#define GL_DEPTH_STENCIL_ATTACHMENT 0x821A
78#define GL_DEPTH_STENCIL 0x84F9
79#define GL_UNSIGNED_INT_24_8 0x84FA
80#define GL_DEPTH24_STENCIL8 0x88F0
81#define GL_DEPTH_COMPONENT 0x1902
82#define GL_DEPTH_COMPONENT16 0x81A5
83#define GL_DEPTH_COMPONENT24 0x81A6
84#define GL_DEPTH_COMPONENT32F 0x8CAC
85#define GL_TEXTURE_COMPARE_MODE 0x884C
86#define GL_TEXTURE_COMPARE_FUNC 0x884D
87#define GL_COMPARE_REF_TO_TEXTURE 0x884E
89#define GL_RGBA32F 0x8814
90#define GL_RGBA16F 0x881A
91#define GL_HALF_FLOAT 0x140B
94typedef signed long int khronos_ssize_t;
95typedef khronos_ssize_t GLsizeiptr;
96typedef signed long int khronos_intptr_t;
97typedef khronos_intptr_t GLintptr;
99inline void glOrtho(GLfloat _Left, GLfloat _Right, GLfloat _Bottom,
100 GLfloat _Top, GLfloat _zNear, GLfloat _zFar)
102 glOrtho((GLdouble)_Left, (GLdouble)_Right, (GLdouble)_Bottom, (GLdouble)_Top,
103 (GLdouble)_zNear, (GLdouble)_zFar);
107inline TCall GetProcAddress(LPSTR _Name)
109 auto Result = wglGetProcAddress(_Name);
110 if (Result ==
nullptr) throw ::std::exception{ _Name };
112 return reinterpret_cast<TCall
>(Result);
115inline GLuint glCreateShader(GLenum shaderType)
117 using Call_t = GLuint(*)(GLenum);
118 static auto glCall = GetProcAddress<Call_t>(
"glCreateShader");
120 return glCall(shaderType);
123inline void glShaderSource(GLuint shader, GLsizei count,
const GLchar **
string,
124 const GLint * length)
126 using Call_t = void(*)(GLuint, GLsizei,
const GLchar **,
const GLint *);
127 static auto glCall = GetProcAddress<Call_t>(
"glShaderSource");
129 glCall(shader, count,
string, length);
132inline void glCompileShader(GLuint shader)
134 using Call_t = void(*)(GLuint);
135 static auto glCall = GetProcAddress<Call_t>(
"glCompileShader");
140inline void glGetShaderiv(GLuint shader, GLenum pname, GLint *params)
142 using Call_t = void(*)(GLuint, GLenum, GLint *);
143 static auto glCall = GetProcAddress<Call_t>(
"glGetShaderiv");
145 glCall(shader, pname, params);
148inline void glGetShaderInfoLog(GLuint shader, GLsizei maxLength,
149 GLsizei *length, GLchar *infoLog)
151 using Call_t = void(*)(GLuint, GLsizei, GLsizei *, GLchar *);
152 static auto glCall = GetProcAddress<Call_t>(
"glGetShaderInfoLog");
154 glCall(shader, maxLength, length, infoLog);
157inline void glDeleteShader(GLuint shader)
159 using Call_t = void(*)(GLuint);
160 static auto glCall = GetProcAddress<Call_t>(
"glDeleteShader");
165inline GLuint glCreateProgram(
void)
167 using Call_t = GLuint(*)(void);
168 static auto glCall = GetProcAddress<Call_t>(
"glCreateProgram");
173inline void glDeleteProgram(GLuint program)
175 using Call_t = void(*)(GLuint);
176 static auto glCall = GetProcAddress<Call_t>(
"glDeleteProgram");
181inline void glAttachShader(GLuint program, GLuint shader)
183 using Call_t = void(*)(GLuint, GLuint);
184 static auto glCall = GetProcAddress<Call_t>(
"glAttachShader");
186 glCall(program, shader);
189inline void glLinkProgram(GLuint program)
191 using Call_t = void(*)(GLuint);
192 static auto glCall = GetProcAddress<Call_t>(
"glLinkProgram");
197inline void glGetProgramiv(GLuint program, GLenum pname, GLint *params)
199 using Call_t = void(*)(GLuint, GLenum, GLint *);
200 static auto glCall = GetProcAddress<Call_t>(
"glGetProgramiv");
202 glCall(program, pname, params);
205inline void glGetProgramInfoLog(GLuint program, GLsizei maxLength,
206 GLsizei *length, GLchar *infoLog)
208 using Call_t = void(*)(GLuint, GLsizei, GLsizei *, GLchar *);
209 static auto glCall = GetProcAddress<Call_t>(
"glGetProgramInfoLog");
211 glCall(program, maxLength, length, infoLog);
214inline void glUseProgram(GLuint program)
216 using Call_t = void(*)(GLuint);
217 static auto glCall = GetProcAddress<Call_t>(
"glUseProgram");
222inline void glActiveTexture(GLenum texture)
224 using Call_t = void(*)(GLenum);
225 static auto glCall = GetProcAddress<Call_t>(
"glActiveTexture");
230inline void glTexStorage3D(GLenum target, GLsizei levels, GLenum internalformat,
231 GLsizei width, GLsizei height, GLsizei depth)
233 using Call_t = void(*)(GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLsizei);
234 static auto glCall = GetProcAddress<Call_t>(
"glTexStorage3D");
236 glCall(target, levels, internalformat, width, height, depth);
239inline void glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
240 GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format,
241 GLenum type,
const void * pixels)
243 using Call_t = void(*)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum,
const void *);
244 static auto glCall = GetProcAddress<Call_t>(
"glTexSubImage3D");
246 glCall(target, level, xoffset, yoffset, zoffset, width, height, depth, format,
250inline void glBindBuffer(GLenum target, GLuint buffer)
252 using Call_t = void(*)(GLenum, GLuint);
253 static auto glCall = GetProcAddress<Call_t>(
"glBindBuffer");
255 glCall(target, buffer);
258inline void glBindBufferBase(GLenum target, GLuint index, GLuint buffer)
260 using Call_t = void(*)(GLenum, GLuint, GLuint);
261 static auto glCall = GetProcAddress<Call_t>(
"glBindBufferBase");
263 glCall(target, index, buffer);
266inline void glGenBuffers(GLsizei n, GLuint * buffers)
268 using Call_t = void(*)(GLsizei, GLuint *);
269 static auto glCall = GetProcAddress<Call_t>(
"glGenBuffers");
274inline void glDeleteBuffers(GLsizei n,
const GLuint * buffers)
276 using Call_t = void(*)(GLsizei,
const GLuint *);
277 static auto glCall = GetProcAddress<Call_t>(
"glDeleteBuffers");
282inline void glBufferData(GLenum target, GLsizeiptr size,
const GLvoid * data,
285 using Call_t = void(*)(GLenum, GLsizeiptr,
const GLvoid *, GLenum);
286 static auto glCall = GetProcAddress<Call_t>(
"glBufferData");
288 glCall(target, size, data, usage);
291inline void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size,
294 using Call_t = void(*)(GLenum, GLintptr, GLsizeiptr,
const GLvoid *);
295 static auto glCall = GetProcAddress<Call_t>(
"glBufferSubData");
297 glCall(target, offset, size, data);
300inline GLint glGetAttribLocation(GLuint program,
const GLchar *name)
302 using Call_t = GLint(*)(GLuint,
const GLchar *);
303 static auto glCall = GetProcAddress<Call_t>(
"glGetAttribLocation");
305 return glCall(program, name);
308inline void glVertexAttribPointer(GLuint index, GLint size, GLenum type,
309 GLboolean normalized, GLsizei stride,
const GLvoid * pointer)
311 using Call_t = void(*)(GLuint, GLint, GLenum, GLboolean, GLsizei,
const GLvoid *);
312 static auto glCall = GetProcAddress<Call_t>(
"glVertexAttribPointer");
314 glCall(index, size, type, normalized, stride, pointer);
317inline void glEnableVertexAttribArray(GLuint index)
319 using Call_t = void(*)(GLuint);
320 static auto glCall = GetProcAddress<Call_t>(
"glEnableVertexAttribArray");
325inline GLint glGetUniformLocation(GLuint program,
const GLchar *name)
327 using Call_t = GLint(*)(GLuint,
const GLchar *);
328 static auto glCall = GetProcAddress<Call_t>(
"glGetUniformLocation");
330 return glCall(program, name);
333inline void glUniform1i(GLint location, GLint v0)
335 using Call_t = void(*)(GLint, GLint);
336 static auto glCall = GetProcAddress<Call_t>(
"glUniform1i");
338 glCall(location, v0);
341inline void glUniform1f(GLint location, GLfloat x)
343 using Call_t = void(*)(GLint, GLfloat);
344 static auto glCall = GetProcAddress<Call_t>(
"glUniform1f");
349inline void glUniform4fv(GLint location, GLsizei count,
const GLfloat *value)
351 using Call_t = void(*)(GLint, GLsizei,
const GLfloat *);
352 static auto glCall = GetProcAddress<Call_t>(
"glUniform4fv");
354 glCall(location, count, value);
357inline void glUniformMatrix4fv(GLint location, GLsizei count,
358 GLboolean transpose,
const GLfloat *value)
360 using Call_t = void(*)(GLint, GLsizei, GLboolean,
const GLfloat *);
361 static auto glCall = GetProcAddress<Call_t>(
"glUniformMatrix4fv");
363 glCall(location, count, transpose, value);
366inline GLuint glGetUniformBlockIndex(GLuint program,
const GLchar *uniformBlockName)
368 using Call_t = GLuint(*)(GLuint,
const GLchar *);
369 static auto glCall = GetProcAddress<Call_t>(
"glGetUniformBlockIndex");
371 return glCall(program, uniformBlockName);
374inline void glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex,
375 GLuint uniformBlockBinding)
377 using Call_t = void(*)(GLuint, GLuint, GLuint);
378 static auto glCall = GetProcAddress<Call_t>(
"glUniformBlockBinding");
380 glCall(program, uniformBlockIndex, uniformBlockBinding);
383inline const GLubyte * glGetStringi(GLenum name, GLuint index)
385 using Call_t =
const GLubyte *(*)(GLenum, GLuint);
386 static auto glCall = GetProcAddress<Call_t>(
"glGetStringi");
388 return glCall(name, index);
391inline void glDrawArraysInstanced(GLenum mode, GLint first, GLsizei count,
392 GLsizei instancecount)
394 using Call_t = void(*)(GLenum, GLint, GLsizei, GLsizei);
395 static auto glCall = GetProcAddress<Call_t>(
"glDrawArraysInstanced");
397 glCall(mode, first, count, instancecount);
400inline void glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type,
401 const void * indices, GLsizei instancecount)
403 using Call_t = void(*)(GLenum, GLsizei, GLenum,
const void *, GLsizei);
404 static auto glCall = GetProcAddress<Call_t>(
"glDrawElementsInstanced");
406 glCall(mode, count, type, indices, instancecount);
409inline void glVertexAttribDivisor(GLuint index, GLuint divisor)
411 using Call_t = void(*)(GLuint, GLuint);
412 static auto glCall = GetProcAddress<Call_t>(
"glVertexAttribDivisor");
414 glCall(index, divisor);
417inline void glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufSize,
418 GLsizei *length, GLint *size, GLenum *type, GLchar *name)
420 using Call_t = void(*)(GLuint, GLuint, GLsizei, GLsizei *, GLint *,
422 static auto glCall = GetProcAddress<Call_t>(
"glGetActiveAttrib");
424 glCall(program, index, bufSize, length, size, type, name);
427inline void glGenFramebuffers(GLsizei n, GLuint *ids)
429 using Call_t = void(*)(GLsizei, GLuint *);
430 static auto glCall = GetProcAddress<Call_t>(
"glGenFramebuffers");
435inline void glBindFramebuffer(GLenum target, GLuint framebuffer)
437 using Call_t = void(*)(GLenum, GLuint);
438 static auto glCall = GetProcAddress<Call_t>(
"glBindFramebuffer");
440 glCall(target, framebuffer);
443inline GLenum glCheckFramebufferStatus(GLenum target)
445 using Call_t = GLenum(*)(GLenum);
446 static auto glCall = GetProcAddress<Call_t>(
"glCheckFramebufferStatus");
448 return glCall(target);
451inline void glDeleteFramebuffers(GLsizei n,
const GLuint * framebuffers)
453 using Call_t = void(*)(GLsizei,
const GLuint *);
454 static auto glCall = GetProcAddress<Call_t>(
"glDeleteFramebuffers");
456 glCall(n, framebuffers);
459inline void glFramebufferTexture2D(GLenum target, GLenum attachment,
460 GLenum textarget, GLuint texture, GLint level)
462 using Call_t = void(*)(GLenum, GLenum, GLenum, GLuint, GLint);
463 static auto glCall = GetProcAddress<Call_t>(
"glFramebufferTexture2D");
465 glCall(target, attachment, textarget, texture, level);
468inline void glDepthRangef(GLfloat n, GLfloat f)
470 using Call_t = void(*)(GLfloat, GLfloat);
471 static auto glCall = GetProcAddress<Call_t>(
"glDepthRangef");
476inline void glDrawBuffers(GLsizei n,
const GLenum *bufs)
478 using Call_t = void(*)(GLsizei,
const GLenum *);
479 static auto glCall = GetProcAddress<Call_t>(
"glDrawBuffers");
484inline void glGenerateMipmap(GLenum target)
486 using Call_t = void(*)(GLenum);
487 static auto glCall = GetProcAddress<Call_t>(
"glGenerateMipmap");
492#define GL_DEBUG_OUTPUT_SYNCHRONOUS 0x8242
493#define GL_DEBUG_OUTPUT 0x92E0
495#define GL_DEBUG_TYPE_ERROR 0x824C
496#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR 0x824D
497#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR 0x824E
498#define GL_DEBUG_TYPE_PORTABILITY 0x824F
499#define GL_DEBUG_TYPE_PERFORMANCE 0x8250
500#define GL_DEBUG_TYPE_OTHER 0x8251
501#define GL_DEBUG_TYPE_MARKER 0x8268
502#define GL_DEBUG_TYPE_PUSH_GROUP 0x8269
503#define GL_DEBUG_TYPE_POP_GROUP 0x826A
505#define GL_DEBUG_SEVERITY_HIGH 0x9146
506#define GL_DEBUG_SEVERITY_MEDIUM 0x9147
507#define GL_DEBUG_SEVERITY_LOW 0x9148
508#define GL_DEBUG_SEVERITY_NOTIFICATION 0x826B
510typedef void (APIENTRY * DEBUGPROC)(GLenum source, GLenum type, GLuint id,
511 GLenum severity, GLsizei length,
const GLchar *message,
const void *userParam);
513inline void glDebugMessageCallback(DEBUGPROC callback,
const void * userParam)
515 using Call_t = void(*)(DEBUGPROC,
const void *);
516 static auto glCall = GetProcAddress<Call_t>(
"glDebugMessageCallback");
518 glCall(callback, userParam);
521inline void glDebugMessageControl(GLenum source, GLenum type, GLenum severity,
522 GLsizei count,
const GLuint *ids, GLboolean enabled)
524 using Call_t = void(*)(GLenum, GLenum, GLenum, GLsizei,
const GLuint *, GLboolean);
525 static auto glCall = GetProcAddress<Call_t>(
"glDebugMessageControl");
527 glCall(source, type, severity, count, ids, enabled);