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
57#define GL_ARRAY_BUFFER 0x8892
58#define GL_ELEMENT_ARRAY_BUFFER 0x8893
59#define GL_ARRAY_BUFFER_BINDING 0x8894
60#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895
61#define GL_UNIFORM_BUFFER 0x8A11
62#define GL_ACTIVE_ATTRIBUTES 0x8B89
64#define GL_STREAM_DRAW 0x88E0
65#define GL_STATIC_DRAW 0x88E4
66#define GL_DYNAMIC_DRAW 0x88E8
68#define GL_FRAMEBUFFER 0x8D40
69#define GL_RENDERBUFFER 0x8D41
70#define GL_FRAMEBUFFER_BINDING 0x8CA6
71#define GL_DRAW_FRAMEBUFFER 0x8CA9
72#define GL_FRAMEBUFFER_COMPLETE 0x8CD5
73#define GL_COLOR_ATTACHMENT0 0x8CE0
74#define GL_DEPTH_ATTACHMENT 0x8D00
75#define GL_STENCIL_ATTACHMENT 0x8D20
76#define GL_DEPTH_STENCIL_ATTACHMENT 0x821A
77#define GL_DEPTH_STENCIL 0x84F9
78#define GL_UNSIGNED_INT_24_8 0x84FA
79#define GL_DEPTH24_STENCIL8 0x88F0
80#define GL_DEPTH_COMPONENT 0x1902
81#define GL_DEPTH_COMPONENT16 0x81A5
82#define GL_DEPTH_COMPONENT24 0x81A6
83#define GL_DEPTH_COMPONENT32F 0x8CAC
84#define GL_TEXTURE_COMPARE_MODE 0x884C
85#define GL_TEXTURE_COMPARE_FUNC 0x884D
86#define GL_COMPARE_REF_TO_TEXTURE 0x884E
88#define GL_RGBA32F 0x8814
89#define GL_RGBA16F 0x881A
90#define GL_HALF_FLOAT 0x140B
93typedef signed long int khronos_ssize_t;
94typedef khronos_ssize_t GLsizeiptr;
95typedef signed long int khronos_intptr_t;
96typedef khronos_intptr_t GLintptr;
98inline void glOrtho(GLfloat _Left, GLfloat _Right, GLfloat _Bottom,
99 GLfloat _Top, GLfloat _zNear, GLfloat _zFar)
101 glOrtho((GLdouble)_Left, (GLdouble)_Right, (GLdouble)_Bottom, (GLdouble)_Top,
102 (GLdouble)_zNear, (GLdouble)_zFar);
106inline TCall GetProcAddress(LPSTR _Name)
108 auto Result = wglGetProcAddress(_Name);
109 if (Result ==
nullptr) throw ::std::exception{ _Name };
111 return reinterpret_cast<TCall
>(Result);
114inline GLuint glCreateShader(GLenum shaderType)
116 using Call_t = GLuint(*)(GLenum);
117 static auto glCall = GetProcAddress<Call_t>(
"glCreateShader");
119 return glCall(shaderType);
122inline void glShaderSource(GLuint shader, GLsizei count,
const GLchar **
string,
123 const GLint * length)
125 using Call_t = void(*)(GLuint, GLsizei,
const GLchar **,
const GLint *);
126 static auto glCall = GetProcAddress<Call_t>(
"glShaderSource");
128 glCall(shader, count,
string, length);
131inline void glCompileShader(GLuint shader)
133 using Call_t = void(*)(GLuint);
134 static auto glCall = GetProcAddress<Call_t>(
"glCompileShader");
139inline void glGetShaderiv(GLuint shader, GLenum pname, GLint *params)
141 using Call_t = void(*)(GLuint, GLenum, GLint *);
142 static auto glCall = GetProcAddress<Call_t>(
"glGetShaderiv");
144 glCall(shader, pname, params);
147inline void glGetShaderInfoLog(GLuint shader, GLsizei maxLength,
148 GLsizei *length, GLchar *infoLog)
150 using Call_t = void(*)(GLuint, GLsizei, GLsizei *, GLchar *);
151 static auto glCall = GetProcAddress<Call_t>(
"glGetShaderInfoLog");
153 glCall(shader, maxLength, length, infoLog);
156inline void glDeleteShader(GLuint shader)
158 using Call_t = void(*)(GLuint);
159 static auto glCall = GetProcAddress<Call_t>(
"glDeleteShader");
164inline GLuint glCreateProgram(
void)
166 using Call_t = GLuint(*)(void);
167 static auto glCall = GetProcAddress<Call_t>(
"glCreateProgram");
172inline void glDeleteProgram(GLuint program)
174 using Call_t = void(*)(GLuint);
175 static auto glCall = GetProcAddress<Call_t>(
"glDeleteProgram");
180inline void glAttachShader(GLuint program, GLuint shader)
182 using Call_t = void(*)(GLuint, GLuint);
183 static auto glCall = GetProcAddress<Call_t>(
"glAttachShader");
185 glCall(program, shader);
188inline void glLinkProgram(GLuint program)
190 using Call_t = void(*)(GLuint);
191 static auto glCall = GetProcAddress<Call_t>(
"glLinkProgram");
196inline void glGetProgramiv(GLuint program, GLenum pname, GLint *params)
198 using Call_t = void(*)(GLuint, GLenum, GLint *);
199 static auto glCall = GetProcAddress<Call_t>(
"glGetProgramiv");
201 glCall(program, pname, params);
204inline void glGetProgramInfoLog(GLuint program, GLsizei maxLength,
205 GLsizei *length, GLchar *infoLog)
207 using Call_t = void(*)(GLuint, GLsizei, GLsizei *, GLchar *);
208 static auto glCall = GetProcAddress<Call_t>(
"glGetProgramInfoLog");
210 glCall(program, maxLength, length, infoLog);
213inline void glUseProgram(GLuint program)
215 using Call_t = void(*)(GLuint);
216 static auto glCall = GetProcAddress<Call_t>(
"glUseProgram");
221inline void glActiveTexture(GLenum texture)
223 using Call_t = void(*)(GLenum);
224 static auto glCall = GetProcAddress<Call_t>(
"glActiveTexture");
229inline void glBindBuffer(GLenum target, GLuint buffer)
231 using Call_t = void(*)(GLenum, GLuint);
232 static auto glCall = GetProcAddress<Call_t>(
"glBindBuffer");
234 glCall(target, buffer);
237inline void glBindBufferBase(GLenum target, GLuint index, GLuint buffer)
239 using Call_t = void(*)(GLenum, GLuint, GLuint);
240 static auto glCall = GetProcAddress<Call_t>(
"glBindBufferBase");
242 glCall(target, index, buffer);
245inline void glGenBuffers(GLsizei n, GLuint * buffers)
247 using Call_t = void(*)(GLsizei, GLuint *);
248 static auto glCall = GetProcAddress<Call_t>(
"glGenBuffers");
253inline void glDeleteBuffers(GLsizei n,
const GLuint * buffers)
255 using Call_t = void(*)(GLsizei,
const GLuint *);
256 static auto glCall = GetProcAddress<Call_t>(
"glDeleteBuffers");
261inline void glBufferData(GLenum target, GLsizeiptr size,
const GLvoid * data,
264 using Call_t = void(*)(GLenum, GLsizeiptr,
const GLvoid *, GLenum);
265 static auto glCall = GetProcAddress<Call_t>(
"glBufferData");
267 glCall(target, size, data, usage);
270inline void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size,
273 using Call_t = void(*)(GLenum, GLintptr, GLsizeiptr,
const GLvoid *);
274 static auto glCall = GetProcAddress<Call_t>(
"glBufferSubData");
276 glCall(target, offset, size, data);
279inline GLint glGetAttribLocation(GLuint program,
const GLchar *name)
281 using Call_t = GLint(*)(GLuint,
const GLchar *);
282 static auto glCall = GetProcAddress<Call_t>(
"glGetAttribLocation");
284 return glCall(program, name);
287inline void glVertexAttribPointer(GLuint index, GLint size, GLenum type,
288 GLboolean normalized, GLsizei stride,
const GLvoid * pointer)
290 using Call_t = void(*)(GLuint, GLint, GLenum, GLboolean, GLsizei,
const GLvoid *);
291 static auto glCall = GetProcAddress<Call_t>(
"glVertexAttribPointer");
293 glCall(index, size, type, normalized, stride, pointer);
296inline void glEnableVertexAttribArray(GLuint index)
298 using Call_t = void(*)(GLuint);
299 static auto glCall = GetProcAddress<Call_t>(
"glEnableVertexAttribArray");
304inline GLint glGetUniformLocation(GLuint program,
const GLchar *name)
306 using Call_t = GLint(*)(GLuint,
const GLchar *);
307 static auto glCall = GetProcAddress<Call_t>(
"glGetUniformLocation");
309 return glCall(program, name);
312inline void glUniform1i(GLint location, GLint v0)
314 using Call_t = void(*)(GLint, GLint);
315 static auto glCall = GetProcAddress<Call_t>(
"glUniform1i");
317 glCall(location, v0);
320inline void glUniform1f(GLint location, GLfloat x)
322 using Call_t = void(*)(GLint, GLfloat);
323 static auto glCall = GetProcAddress<Call_t>(
"glUniform1f");
328inline void glUniform4fv(GLint location, GLsizei count,
const GLfloat *value)
330 using Call_t = void(*)(GLint, GLsizei,
const GLfloat *);
331 static auto glCall = GetProcAddress<Call_t>(
"glUniform4fv");
333 glCall(location, count, value);
336inline void glUniformMatrix4fv(GLint location, GLsizei count,
337 GLboolean transpose,
const GLfloat *value)
339 using Call_t = void(*)(GLint, GLsizei, GLboolean,
const GLfloat *);
340 static auto glCall = GetProcAddress<Call_t>(
"glUniformMatrix4fv");
342 glCall(location, count, transpose, value);
345inline GLuint glGetUniformBlockIndex(GLuint program,
const GLchar *uniformBlockName)
347 using Call_t = GLuint(*)(GLuint,
const GLchar *);
348 static auto glCall = GetProcAddress<Call_t>(
"glGetUniformBlockIndex");
350 return glCall(program, uniformBlockName);
353inline void glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex,
354 GLuint uniformBlockBinding)
356 using Call_t = void(*)(GLuint, GLuint, GLuint);
357 static auto glCall = GetProcAddress<Call_t>(
"glUniformBlockBinding");
359 glCall(program, uniformBlockIndex, uniformBlockBinding);
362inline const GLubyte * glGetStringi(GLenum name, GLuint index)
364 using Call_t =
const GLubyte *(*)(GLenum, GLuint);
365 static auto glCall = GetProcAddress<Call_t>(
"glGetStringi");
367 return glCall(name, index);
370inline void glDrawArraysInstanced(GLenum mode, GLint first, GLsizei count,
371 GLsizei instancecount)
373 using Call_t = void(*)(GLenum, GLint, GLsizei, GLsizei);
374 static auto glCall = GetProcAddress<Call_t>(
"glDrawArraysInstanced");
376 glCall(mode, first, count, instancecount);
379inline void glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type,
380 const void * indices, GLsizei instancecount)
382 using Call_t = void(*)(GLenum, GLsizei, GLenum,
const void *, GLsizei);
383 static auto glCall = GetProcAddress<Call_t>(
"glDrawElementsInstanced");
385 glCall(mode, count, type, indices, instancecount);
388inline void glVertexAttribDivisor(GLuint index, GLuint divisor)
390 using Call_t = void(*)(GLuint, GLuint);
391 static auto glCall = GetProcAddress<Call_t>(
"glVertexAttribDivisor");
393 glCall(index, divisor);
396inline void glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufSize,
397 GLsizei *length, GLint *size, GLenum *type, GLchar *name)
399 using Call_t = void(*)(GLuint, GLuint, GLsizei, GLsizei *, GLint *,
401 static auto glCall = GetProcAddress<Call_t>(
"glGetActiveAttrib");
403 glCall(program, index, bufSize, length, size, type, name);
406inline void glGenFramebuffers(GLsizei n, GLuint *ids)
408 using Call_t = void(*)(GLsizei, GLuint *);
409 static auto glCall = GetProcAddress<Call_t>(
"glGenFramebuffers");
414inline void glBindFramebuffer(GLenum target, GLuint framebuffer)
416 using Call_t = void(*)(GLenum, GLuint);
417 static auto glCall = GetProcAddress<Call_t>(
"glBindFramebuffer");
419 glCall(target, framebuffer);
422inline GLenum glCheckFramebufferStatus(GLenum target)
424 using Call_t = GLenum(*)(GLenum);
425 static auto glCall = GetProcAddress<Call_t>(
"glCheckFramebufferStatus");
427 return glCall(target);
430inline void glDeleteFramebuffers(GLsizei n,
const GLuint * framebuffers)
432 using Call_t = void(*)(GLsizei,
const GLuint *);
433 static auto glCall = GetProcAddress<Call_t>(
"glDeleteFramebuffers");
435 glCall(n, framebuffers);
438inline void glFramebufferTexture2D(GLenum target, GLenum attachment,
439 GLenum textarget, GLuint texture, GLint level)
441 using Call_t = void(*)(GLenum, GLenum, GLenum, GLuint, GLint);
442 static auto glCall = GetProcAddress<Call_t>(
"glFramebufferTexture2D");
444 glCall(target, attachment, textarget, texture, level);
447inline void glDepthRangef(GLfloat n, GLfloat f)
449 using Call_t = void(*)(GLfloat, GLfloat);
450 static auto glCall = GetProcAddress<Call_t>(
"glDepthRangef");
455inline void glDrawBuffers(GLsizei n,
const GLenum *bufs)
457 using Call_t = void(*)(GLsizei,
const GLenum *);
458 static auto glCall = GetProcAddress<Call_t>(
"glDrawBuffers");
463inline void glGenerateMipmap(GLenum target)
465 using Call_t = void(*)(GLenum);
466 static auto glCall = GetProcAddress<Call_t>(
"glGenerateMipmap");
471#define GL_DEBUG_OUTPUT_SYNCHRONOUS 0x8242
472#define GL_DEBUG_OUTPUT 0x92E0
474#define GL_DEBUG_TYPE_ERROR 0x824C
475#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR 0x824D
476#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR 0x824E
477#define GL_DEBUG_TYPE_PORTABILITY 0x824F
478#define GL_DEBUG_TYPE_PERFORMANCE 0x8250
479#define GL_DEBUG_TYPE_OTHER 0x8251
480#define GL_DEBUG_TYPE_MARKER 0x8268
481#define GL_DEBUG_TYPE_PUSH_GROUP 0x8269
482#define GL_DEBUG_TYPE_POP_GROUP 0x826A
484#define GL_DEBUG_SEVERITY_HIGH 0x9146
485#define GL_DEBUG_SEVERITY_MEDIUM 0x9147
486#define GL_DEBUG_SEVERITY_LOW 0x9148
487#define GL_DEBUG_SEVERITY_NOTIFICATION 0x826B
489typedef void (APIENTRY * DEBUGPROC)(GLenum source, GLenum type, GLuint id,
490 GLenum severity, GLsizei length,
const GLchar *message,
const void *userParam);
492inline void glDebugMessageCallback(DEBUGPROC callback,
const void * userParam)
494 using Call_t = void(*)(DEBUGPROC,
const void *);
495 static auto glCall = GetProcAddress<Call_t>(
"glDebugMessageCallback");
497 glCall(callback, userParam);
500inline void glDebugMessageControl(GLenum source, GLenum type, GLenum severity,
501 GLsizei count,
const GLuint *ids, GLboolean enabled)
503 using Call_t = void(*)(GLenum, GLenum, GLenum, GLsizei,
const GLuint *, GLboolean);
504 static auto glCall = GetProcAddress<Call_t>(
"glDebugMessageControl");
506 glCall(source, type, severity, count, ids, enabled);