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