ScummVM API documentation
imgui_impl_opengl3_loader.h
1 //-----------------------------------------------------------------------------
2 // About imgui_impl_opengl3_loader.h:
3 //
4 // We embed our own OpenGL loader to not require user to provide their own or to have to use ours,
5 // which proved to be endless problems for users.
6 // Our loader is custom-generated, based on gl3w but automatically filtered to only include
7 // enums/functions that we use in our imgui_impl_opengl3.cpp source file in order to be small.
8 //
9 // YOU SHOULD NOT NEED TO INCLUDE/USE THIS DIRECTLY. THIS IS USED BY imgui_impl_opengl3.cpp ONLY.
10 // THE REST OF YOUR APP SHOULD USE A DIFFERENT GL LOADER: ANY GL LOADER OF YOUR CHOICE.
11 //
12 // IF YOU GET BUILD ERRORS IN THIS FILE (commonly macro redefinitions or function redefinitions):
13 // IT LIKELY MEANS THAT YOU ARE BUILDING 'imgui_impl_opengl3.cpp' OR INCLUDING 'imgui_impl_opengl3_loader.h'
14 // IN THE SAME COMPILATION UNIT AS ONE OF YOUR FILE WHICH IS USING A THIRD-PARTY OPENGL LOADER.
15 // (e.g. COULD HAPPEN IF YOU ARE DOING A UNITY/JUMBO BUILD, OR INCLUDING .CPP FILES FROM OTHERS)
16 // YOU SHOULD NOT BUILD BOTH IN THE SAME COMPILATION UNIT.
17 // BUT IF YOU REALLY WANT TO, you can '#define IMGUI_IMPL_OPENGL_LOADER_CUSTOM' and imgui_impl_opengl3.cpp
18 // WILL NOT BE USING OUR LOADER, AND INSTEAD EXPECT ANOTHER/YOUR LOADER TO BE AVAILABLE IN THE COMPILATION UNIT.
19 //
20 // Regenerate with:
21 // python3 gl3w_gen.py --output ../imgui/backends/imgui_impl_opengl3_loader.h --ref ../imgui/backends/imgui_impl_opengl3.cpp ./extra_symbols.txt
22 //
23 // More info:
24 // https://github.com/dearimgui/gl3w_stripped
25 // https://github.com/ocornut/imgui/issues/4445
26 //-----------------------------------------------------------------------------
27 
28 /*
29  * This file was generated with gl3w_gen.py, part of imgl3w
30  * (hosted at https://github.com/dearimgui/gl3w_stripped)
31  *
32  * This is free and unencumbered software released into the public domain.
33  *
34  * Anyone is free to copy, modify, publish, use, compile, sell, or
35  * distribute this software, either in source code form or as a compiled
36  * binary, for any purpose, commercial or non-commercial, and by any
37  * means.
38  *
39  * In jurisdictions that recognize copyright laws, the author or authors
40  * of this software dedicate any and all copyright interest in the
41  * software to the public domain. We make this dedication for the benefit
42  * of the public at large and to the detriment of our heirs and
43  * successors. We intend this dedication to be an overt act of
44  * relinquishment in perpetuity of all present and future rights to this
45  * software under copyright law.
46  *
47  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
48  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
49  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
50  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
51  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
52  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
53  * OTHER DEALINGS IN THE SOFTWARE.
54  */
55 
56 #ifndef __gl3w_h_
57 #define __gl3w_h_
58 
59 #if defined(IMGL3W_SCUMMVM_LOADER)
60 #define FORBIDDEN_SYMBOL_ALLOW_ALL
61 #include "common/system.h"
62 #endif
63 
64 // Adapted from KHR/khrplatform.h to avoid including entire file.
65 #ifndef __khrplatform_h_
66 typedef float khronos_float_t;
67 typedef signed char khronos_int8_t;
68 typedef unsigned char khronos_uint8_t;
69 typedef signed short int khronos_int16_t;
70 typedef unsigned short int khronos_uint16_t;
71 #ifdef _WIN64
72 typedef signed long long int khronos_intptr_t;
73 typedef signed long long int khronos_ssize_t;
74 #else
75 typedef signed long int khronos_intptr_t;
76 typedef signed long int khronos_ssize_t;
77 #endif
78 
79 #if defined(_MSC_VER) && !defined(__clang__)
80 typedef signed __int64 khronos_int64_t;
81 typedef unsigned __int64 khronos_uint64_t;
82 #elif (defined(__clang__) || defined(__GNUC__)) && (__cplusplus < 201100)
83 #include <stdint.h>
84 typedef int64_t khronos_int64_t;
85 typedef uint64_t khronos_uint64_t;
86 #else
87 typedef signed long long khronos_int64_t;
88 typedef unsigned long long khronos_uint64_t;
89 #endif
90 #endif // __khrplatform_h_
91 
92 #ifndef __gl_glcorearb_h_
93 #define __gl_glcorearb_h_ 1
94 #ifdef __cplusplus
95 extern "C" {
96 #endif
97 /*
98 ** Copyright 2013-2020 The Khronos Group Inc.
99 ** SPDX-License-Identifier: MIT
100 **
101 ** This header is generated from the Khronos OpenGL / OpenGL ES XML
102 ** API Registry. The current version of the Registry, generator scripts
103 ** used to make the header, and the header can be found at
104 ** https://github.com/KhronosGroup/OpenGL-Registry
105 */
106 #if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
107 #ifndef WIN32_LEAN_AND_MEAN
108 #define WIN32_LEAN_AND_MEAN 1
109 #endif
110 #include <windows.h>
111 #endif
112 #ifndef APIENTRY
113 #define APIENTRY
114 #endif
115 #ifndef APIENTRYP
116 #define APIENTRYP APIENTRY *
117 #endif
118 #ifndef GLAPI
119 #define GLAPI extern
120 #endif
121 /* glcorearb.h is for use with OpenGL core profile implementations.
122 ** It should should be placed in the same directory as gl.h and
123 ** included as <GL/glcorearb.h>.
124 **
125 ** glcorearb.h includes only APIs in the latest OpenGL core profile
126 ** implementation together with APIs in newer ARB extensions which
127 ** can be supported by the core profile. It does not, and never will
128 ** include functionality removed from the core profile, such as
129 ** fixed-function vertex and fragment processing.
130 **
131 ** Do not #include both <GL/glcorearb.h> and either of <GL/gl.h> or
132 ** <GL/glext.h> in the same source file.
133 */
134 /* Generated C header for:
135  * API: gl
136  * Profile: core
137  * Versions considered: .*
138  * Versions emitted: .*
139  * Default extensions included: glcore
140  * Additional extensions included: _nomatch_^
141  * Extensions removed: _nomatch_^
142  */
143 #ifndef GL_VERSION_1_0
144 typedef void GLvoid;
145 typedef unsigned int GLenum;
146 
147 typedef khronos_float_t GLfloat;
148 typedef int GLint;
149 typedef int GLsizei;
150 typedef unsigned int GLbitfield;
151 typedef double GLdouble;
152 typedef unsigned int GLuint;
153 typedef unsigned char GLboolean;
154 typedef khronos_uint8_t GLubyte;
155 #define GL_COLOR_BUFFER_BIT 0x00004000
156 #define GL_FALSE 0
157 #define GL_TRUE 1
158 #define GL_TRIANGLES 0x0004
159 #define GL_ONE 1
160 #define GL_SRC_ALPHA 0x0302
161 #define GL_ONE_MINUS_SRC_ALPHA 0x0303
162 #define GL_FRONT 0x0404
163 #define GL_BACK 0x0405
164 #define GL_FRONT_AND_BACK 0x0408
165 #define GL_POLYGON_MODE 0x0B40
166 #define GL_CULL_FACE 0x0B44
167 #define GL_DEPTH_TEST 0x0B71
168 #define GL_STENCIL_TEST 0x0B90
169 #define GL_VIEWPORT 0x0BA2
170 #define GL_BLEND 0x0BE2
171 #define GL_SCISSOR_BOX 0x0C10
172 #define GL_SCISSOR_TEST 0x0C11
173 #define GL_UNPACK_ROW_LENGTH 0x0CF2
174 #define GL_PACK_ALIGNMENT 0x0D05
175 #define GL_TEXTURE_2D 0x0DE1
176 #define GL_UNSIGNED_BYTE 0x1401
177 #define GL_UNSIGNED_SHORT 0x1403
178 #define GL_UNSIGNED_INT 0x1405
179 #define GL_FLOAT 0x1406
180 #define GL_RGBA 0x1908
181 #define GL_FILL 0x1B02
182 #define GL_VENDOR 0x1F00
183 #define GL_RENDERER 0x1F01
184 #define GL_VERSION 0x1F02
185 #define GL_EXTENSIONS 0x1F03
186 #define GL_LINEAR 0x2601
187 #define GL_TEXTURE_MAG_FILTER 0x2800
188 #define GL_TEXTURE_MIN_FILTER 0x2801
189 typedef void (APIENTRYP PFNGLPOLYGONMODEPROC) (GLenum face, GLenum mode);
190 typedef void (APIENTRYP PFNGLSCISSORPROC) (GLint x, GLint y, GLsizei width, GLsizei height);
191 typedef void (APIENTRYP PFNGLTEXPARAMETERIPROC) (GLenum target, GLenum pname, GLint param);
192 typedef void (APIENTRYP PFNGLTEXIMAGE2DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
193 typedef void (APIENTRYP PFNGLCLEARPROC) (GLbitfield mask);
194 typedef void (APIENTRYP PFNGLCLEARCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
195 typedef void (APIENTRYP PFNGLDISABLEPROC) (GLenum cap);
196 typedef void (APIENTRYP PFNGLENABLEPROC) (GLenum cap);
197 typedef void (APIENTRYP PFNGLFLUSHPROC) (void);
198 typedef void (APIENTRYP PFNGLPIXELSTOREIPROC) (GLenum pname, GLint param);
199 typedef void (APIENTRYP PFNGLREADPIXELSPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels);
200 typedef GLenum (APIENTRYP PFNGLGETERRORPROC) (void);
201 typedef void (APIENTRYP PFNGLGETINTEGERVPROC) (GLenum pname, GLint *data);
202 typedef const GLubyte *(APIENTRYP PFNGLGETSTRINGPROC) (GLenum name);
203 typedef GLboolean (APIENTRYP PFNGLISENABLEDPROC) (GLenum cap);
204 typedef void (APIENTRYP PFNGLVIEWPORTPROC) (GLint x, GLint y, GLsizei width, GLsizei height);
205 #ifdef GL_GLEXT_PROTOTYPES
206 GLAPI void APIENTRY glPolygonMode (GLenum face, GLenum mode);
207 GLAPI void APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height);
208 GLAPI void APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param);
209 GLAPI void APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
210 GLAPI void APIENTRY glClear (GLbitfield mask);
211 GLAPI void APIENTRY glClearColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
212 GLAPI void APIENTRY glDisable (GLenum cap);
213 GLAPI void APIENTRY glEnable (GLenum cap);
214 GLAPI void APIENTRY glFlush (void);
215 GLAPI void APIENTRY glPixelStorei (GLenum pname, GLint param);
216 GLAPI void APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels);
217 GLAPI GLenum APIENTRY glGetError (void);
218 GLAPI void APIENTRY glGetIntegerv (GLenum pname, GLint *data);
219 GLAPI const GLubyte *APIENTRY glGetString (GLenum name);
220 GLAPI GLboolean APIENTRY glIsEnabled (GLenum cap);
221 GLAPI void APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
222 #endif
223 #endif /* GL_VERSION_1_0 */
224 #ifndef GL_VERSION_1_1
225 typedef khronos_float_t GLclampf;
226 typedef double GLclampd;
227 #define GL_TEXTURE_BINDING_2D 0x8069
228 typedef void (APIENTRYP PFNGLDRAWELEMENTSPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices);
229 typedef void (APIENTRYP PFNGLBINDTEXTUREPROC) (GLenum target, GLuint texture);
230 typedef void (APIENTRYP PFNGLDELETETEXTURESPROC) (GLsizei n, const GLuint *textures);
231 typedef void (APIENTRYP PFNGLGENTEXTURESPROC) (GLsizei n, GLuint *textures);
232 #ifdef GL_GLEXT_PROTOTYPES
233 GLAPI void APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const void *indices);
234 GLAPI void APIENTRY glBindTexture (GLenum target, GLuint texture);
235 GLAPI void APIENTRY glDeleteTextures (GLsizei n, const GLuint *textures);
236 GLAPI void APIENTRY glGenTextures (GLsizei n, GLuint *textures);
237 #endif
238 #endif /* GL_VERSION_1_1 */
239 #ifndef GL_VERSION_1_3
240 #define GL_TEXTURE0 0x84C0
241 #define GL_ACTIVE_TEXTURE 0x84E0
242 typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture);
243 #ifdef GL_GLEXT_PROTOTYPES
244 GLAPI void APIENTRY glActiveTexture (GLenum texture);
245 #endif
246 #endif /* GL_VERSION_1_3 */
247 #ifndef GL_VERSION_1_4
248 #define GL_BLEND_DST_RGB 0x80C8
249 #define GL_BLEND_SRC_RGB 0x80C9
250 #define GL_BLEND_DST_ALPHA 0x80CA
251 #define GL_BLEND_SRC_ALPHA 0x80CB
252 #define GL_FUNC_ADD 0x8006
253 typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
254 typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode);
255 #ifdef GL_GLEXT_PROTOTYPES
256 GLAPI void APIENTRY glBlendFuncSeparate (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
257 GLAPI void APIENTRY glBlendEquation (GLenum mode);
258 #endif
259 #endif /* GL_VERSION_1_4 */
260 #ifndef GL_VERSION_1_5
261 typedef khronos_ssize_t GLsizeiptr;
262 typedef khronos_intptr_t GLintptr;
263 #define GL_ARRAY_BUFFER 0x8892
264 #define GL_ELEMENT_ARRAY_BUFFER 0x8893
265 #define GL_ARRAY_BUFFER_BINDING 0x8894
266 #define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895
267 #define GL_STREAM_DRAW 0x88E0
268 typedef void (APIENTRYP PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer);
269 typedef void (APIENTRYP PFNGLDELETEBUFFERSPROC) (GLsizei n, const GLuint *buffers);
270 typedef void (APIENTRYP PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers);
271 typedef void (APIENTRYP PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const void *data, GLenum usage);
272 typedef void (APIENTRYP PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
273 #ifdef GL_GLEXT_PROTOTYPES
274 GLAPI void APIENTRY glBindBuffer (GLenum target, GLuint buffer);
275 GLAPI void APIENTRY glDeleteBuffers (GLsizei n, const GLuint *buffers);
276 GLAPI void APIENTRY glGenBuffers (GLsizei n, GLuint *buffers);
277 GLAPI void APIENTRY glBufferData (GLenum target, GLsizeiptr size, const void *data, GLenum usage);
278 GLAPI void APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
279 #endif
280 #endif /* GL_VERSION_1_5 */
281 #ifndef GL_VERSION_2_0
282 typedef char GLchar;
283 typedef khronos_int16_t GLshort;
284 typedef khronos_int8_t GLbyte;
285 typedef khronos_uint16_t GLushort;
286 #define GL_BLEND_EQUATION_RGB 0x8009
287 #define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622
288 #define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623
289 #define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624
290 #define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625
291 #define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645
292 #define GL_BLEND_EQUATION_ALPHA 0x883D
293 #define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A
294 #define GL_FRAGMENT_SHADER 0x8B30
295 #define GL_VERTEX_SHADER 0x8B31
296 #define GL_COMPILE_STATUS 0x8B81
297 #define GL_LINK_STATUS 0x8B82
298 #define GL_INFO_LOG_LENGTH 0x8B84
299 #define GL_CURRENT_PROGRAM 0x8B8D
300 #define GL_UPPER_LEFT 0x8CA2
301 typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEPROC) (GLenum modeRGB, GLenum modeAlpha);
302 typedef void (APIENTRYP PFNGLATTACHSHADERPROC) (GLuint program, GLuint shader);
303 typedef void (APIENTRYP PFNGLCOMPILESHADERPROC) (GLuint shader);
304 typedef GLuint (APIENTRYP PFNGLCREATEPROGRAMPROC) (void);
305 typedef GLuint (APIENTRYP PFNGLCREATESHADERPROC) (GLenum type);
306 typedef void (APIENTRYP PFNGLDELETEPROGRAMPROC) (GLuint program);
307 typedef void (APIENTRYP PFNGLDELETESHADERPROC) (GLuint shader);
308 typedef void (APIENTRYP PFNGLDETACHSHADERPROC) (GLuint program, GLuint shader);
309 typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint index);
310 typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index);
311 typedef GLint (APIENTRYP PFNGLGETATTRIBLOCATIONPROC) (GLuint program, const GLchar *name);
312 typedef void (APIENTRYP PFNGLGETPROGRAMIVPROC) (GLuint program, GLenum pname, GLint *params);
313 typedef void (APIENTRYP PFNGLGETPROGRAMINFOLOGPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
314 typedef void (APIENTRYP PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint *params);
315 typedef void (APIENTRYP PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
316 typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const GLchar *name);
317 typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVPROC) (GLuint index, GLenum pname, GLint *params);
318 typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVPROC) (GLuint index, GLenum pname, void **pointer);
319 typedef GLboolean (APIENTRYP PFNGLISPROGRAMPROC) (GLuint program);
320 typedef void (APIENTRYP PFNGLLINKPROGRAMPROC) (GLuint program);
321 typedef void (APIENTRYP PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length);
322 typedef void (APIENTRYP PFNGLUSEPROGRAMPROC) (GLuint program);
323 typedef void (APIENTRYP PFNGLUNIFORM1IPROC) (GLint location, GLint v0);
324 typedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
325 typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
326 #ifdef GL_GLEXT_PROTOTYPES
327 GLAPI void APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha);
328 GLAPI void APIENTRY glAttachShader (GLuint program, GLuint shader);
329 GLAPI void APIENTRY glCompileShader (GLuint shader);
330 GLAPI GLuint APIENTRY glCreateProgram (void);
331 GLAPI GLuint APIENTRY glCreateShader (GLenum type);
332 GLAPI void APIENTRY glDeleteProgram (GLuint program);
333 GLAPI void APIENTRY glDeleteShader (GLuint shader);
334 GLAPI void APIENTRY glDetachShader (GLuint program, GLuint shader);
335 GLAPI void APIENTRY glDisableVertexAttribArray (GLuint index);
336 GLAPI void APIENTRY glEnableVertexAttribArray (GLuint index);
337 GLAPI GLint APIENTRY glGetAttribLocation (GLuint program, const GLchar *name);
338 GLAPI void APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint *params);
339 GLAPI void APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
340 GLAPI void APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint *params);
341 GLAPI void APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
342 GLAPI GLint APIENTRY glGetUniformLocation (GLuint program, const GLchar *name);
343 GLAPI void APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint *params);
344 GLAPI void APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, void **pointer);
345 GLAPI GLboolean APIENTRY glIsProgram (GLuint program);
346 GLAPI void APIENTRY glLinkProgram (GLuint program);
347 GLAPI void APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length);
348 GLAPI void APIENTRY glUseProgram (GLuint program);
349 GLAPI void APIENTRY glUniform1i (GLint location, GLint v0);
350 GLAPI void APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
351 GLAPI void APIENTRY glVertexAttribPointer (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
352 #endif
353 #endif /* GL_VERSION_2_0 */
354 #ifndef GL_VERSION_2_1
355 #define GL_PIXEL_UNPACK_BUFFER 0x88EC
356 #define GL_PIXEL_UNPACK_BUFFER_BINDING 0x88EF
357 #endif /* GL_VERSION_2_1 */
358 #ifndef GL_VERSION_3_0
359 typedef khronos_uint16_t GLhalf;
360 #define GL_MAJOR_VERSION 0x821B
361 #define GL_MINOR_VERSION 0x821C
362 #define GL_NUM_EXTENSIONS 0x821D
363 #define GL_FRAMEBUFFER_SRGB 0x8DB9
364 #define GL_VERTEX_ARRAY_BINDING 0x85B5
365 typedef void (APIENTRYP PFNGLGETBOOLEANI_VPROC) (GLenum target, GLuint index, GLboolean *data);
366 typedef void (APIENTRYP PFNGLGETINTEGERI_VPROC) (GLenum target, GLuint index, GLint *data);
367 typedef const GLubyte *(APIENTRYP PFNGLGETSTRINGIPROC) (GLenum name, GLuint index);
368 typedef void (APIENTRYP PFNGLBINDVERTEXARRAYPROC) (GLuint array);
369 typedef void (APIENTRYP PFNGLDELETEVERTEXARRAYSPROC) (GLsizei n, const GLuint *arrays);
370 typedef void (APIENTRYP PFNGLGENVERTEXARRAYSPROC) (GLsizei n, GLuint *arrays);
371 #ifdef GL_GLEXT_PROTOTYPES
372 GLAPI const GLubyte *APIENTRY glGetStringi (GLenum name, GLuint index);
373 GLAPI void APIENTRY glBindVertexArray (GLuint array);
374 GLAPI void APIENTRY glDeleteVertexArrays (GLsizei n, const GLuint *arrays);
375 GLAPI void APIENTRY glGenVertexArrays (GLsizei n, GLuint *arrays);
376 #endif
377 #endif /* GL_VERSION_3_0 */
378 #ifndef GL_VERSION_3_1
379 #define GL_VERSION_3_1 1
380 #define GL_PRIMITIVE_RESTART 0x8F9D
381 #endif /* GL_VERSION_3_1 */
382 #ifndef GL_VERSION_3_2
383 #define GL_VERSION_3_2 1
384 typedef struct __GLsync *GLsync;
385 typedef khronos_uint64_t GLuint64;
386 typedef khronos_int64_t GLint64;
387 #define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT 0x00000002
388 #define GL_CONTEXT_PROFILE_MASK 0x9126
389 typedef void (APIENTRYP PFNGLDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex);
390 typedef void (APIENTRYP PFNGLGETINTEGER64I_VPROC) (GLenum target, GLuint index, GLint64 *data);
391 #ifdef GL_GLEXT_PROTOTYPES
392 GLAPI void APIENTRY glDrawElementsBaseVertex (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex);
393 #endif
394 #endif /* GL_VERSION_3_2 */
395 #ifndef GL_VERSION_3_3
396 #define GL_VERSION_3_3 1
397 #define GL_SAMPLER_BINDING 0x8919
398 typedef void (APIENTRYP PFNGLBINDSAMPLERPROC) (GLuint unit, GLuint sampler);
399 #ifdef GL_GLEXT_PROTOTYPES
400 GLAPI void APIENTRY glBindSampler (GLuint unit, GLuint sampler);
401 #endif
402 #endif /* GL_VERSION_3_3 */
403 #ifndef GL_VERSION_4_1
404 typedef void (APIENTRYP PFNGLGETFLOATI_VPROC) (GLenum target, GLuint index, GLfloat *data);
405 typedef void (APIENTRYP PFNGLGETDOUBLEI_VPROC) (GLenum target, GLuint index, GLdouble *data);
406 #endif /* GL_VERSION_4_1 */
407 #ifndef GL_VERSION_4_3
408 typedef void (APIENTRY *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam);
409 #endif /* GL_VERSION_4_3 */
410 #ifndef GL_VERSION_4_5
411 #define GL_CLIP_ORIGIN 0x935C
412 typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKI_VPROC) (GLuint xfb, GLenum pname, GLuint index, GLint *param);
413 typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKI64_VPROC) (GLuint xfb, GLenum pname, GLuint index, GLint64 *param);
414 #endif /* GL_VERSION_4_5 */
415 #ifndef GL_ARB_bindless_texture
416 typedef khronos_uint64_t GLuint64EXT;
417 #endif /* GL_ARB_bindless_texture */
418 #ifndef GL_ARB_cl_event
419 struct _cl_context;
420 struct _cl_event;
421 #endif /* GL_ARB_cl_event */
422 #ifndef GL_ARB_clip_control
423 #define GL_ARB_clip_control 1
424 #endif /* GL_ARB_clip_control */
425 #ifndef GL_ARB_debug_output
426 typedef void (APIENTRY *GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam);
427 #endif /* GL_ARB_debug_output */
428 #ifndef GL_EXT_EGL_image_storage
429 typedef void *GLeglImageOES;
430 #endif /* GL_EXT_EGL_image_storage */
431 #ifndef GL_EXT_direct_state_access
432 typedef void (APIENTRYP PFNGLGETFLOATI_VEXTPROC) (GLenum pname, GLuint index, GLfloat *params);
433 typedef void (APIENTRYP PFNGLGETDOUBLEI_VEXTPROC) (GLenum pname, GLuint index, GLdouble *params);
434 typedef void (APIENTRYP PFNGLGETPOINTERI_VEXTPROC) (GLenum pname, GLuint index, void **params);
435 typedef void (APIENTRYP PFNGLGETVERTEXARRAYINTEGERI_VEXTPROC) (GLuint vaobj, GLuint index, GLenum pname, GLint *param);
436 typedef void (APIENTRYP PFNGLGETVERTEXARRAYPOINTERI_VEXTPROC) (GLuint vaobj, GLuint index, GLenum pname, void **param);
437 #endif /* GL_EXT_direct_state_access */
438 #ifndef GL_NV_draw_vulkan_image
439 typedef void (APIENTRY *GLVULKANPROCNV)(void);
440 #endif /* GL_NV_draw_vulkan_image */
441 #ifndef GL_NV_gpu_shader5
442 typedef khronos_int64_t GLint64EXT;
443 #endif /* GL_NV_gpu_shader5 */
444 #ifndef GL_NV_vertex_buffer_unified_memory
445 typedef void (APIENTRYP PFNGLGETINTEGERUI64I_VNVPROC) (GLenum value, GLuint index, GLuint64EXT *result);
446 #endif /* GL_NV_vertex_buffer_unified_memory */
447 #ifdef __cplusplus
448 }
449 #endif
450 #endif
451 
452 #ifndef GL3W_API
453 #define GL3W_API
454 #endif
455 
456 #ifndef __gl_h_
457 #define __gl_h_
458 #endif
459 
460 #ifdef __cplusplus
461 extern "C" {
462 #endif
463 
464 #define GL3W_OK 0
465 #define GL3W_ERROR_INIT -1
466 #define GL3W_ERROR_LIBRARY_OPEN -2
467 #define GL3W_ERROR_OPENGL_VERSION -3
468 
469 typedef void (*GL3WglProc)(void);
470 typedef GL3WglProc (*GL3WGetProcAddressProc)(const char *proc);
471 
472 /* gl3w api */
473 GL3W_API int imgl3wInit(void);
474 GL3W_API int imgl3wInit2(GL3WGetProcAddressProc proc);
475 GL3W_API int imgl3wIsSupported(int major, int minor);
476 GL3W_API GL3WglProc imgl3wGetProcAddress(const char *proc);
477 
478 /* gl3w internal state */
479 union ImGL3WProcs {
480  GL3WglProc ptr[59];
481  struct {
482  PFNGLACTIVETEXTUREPROC ActiveTexture;
483  PFNGLATTACHSHADERPROC AttachShader;
484  PFNGLBINDBUFFERPROC BindBuffer;
485  PFNGLBINDSAMPLERPROC BindSampler;
486  PFNGLBINDTEXTUREPROC BindTexture;
487  PFNGLBINDVERTEXARRAYPROC BindVertexArray;
488  PFNGLBLENDEQUATIONPROC BlendEquation;
489  PFNGLBLENDEQUATIONSEPARATEPROC BlendEquationSeparate;
490  PFNGLBLENDFUNCSEPARATEPROC BlendFuncSeparate;
491  PFNGLBUFFERDATAPROC BufferData;
492  PFNGLBUFFERSUBDATAPROC BufferSubData;
493  PFNGLCLEARPROC Clear;
494  PFNGLCLEARCOLORPROC ClearColor;
495  PFNGLCOMPILESHADERPROC CompileShader;
496  PFNGLCREATEPROGRAMPROC CreateProgram;
497  PFNGLCREATESHADERPROC CreateShader;
498  PFNGLDELETEBUFFERSPROC DeleteBuffers;
499  PFNGLDELETEPROGRAMPROC DeleteProgram;
500  PFNGLDELETESHADERPROC DeleteShader;
501  PFNGLDELETETEXTURESPROC DeleteTextures;
502  PFNGLDELETEVERTEXARRAYSPROC DeleteVertexArrays;
503  PFNGLDETACHSHADERPROC DetachShader;
504  PFNGLDISABLEPROC Disable;
505  PFNGLDISABLEVERTEXATTRIBARRAYPROC DisableVertexAttribArray;
506  PFNGLDRAWELEMENTSPROC DrawElements;
507  PFNGLDRAWELEMENTSBASEVERTEXPROC DrawElementsBaseVertex;
508  PFNGLENABLEPROC Enable;
509  PFNGLENABLEVERTEXATTRIBARRAYPROC EnableVertexAttribArray;
510  PFNGLFLUSHPROC Flush;
511  PFNGLGENBUFFERSPROC GenBuffers;
512  PFNGLGENTEXTURESPROC GenTextures;
513  PFNGLGENVERTEXARRAYSPROC GenVertexArrays;
514  PFNGLGETATTRIBLOCATIONPROC GetAttribLocation;
515  PFNGLGETERRORPROC GetError;
516  PFNGLGETINTEGERVPROC GetIntegerv;
517  PFNGLGETPROGRAMINFOLOGPROC GetProgramInfoLog;
518  PFNGLGETPROGRAMIVPROC GetProgramiv;
519  PFNGLGETSHADERINFOLOGPROC GetShaderInfoLog;
520  PFNGLGETSHADERIVPROC GetShaderiv;
521  PFNGLGETSTRINGPROC GetString;
522  PFNGLGETSTRINGIPROC GetStringi;
523  PFNGLGETUNIFORMLOCATIONPROC GetUniformLocation;
524  PFNGLGETVERTEXATTRIBPOINTERVPROC GetVertexAttribPointerv;
525  PFNGLGETVERTEXATTRIBIVPROC GetVertexAttribiv;
526  PFNGLISENABLEDPROC IsEnabled;
527  PFNGLISPROGRAMPROC IsProgram;
528  PFNGLLINKPROGRAMPROC LinkProgram;
529  PFNGLPIXELSTOREIPROC PixelStorei;
530  PFNGLPOLYGONMODEPROC PolygonMode;
531  PFNGLREADPIXELSPROC ReadPixels;
532  PFNGLSCISSORPROC Scissor;
533  PFNGLSHADERSOURCEPROC ShaderSource;
534  PFNGLTEXIMAGE2DPROC TexImage2D;
535  PFNGLTEXPARAMETERIPROC TexParameteri;
536  PFNGLUNIFORM1IPROC Uniform1i;
537  PFNGLUNIFORMMATRIX4FVPROC UniformMatrix4fv;
538  PFNGLUSEPROGRAMPROC UseProgram;
539  PFNGLVERTEXATTRIBPOINTERPROC VertexAttribPointer;
540  PFNGLVIEWPORTPROC Viewport;
541  } gl;
542 };
543 
544 GL3W_API extern union ImGL3WProcs imgl3wProcs;
545 
546 /* OpenGL functions */
547 #define glActiveTexture imgl3wProcs.gl.ActiveTexture
548 #define glAttachShader imgl3wProcs.gl.AttachShader
549 #define glBindBuffer imgl3wProcs.gl.BindBuffer
550 #define glBindSampler imgl3wProcs.gl.BindSampler
551 #define glBindTexture imgl3wProcs.gl.BindTexture
552 #define glBindVertexArray imgl3wProcs.gl.BindVertexArray
553 #define glBlendEquation imgl3wProcs.gl.BlendEquation
554 #define glBlendEquationSeparate imgl3wProcs.gl.BlendEquationSeparate
555 #define glBlendFuncSeparate imgl3wProcs.gl.BlendFuncSeparate
556 #define glBufferData imgl3wProcs.gl.BufferData
557 #define glBufferSubData imgl3wProcs.gl.BufferSubData
558 #define glClear imgl3wProcs.gl.Clear
559 #define glClearColor imgl3wProcs.gl.ClearColor
560 #define glCompileShader imgl3wProcs.gl.CompileShader
561 #define glCreateProgram imgl3wProcs.gl.CreateProgram
562 #define glCreateShader imgl3wProcs.gl.CreateShader
563 #define glDeleteBuffers imgl3wProcs.gl.DeleteBuffers
564 #define glDeleteProgram imgl3wProcs.gl.DeleteProgram
565 #define glDeleteShader imgl3wProcs.gl.DeleteShader
566 #define glDeleteTextures imgl3wProcs.gl.DeleteTextures
567 #define glDeleteVertexArrays imgl3wProcs.gl.DeleteVertexArrays
568 #define glDetachShader imgl3wProcs.gl.DetachShader
569 #define glDisable imgl3wProcs.gl.Disable
570 #define glDisableVertexAttribArray imgl3wProcs.gl.DisableVertexAttribArray
571 #define glDrawElements imgl3wProcs.gl.DrawElements
572 #define glDrawElementsBaseVertex imgl3wProcs.gl.DrawElementsBaseVertex
573 #define glEnable imgl3wProcs.gl.Enable
574 #define glEnableVertexAttribArray imgl3wProcs.gl.EnableVertexAttribArray
575 #define glFlush imgl3wProcs.gl.Flush
576 #define glGenBuffers imgl3wProcs.gl.GenBuffers
577 #define glGenTextures imgl3wProcs.gl.GenTextures
578 #define glGenVertexArrays imgl3wProcs.gl.GenVertexArrays
579 #define glGetAttribLocation imgl3wProcs.gl.GetAttribLocation
580 #define glGetError imgl3wProcs.gl.GetError
581 #define glGetIntegerv imgl3wProcs.gl.GetIntegerv
582 #define glGetProgramInfoLog imgl3wProcs.gl.GetProgramInfoLog
583 #define glGetProgramiv imgl3wProcs.gl.GetProgramiv
584 #define glGetShaderInfoLog imgl3wProcs.gl.GetShaderInfoLog
585 #define glGetShaderiv imgl3wProcs.gl.GetShaderiv
586 #define glGetString imgl3wProcs.gl.GetString
587 #define glGetStringi imgl3wProcs.gl.GetStringi
588 #define glGetUniformLocation imgl3wProcs.gl.GetUniformLocation
589 #define glGetVertexAttribPointerv imgl3wProcs.gl.GetVertexAttribPointerv
590 #define glGetVertexAttribiv imgl3wProcs.gl.GetVertexAttribiv
591 #define glIsEnabled imgl3wProcs.gl.IsEnabled
592 #define glIsProgram imgl3wProcs.gl.IsProgram
593 #define glLinkProgram imgl3wProcs.gl.LinkProgram
594 #define glPixelStorei imgl3wProcs.gl.PixelStorei
595 #define glPolygonMode imgl3wProcs.gl.PolygonMode
596 #define glReadPixels imgl3wProcs.gl.ReadPixels
597 #define glScissor imgl3wProcs.gl.Scissor
598 #define glShaderSource imgl3wProcs.gl.ShaderSource
599 #define glTexImage2D imgl3wProcs.gl.TexImage2D
600 #define glTexParameteri imgl3wProcs.gl.TexParameteri
601 #define glUniform1i imgl3wProcs.gl.Uniform1i
602 #define glUniformMatrix4fv imgl3wProcs.gl.UniformMatrix4fv
603 #define glUseProgram imgl3wProcs.gl.UseProgram
604 #define glVertexAttribPointer imgl3wProcs.gl.VertexAttribPointer
605 #define glViewport imgl3wProcs.gl.Viewport
606 
607 #ifdef __cplusplus
608 }
609 #endif
610 
611 #endif
612 
613 #ifdef IMGL3W_IMPL
614 #ifdef __cplusplus
615 extern "C" {
616 #endif
617 
618 #include <stdlib.h>
619 
620 #define GL3W_ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
621 
622 #if defined(IMGL3W_SCUMMVM_LOADER)
623 static int open_libgl(void)
624 {
625  return GL3W_OK;
626 }
627 
628 static void close_libgl(void) { }
629 
630 static GL3WglProc get_proc(const char *proc)
631 {
632  return (GL3WglProc)g_system->getOpenGLProcAddress(proc);
633 }
634 
635 #elif defined(_WIN32)
636 #ifndef WIN32_LEAN_AND_MEAN
637 #define WIN32_LEAN_AND_MEAN 1
638 #endif
639 #include <windows.h>
640 
641 static HMODULE libgl;
642 typedef PROC(__stdcall* GL3WglGetProcAddr)(LPCSTR);
643 static GL3WglGetProcAddr wgl_get_proc_address;
644 
645 static int open_libgl(void)
646 {
647  libgl = LoadLibraryA("opengl32.dll");
648  if (!libgl)
649  return GL3W_ERROR_LIBRARY_OPEN;
650  wgl_get_proc_address = (GL3WglGetProcAddr)GetProcAddress(libgl, "wglGetProcAddress");
651  return GL3W_OK;
652 }
653 
654 static void close_libgl(void) { FreeLibrary(libgl); }
655 static GL3WglProc get_proc(const char *proc)
656 {
657  GL3WglProc res;
658  res = (GL3WglProc)wgl_get_proc_address(proc);
659  if (!res)
660  res = (GL3WglProc)GetProcAddress(libgl, proc);
661  return res;
662 }
663 #elif defined(__APPLE__)
664 #include <dlfcn.h>
665 
666 static void *libgl;
667 static int open_libgl(void)
668 {
669  libgl = dlopen("/System/Library/Frameworks/OpenGL.framework/OpenGL", RTLD_LAZY | RTLD_LOCAL);
670  if (!libgl)
671  return GL3W_ERROR_LIBRARY_OPEN;
672  return GL3W_OK;
673 }
674 
675 static void close_libgl(void) { dlclose(libgl); }
676 
677 static GL3WglProc get_proc(const char *proc)
678 {
679  GL3WglProc res;
680  *(void **)(&res) = dlsym(libgl, proc);
681  return res;
682 }
683 #else
684 #include <dlfcn.h>
685 
686 static void* libgl; // OpenGL library
687 static void* libglx; // GLX library
688 static void* libegl; // EGL library
689 static GL3WGetProcAddressProc gl_get_proc_address;
690 
691 static void close_libgl(void)
692 {
693  if (libgl) {
694  dlclose(libgl);
695  libgl = NULL;
696  }
697  if (libegl) {
698  dlclose(libegl);
699  libegl = NULL;
700  }
701  if (libglx) {
702  dlclose(libglx);
703  libglx = NULL;
704  }
705 }
706 
707 static int is_library_loaded(const char* name, void** lib)
708 {
709  *lib = dlopen(name, RTLD_LAZY | RTLD_LOCAL | RTLD_NOLOAD);
710  return *lib != NULL;
711 }
712 
713 static int open_libs(void)
714 {
715  // On Linux we have two APIs to get process addresses: EGL and GLX.
716  // EGL is supported under both X11 and Wayland, whereas GLX is X11-specific.
717 
718  libgl = NULL;
719  libegl = NULL;
720  libglx = NULL;
721 
722  // First check what's already loaded, the windowing library might have
723  // already loaded either EGL or GLX and we want to use the same one.
724 
725  if (is_library_loaded("libEGL.so.1", &libegl) ||
726  is_library_loaded("libGLX.so.0", &libglx)) {
727  libgl = dlopen("libOpenGL.so.0", RTLD_LAZY | RTLD_LOCAL);
728  if (libgl)
729  return GL3W_OK;
730  else
731  close_libgl();
732  }
733 
734  if (is_library_loaded("libGL.so", &libgl))
735  return GL3W_OK;
736  if (is_library_loaded("libGL.so.1", &libgl))
737  return GL3W_OK;
738  if (is_library_loaded("libGL.so.3", &libgl))
739  return GL3W_OK;
740 
741  // Neither is already loaded, so we have to load one. Try EGL first
742  // because it is supported under both X11 and Wayland.
743 
744  // Load OpenGL + EGL
745  libgl = dlopen("libOpenGL.so.0", RTLD_LAZY | RTLD_LOCAL);
746  libegl = dlopen("libEGL.so.1", RTLD_LAZY | RTLD_LOCAL);
747  if (libgl && libegl)
748  return GL3W_OK;
749  else
750  close_libgl();
751 
752  // Fall back to legacy libGL, which includes GLX
753  // While most systems use libGL.so.1, NetBSD seems to use that libGL.so.3. See https://github.com/ocornut/imgui/issues/6983
754  libgl = dlopen("libGL.so", RTLD_LAZY | RTLD_LOCAL);
755  if (!libgl)
756  libgl = dlopen("libGL.so.1", RTLD_LAZY | RTLD_LOCAL);
757  if (!libgl)
758  libgl = dlopen("libGL.so.3", RTLD_LAZY | RTLD_LOCAL);
759 
760  if (libgl)
761  return GL3W_OK;
762 
763  return GL3W_ERROR_LIBRARY_OPEN;
764 }
765 
766 static int open_libgl(void)
767 {
768  int res = open_libs();
769  if (res)
770  return res;
771 
772  if (libegl)
773  *(void**)(&gl_get_proc_address) = dlsym(libegl, "eglGetProcAddress");
774  else if (libglx)
775  *(void**)(&gl_get_proc_address) = dlsym(libglx, "glXGetProcAddressARB");
776  else
777  *(void**)(&gl_get_proc_address) = dlsym(libgl, "glXGetProcAddressARB");
778 
779  if (!gl_get_proc_address) {
780  close_libgl();
781  return GL3W_ERROR_LIBRARY_OPEN;
782  }
783 
784  return GL3W_OK;
785 }
786 
787 static GL3WglProc get_proc(const char* proc)
788 {
789  GL3WglProc res = NULL;
790 
791  // Before EGL version 1.5, eglGetProcAddress doesn't support querying core
792  // functions and may return a dummy function if we try, so try to load the
793  // function from the GL library directly first.
794  if (libegl)
795  *(void**)(&res) = dlsym(libgl, proc);
796 
797  if (!res)
798  res = gl_get_proc_address(proc);
799 
800  if (!libegl && !res)
801  *(void**)(&res) = dlsym(libgl, proc);
802 
803  return res;
804 }
805 #endif
806 
807 static struct { int major, minor; } version;
808 
809 static int parse_version(void)
810 {
811  if (!glGetIntegerv)
812  return GL3W_ERROR_INIT;
813  glGetIntegerv(GL_MAJOR_VERSION, &version.major);
814  glGetIntegerv(GL_MINOR_VERSION, &version.minor);
815  if (version.major == 0 && version.minor == 0)
816  {
817  // Query GL_VERSION in desktop GL 2.x, the string will start with "<major>.<minor>"
818  if (const char* gl_version = (const char*)glGetString(GL_VERSION))
819  sscanf(gl_version, "%d.%d", &version.major, &version.minor);
820  }
821  if (version.major < 2)
822  return GL3W_ERROR_OPENGL_VERSION;
823  return GL3W_OK;
824 }
825 
826 static void load_procs(GL3WGetProcAddressProc proc);
827 
828 int imgl3wInit(void)
829 {
830  int res = open_libgl();
831  if (res)
832  return res;
833  atexit(close_libgl);
834  return imgl3wInit2(get_proc);
835 }
836 
837 int imgl3wInit2(GL3WGetProcAddressProc proc)
838 {
839  load_procs(proc);
840  return parse_version();
841 }
842 
843 int imgl3wIsSupported(int major, int minor)
844 {
845  if (major < 2)
846  return 0;
847  if (version.major == major)
848  return version.minor >= minor;
849  return version.major >= major;
850 }
851 
852 GL3WglProc imgl3wGetProcAddress(const char *proc) { return get_proc(proc); }
853 
854 static const char *proc_names[] = {
855  "glActiveTexture",
856  "glAttachShader",
857  "glBindBuffer",
858  "glBindSampler",
859  "glBindTexture",
860  "glBindVertexArray",
861  "glBlendEquation",
862  "glBlendEquationSeparate",
863  "glBlendFuncSeparate",
864  "glBufferData",
865  "glBufferSubData",
866  "glClear",
867  "glClearColor",
868  "glCompileShader",
869  "glCreateProgram",
870  "glCreateShader",
871  "glDeleteBuffers",
872  "glDeleteProgram",
873  "glDeleteShader",
874  "glDeleteTextures",
875  "glDeleteVertexArrays",
876  "glDetachShader",
877  "glDisable",
878  "glDisableVertexAttribArray",
879  "glDrawElements",
880  "glDrawElementsBaseVertex",
881  "glEnable",
882  "glEnableVertexAttribArray",
883  "glFlush",
884  "glGenBuffers",
885  "glGenTextures",
886  "glGenVertexArrays",
887  "glGetAttribLocation",
888  "glGetError",
889  "glGetIntegerv",
890  "glGetProgramInfoLog",
891  "glGetProgramiv",
892  "glGetShaderInfoLog",
893  "glGetShaderiv",
894  "glGetString",
895  "glGetStringi",
896  "glGetUniformLocation",
897  "glGetVertexAttribPointerv",
898  "glGetVertexAttribiv",
899  "glIsEnabled",
900  "glIsProgram",
901  "glLinkProgram",
902  "glPixelStorei",
903  "glPolygonMode",
904  "glReadPixels",
905  "glScissor",
906  "glShaderSource",
907  "glTexImage2D",
908  "glTexParameteri",
909  "glUniform1i",
910  "glUniformMatrix4fv",
911  "glUseProgram",
912  "glVertexAttribPointer",
913  "glViewport",
914 };
915 
916 GL3W_API union ImGL3WProcs imgl3wProcs;
917 
918 static void load_procs(GL3WGetProcAddressProc proc)
919 {
920  size_t i;
921  for (i = 0; i < GL3W_ARRAY_SIZE(proc_names); i++)
922  imgl3wProcs.ptr[i] = proc(proc_names[i]);
923 }
924 
925 #ifdef __cplusplus
926 }
927 #endif
928 #endif
OSystem * g_system
Definition: imgui_impl_opengl3_loader.h:479