/*
OpenGL, OpenGL ES loader generated by glad 0.1.16a0 on Sun Jan 14 20:28:35 2018.
Language/Generator: C/C++ Debug
Specification: gl
APIs: gl=3.3, gles2=3.0, gles1=1.0
Profile: compatibility
Extensions:
Loader: True
Local files: False
Omit khrplatform: False
Commandline:
profile=compatibility api=gl=3.3,gles2=3.0,gles1=1.0 generator=c-debug spec=gl extensions=
Online:
http://glad.dav1d.de/#profile=compatibility&language=c-debug&specification=gl&loader=on&api=gl%3D3.3&api=gles2%3D3.0&api=gles1%3D1.0
*/
#include
#include
#include
#include ../include/glad/glad.h
void _pre_call_callback_default(const char *name, void *funcptr, int len_args, ) {
(void) name;
(void) funcptr;
(void) len_args;
}
void _post_call_callback_default(const char *name, void *funcptr, int len_args, ) {
GLenum error_code;
(void) funcptr;
(void) len_args;
error_code = glad_glGetError();
if (error_code != GL_NO_ERROR) {
fprintf(stderr, ERROR %d in %s
, error_code, name);
}
}
static GLADcallback _pre_call_callback = _pre_call_callback_default;
void glad_set_pre_callback(GLADcallback cb) {
_pre_call_callback = cb;
}
static GLADcallback _post_call_callback = _post_call_callback_default;
void glad_set_post_callback(GLADcallback cb) {
_post_call_callback = cb;
}
static void* get_proc(const char *namez);
#ifdef _WIN32
#include
static HMODULE libGL;
typedef void* (APIENTRYP PFNWGLGETPROCADDRESSPROC_PRIVATE)(const char*);
static PFNWGLGETPROCADDRESSPROC_PRIVATE gladGetProcAddressPtr;
static
int open_gl(void) {
libGL = LoadLibraryW(Lopengl32.dll);
if(libGL != NULL) {
gladGetProcAddressPtr = (PFNWGLGETPROCADDRESSPROC_PRIVATE)GetProcAddress(
libGL, wglGetProcAddress);
return gladGetProcAddressPtr != NULL;
}
return 0;
}
static
void close_gl(void) {
if(libGL != NULL) {
FreeLibrary(libGL);
libGL = NULL;
}
}
#else
#include
#ifndef __APPLE__
typedef void* (APIENTRYP PFNGLXGETPROCADDRESSPROC_PRIVATE)(const char*);
static PFNGLXGETPROCADDRESSPROC_PRIVATE gladGetProcAddressPtr;
#endif
static
int open_gl(void) {
#ifdef __APPLE__
static const char *NAMES[] = {
../Frameworks/OpenGL.framework/OpenGL,
/Library/Frameworks/OpenGL.framework/OpenGL,
/System/Library/Frameworks/OpenGL.framework/OpenGL,
/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL
};
#else
static const char *NAMES[] = {libGL.so.1, libGL.so};
#endif
unsigned int index = 0;
for(index = 0; index < (sizeof(NAMES) / sizeof(NAMES[0])); index++) {libGL = dlopen(NAMES[index], RTLD_NOW | RTLD_GLOBAL);if(libGL != NULL) {#ifdef __APPLE__return 1;#elsegladGetProcAddressPtr = (PFNGLXGETPROCADDRESSPROC_PRIVATE)dlsym(libGL,”glXGetProcAddressARB”);return gladGetProcAddressPtr != NULL;#endif}}return 0;}staticvoid close_gl(void) {if(libGL != NULL) {dlclose(libGL);libGL = NULL;}}#endifstaticvoid* get_proc(const char *namez) {void* result = NULL;if(libGL == NULL) return NULL;#ifndef __APPLE__if(gladGetProcAddressPtr != NULL) {result = gladGetProcAddressPtr(namez);}#endifif(result == NULL) {#ifdef _WIN32result = (void*)GetProcAddress(libGL, namez);#elseresult = dlsym(libGL, namez);#endif}return result;}int gladLoadGL(void) {int status = 0;if(open_gl()) {status = gladLoadGLLoader(&get_proc);close_gl();}return status;}struct gladGLversionStruct GLVersion;#if defined(GL_ES_VERSION_3_0) || defined(GL_VERSION_3_0)#define _GLAD_IS_SOME_NEW_VERSION 1#endifstatic int max_loaded_major;static int max_loaded_minor;static const char *exts = NULL;static int num_exts_i = 0;static const char **exts_i = NULL;static int get_exts(void) {#ifdef _GLAD_IS_SOME_NEW_VERSIONif(max_loaded_major < 3) {#endifexts = (const char *)glGetString(GL_EXTENSIONS);#ifdef _GLAD_IS_SOME_NEW_VERSION} else {unsigned int index;num_exts_i = 0;glGetIntegerv(GL_NUM_EXTENSIONS, &num_exts_i);if (num_exts_i > 0) {
exts_i = (const char **)realloc((void *)exts_i, (size_t)num_exts_i * (sizeof *exts_i));
}
if (exts_i == NULL) {
return 0;
}
for(index = 0; index < (unsigned)num_exts_i; index++) {const char *gl_str_tmp = (const char*)glGetStringi(GL_EXTENSIONS, index);size_t len = strlen(gl_str_tmp);char *local_str = (char*)malloc((len+1) * sizeof(*exts_i));if(local_str != NULL) {#if _MSC_VER >= 1400
strncpy_s(local_str, len+1, gl_str_tmp, len);
#else
strncpy(local_str, gl_str_tmp, len+1);
#endif
}
exts_i[index] = local_str;
}
}
#endif
return 1;
}
static void free_exts(void) {
if (exts_i != NULL) {
int index;
for(index = 0; index < num_exts_i; index++) {free((char *)exts_i[index]);}free((void *)exts_i);exts_i = NULL;}}static int has_ext(const char *ext) {#ifdef _GLAD_IS_SOME_NEW_VERSIONif(max_loaded_major < 3) {#endifconst char *extensions;const char *loc;const char *terminator;extensions = exts;if(extensions == NULL || ext == NULL) {return 0;}while(1) {loc = strstr(extensions, ext);if(loc == NULL) {return 0;}terminator = loc + strlen(ext);if((loc == extensions || *(loc – 1) == ‘ ‘) &&(*terminator == ‘ ‘ || *terminator == ‘