Advertisement
Sosowski

Untitled

Sep 1st, 2016
932
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. #define glGenBuffers  ((PFNGLGENBUFFERSPROC)(glFP[0]))
  3. #define glBindBuffer  ((PFNGLBINDBUFFERPROC)(glFP[1]))
  4. #define glBufferData  ((PFNGLBUFFERDATAPROC)(glFP[2]))
  5. #define glCreateShader  ((PFNGLCREATESHADERPROC)(glFP[3]))
  6. #define glShaderSource  ((PFNGLSHADERSOURCEPROC)(glFP[4]))
  7. #define glCompileShader  ((PFNGLCOMPILESHADERPROC)(glFP[5]))
  8. #define glAttachShader  ((PFNGLATTACHSHADERPROC)(glFP[6]))
  9. #define glLinkProgram  ((PFNGLLINKPROGRAMPROC)(glFP[7]))
  10. #define glUseProgram  ((PFNGLUSEPROGRAMPROC)(glFP[8]))
  11. #define glCreateProgram  ((PFNGLCREATEPROGRAMPROC)(glFP[9]))
  12.  
  13. typedef void (*GenFP)(void); // any function ptr type would do
  14. GenFP glFP[10];
  15. const char* glnames[]={
  16.     "glGenBuffers","glBindBuffer", "glBufferData",
  17.     "glCreateShader","glShaderSource","glCompileShader",
  18.     "glAttachShader","glLinkProgram","glUseProgram","glCreateProgram"
  19. };
  20.  
  21.  void create_ext() {
  22.     int i;
  23.     for (i=0; i<10; i++) glFP[i] = (GenFP)wglGetProcAddress(glnames[i]);
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement