#ifndef _GLAPI_H
#define _GLAPI_H
#define GL_GLEXT_PROTOTYPES
#include "GL/gl.h"
#include "GL/glext.h"
#include "glthread.h"
struct _glapi_table;
typedef void (*_glapi_proc)(void);
typedef void (*_glapi_warning_func)(void *ctx, const char *str, ...);
#if defined(USE_MGL_NAMESPACE)
#define _glapi_set_dispatch _mglapi_set_dispatch
#define _glapi_get_dispatch _mglapi_get_dispatch
#define _glapi_set_context _mglapi_set_context
#define _glapi_get_context _mglapi_get_context
#define _glapi_Context _mglapi_Context
#define _glapi_Dispatch _mglapi_Dispatch
#endif
#define MAX_EXTENSION_FUNCS 300
#if defined (GLX_USE_TLS)
const extern void *_glapi_Context;
const extern struct _glapi_table *_glapi_Dispatch;
extern TLS void * _glapi_tls_Context
__attribute__((tls_model("initial-exec")));
# define GET_CURRENT_CONTEXT(C) GLcontext *C = (GLcontext *) _glapi_tls_Context
#else
extern void *_glapi_Context;
extern struct _glapi_table *_glapi_Dispatch;
# ifdef THREADS
# define GET_CURRENT_CONTEXT(C) GLcontext *C = (GLcontext *) (_glapi_Context ? _glapi_Context : _glapi_get_context())
# else
# define GET_CURRENT_CONTEXT(C) GLcontext *C = (GLcontext *) _glapi_Context
# endif
#endif
extern void
_glapi_check_multithread(void);
extern void
_glapi_set_context(void *context);
extern void *
_glapi_get_context(void);
extern void
_glapi_set_dispatch(struct _glapi_table *dispatch);
extern struct _glapi_table *
_glapi_get_dispatch(void);
extern int
_glapi_begin_dispatch_override(struct _glapi_table *override);
extern void
_glapi_end_dispatch_override(int layer);
struct _glapi_table *
_glapi_get_override_dispatch(int layer);
extern GLuint
_glapi_get_dispatch_table_size(void);
extern int
_glapi_add_dispatch( const char * const * function_names,
const char * parameter_signature );
extern _glapi_proc
_glapi_get_proc_address(const char *funcName);
extern struct _glapi_table *
_glapi_create_table_from_handle(void *handle, const char *symbol_prefix);
#endif