Angel.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // --- Angel.h ---
  4. //
  5. // The main header file for all examples from Angel 6th Edition
  6. //
  7. //////////////////////////////////////////////////////////////////////////////
  8. #ifndef __ANGEL_H__
  9. #define __ANGEL_H__
  10. //----------------------------------------------------------------------------
  11. //
  12. // --- Include system headers ---
  13. //
  14. #include <cmath>
  15. #include <iostream>
  16. // Define M_PI in the case it's not defined in the math header file
  17. #ifndef M_PI
  18. # define M_PI 3.14159265358979323846
  19. #endif
  20. //----------------------------------------------------------------------------
  21. //
  22. // --- Include OpenGL header files and helpers ---
  23. //
  24. // The location of these files vary by operating system. We've included
  25. // copies of open-soruce project headers in the "GL" directory local
  26. // this this "include" directory.
  27. //
  28. #ifdef __APPLE__ // include Mac OS X verions of headers
  29. # include <OpenGL/OpenGL.h>
  30. # include <GLUT/glut.h>
  31. #else // non-Mac OS X operating systems
  32. # include <GL/glew.h>
  33. # include <GL/freeglut.h>
  34. # include <GL/freeglut_ext.h>
  35. #endif // __APPLE__
  36. // Define a helpful macro for handling offsets into buffer objects
  37. #define BUFFER_OFFSET( offset ) ((GLvoid*) (offset))
  38. //----------------------------------------------------------------------------
  39. //
  40. // --- Include our class libraries and constants ---
  41. //
  42. namespace Angel {
  43. // Helper function to load vertex and fragment shader files
  44. GLuint InitShader( const char* vertexShaderFile,
  45. const char* fragmentShaderFile );
  46. // Defined constant for when numbers are too small to be used in the
  47. // denominator of a division operation. This is only used if the
  48. // DEBUG macro is defined.
  49. const GLfloat DivideByZeroTolerance = GLfloat(1.0e-07);
  50. // Degrees-to-radians constant
  51. const GLfloat DegreesToRadians = M_PI / 180.0;
  52. } // namespace Angel
  53. #include "vec.h"
  54. #include "mat.h"
  55. //#include "CheckError.h"
  56. // #define Print(x) do { std::cerr << #x " = " << (x) << std::endl; } while(0)
  57. // Globally use our namespace in our example programs.
  58. using namespace Angel;
  59. #endif // __ANGEL_H__