/src/core/Extensions.hpp

https://github.com/adbrown85/glawt · C++ Header · 52 lines · 35 code · 6 blank · 11 comment · 0 complexity · 3462fff81bd3d4ebd11b3c42b1569fb4 MD5 · raw file

  1. /*
  2. * Extensions.hpp
  3. *
  4. * Author
  5. * Andrew Brown <adb1413@rit.edu>
  6. */
  7. #ifndef GLAWT_EXTENSIONS_HPP
  8. #define GLAWT_EXTENSIONS_HPP
  9. #include "glawt_common.h"
  10. #ifdef HAVE_GLUT
  11. #include <GL/glut.h>
  12. #include <GL/freeglut_ext.h>
  13. #endif
  14. #ifdef HAVE_GTK
  15. #include <gdkmm/gl/query.h>
  16. #endif
  17. using namespace std;
  18. /* Functions to load explicitly */
  19. typedef void (*PFNGLBINDFRAGDATALOCATIONGANPROC)(GLuint,GLuint,const char*);
  20. typedef GLint (*PFNGLGETFRAGDATALOCATIONGANPROC)(GLuint,const char*);
  21. extern PFNGLBINDFRAGDATALOCATIONGANPROC glBindFragDataLocationGAN;
  22. extern PFNGLGETFRAGDATALOCATIONGANPROC glGetFragDataLocationGAN;
  23. /** @brief Exception thrown while loading an extension. */
  24. class ExtensionException : public exception {
  25. public:
  26. ExtensionException() {};
  27. ExtensionException(const ExtensionException &e) : message(e.getMessage()) {}
  28. ExtensionException(const string &message) : message(message) {}
  29. ~ExtensionException() throw() {}
  30. string getMessage() const {return message;}
  31. const char* what() const throw() {return message.c_str();}
  32. private:
  33. string message;
  34. };
  35. /** @brief Utility for loading OpenGL extensions.
  36. * @ingroup core
  37. */
  38. class Extensions {
  39. public:
  40. static void load();
  41. protected:
  42. static void loadGLEW();
  43. static void loadGLUT();
  44. static void loadGTK();
  45. };
  46. #endif