Skip to content

Instantly share code, notes, and snippets.

@nickrolfe
Last active March 22, 2017 01:53
Show Gist options
  • Save nickrolfe/3772209bacf4584468bd059100f63b8e to your computer and use it in GitHub Desktop.
Save nickrolfe/3772209bacf4584468bd059100f63b8e to your computer and use it in GitHub Desktop.
//----------------------------------------------------------------------
// in opengl.h
XX(PFNGLACTIVETEXTUREPROC, glActiveTexture)
XX(PFNGLATTACHSHADERPROC, glAttachShader)
XX(PFNGLBINDBUFFERPROC, glBindBuffer)
// etc.
//----------------------------------------------------------------------
// in a C file
// Define all the OpenGL function pointers
#define XX(t, n) t n;
#include "opengl.h"
//----------------------------------------------------------------------
// in an init function
// Load all the OpenGL function pointers.
#define XX(t, n) (n) = (t)win_get_gl_proc_address(#n); // calls wglGetProcAddress and/or GetProcAddress
#include "opengl.h"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment