/src/core/Extensions.cpp

https://github.com/adbrown85/glawt · C++ · 55 lines · 35 code · 14 blank · 6 comment · 2 complexity · 44372c57a41b520e0c70b2eaf6d47766 MD5 · raw file

  1. /*
  2. * Extensions.cpp
  3. *
  4. * Author
  5. * Andrew Brown <adb1413@rit.edu>
  6. */
  7. #include "Extensions.hpp"
  8. PFNGLBINDFRAGDATALOCATIONGANPROC glBindFragDataLocationGAN=NULL;
  9. PFNGLGETFRAGDATALOCATIONGANPROC glGetFragDataLocationGAN=NULL;
  10. void Extensions::load() {
  11. loadGLUT();
  12. loadGLEW();
  13. loadGTK();
  14. }
  15. void Extensions::loadGLEW() {
  16. #ifdef HAVE_GLEW
  17. GLenum err;
  18. err = glewInit();
  19. if (err != GLEW_OK) {
  20. throw ExtensionException("[Extensions] Could not initialize GLEW.");
  21. }
  22. #endif
  23. }
  24. void Extensions::loadGLUT() {
  25. #ifdef HAVE_GLUT
  26. #ifdef FREEGLUT
  27. glBindFragDataLocationGAN = (PFNGLBINDFRAGDATALOCATIONPROC)
  28. glutGetProcAddress("glBindFragDataLocation");
  29. glGetFragDataLocationGAN = (PFNGLGETFRAGDATALOCATIONPROC)
  30. glutGetProcAddress("glGetFragDataLocation");
  31. #endif
  32. #endif
  33. }
  34. void Extensions::loadGTK() {
  35. #ifdef HAVE_GTK
  36. glBindFragDataLocationGAN = (PFNGLBINDFRAGDATALOCATIONPROC)
  37. Gdk::GL::get_proc_address("glBindFragDataLocation");
  38. glGetFragDataLocationGAN = (PFNGLGETFRAGDATALOCATIONPROC)
  39. Gdk::GL::get_proc_address("glGetFragDataLocation");
  40. #endif
  41. }