Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Bink GL extension loader
#define BINKGL_LIST \
/* ret, name, params */ \
GLE(void, LinkProgram, GLuint program) \
GLE(void, GetProgramiv, GLuint program, GLenum pname, GLint *params) \
GLE(GLuint, CreateShader, GLenum type) \
GLE(void, ShaderSource, GLuint shader, GLsizei count, const GLchar* const *string, const GLint *length) \
GLE(void, CompileShader, GLuint shader) \
GLE(void, GetShaderiv, GLuint shader, GLenum pname, GLint *params) \
GLE(void, GetShaderInfoLog, GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog) \
GLE(void, DeleteShader, GLuint shader) \
GLE(GLuint, CreateProgram, void) \
GLE(void, AttachShader, GLuint program, GLuint shader) \
GLE(void, DetachShader, GLuint program, GLuint shader) \
GLE(void, UseProgram, GLuint program) \
GLE(void, DeleteProgram, GLuint program) \
GLE(void, GenVertexArrays, GLsizei n, GLuint *arrays) \
GLE(void, BindVertexArray, GLuint array) \
GLE(void, BufferData, GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage) \
GLE(void, GenBuffers, GLsizei n, GLuint *buffers) \
GLE(void, BindBuffer, GLenum target, GLuint buffer) \
GLE(void, DeleteBuffers, GLsizei n, const GLuint *buffers) \
GLE(void, TexParameteri, GLenum target, GLenum pname, GLint param) \
GLE(void, ActiveTexture, GLenum texture) \
GLE(void, BindAttribLocation, GLuint program, GLuint index, const GLchar *name) \
GLE(GLint, GetUniformLocation, GLuint program, const GLchar *name) \
GLE(void, Uniform4f, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) \
GLE(void, Uniform4fv, GLint location, GLsizei count, const GLfloat *value) \
GLE(void, DeleteVertexArrays, GLsizei n, const GLuint *arrays) \
GLE(void, EnableVertexAttribArray, GLuint index) \
GLE(void, VertexAttribPointer, GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer) \
GLE(void, Uniform1i, GLint location, GLint v0) \
/* end */
#define GLE(ret, name, ...) typedef ret GLDECL name##proc(__VA_ARGS__); static name##proc * gl##name;
#undef GLE
static void *GLhandle;
static void load_extensions( void )
if ( GLhandle == 0 )
GLhandle= StartGLLoad();
#define GLE(ret, name, ...) gl##name = (name##proc *) GetGLProcAddress(GLhandle, "gl" #name);
#undef GLE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment