9 #ifndef GlobeEngine_Common_h
10 #define GlobeEngine_Common_h
12 #include "OpenGL_Includes.h"
19 #define PI 3.1415926535897932384626433832795
20 #define HALF_PI 1.57079632679489661923
23 static unsigned int findNextPowerOfTwo(
unsigned int _in){
24 unsigned int res = _in;
36 static float floatSwap(
float _f)
45 dat2.b[0] = dat1.b[3];
46 dat2.b[1] = dat1.b[2];
47 dat2.b[2] = dat1.b[1];
48 dat2.b[3] = dat1.b[0];
52 static float clamp(
float _x,
float _minVal,
float _maxVal)
54 return std::min(std::max(_x, _minVal), _maxVal);
59 static bool printOpenGLError(
const char* addInfo = NULL)
61 GLenum errCode = glGetError();
62 if (errCode != GL_NO_ERROR)
66 case GL_INVALID_ENUM: {
67 std::cout <<
"GL_INVALID_ENUM:" <<
"An unacceptable value is specified for an enumerated argument. For occlusion queries: " << std::endl;
70 case GL_INVALID_VALUE: {
71 std::cout <<
"GL_INVALID_VALUE:" <<
"A numeric argument is out of range." << std::endl;
74 case GL_INVALID_OPERATION: {
75 std::cout <<
"GL_INVALID_OPERATION:" <<
"The specified operation is not allowed in the current state. " << std::endl;
78 case GL_INVALID_FRAMEBUFFER_OPERATION: {
79 std::cout <<
"GL_INVALID_FRAMEBUFFER_OPERATION:" <<
"The framebuffer object is not complete." << std::endl;
82 case GL_OUT_OF_MEMORY: {
83 std::cout <<
"GL_OUT_OF_MEMORY:" <<
"There is not enough memory left to execute the command. The state of the GL is undefined, except for the state of the error flags, after this error is recorded." << std::endl;
86 #ifndef GENGINE_GL_BELOW_410
87 case GL_STACK_UNDERFLOW: {
88 std::cout <<
"GL_STACK_UNDERFLOW:" <<
"An attempt has been made to perform an operation that would cause an internal stack to underflow." << std::endl;
91 case GL_STACK_OVERFLOW: {
92 std::cout <<
"GL_STACK_OVERFLOW:" <<
"An attempt has been made to perform an operation that would cause an internal stack to overflow." << std::endl;
100 std::cout <<
": " << addInfo << std::endl;
104 std::cout <<
"Some openGLError Appeared" << std::endl;
112 static bool checkForExtension(std::string _input, std::string _ext)
114 std::size_t found = _input.find(_ext);
115 if (found != std::string::npos){
116 std::cout <<
"Found a " << _ext <<
" file: " << found <<
'\n';
122 static std::string getFileNameFromURL(
const std::string& str)
124 std::size_t found = str.find_last_of(
"/\\");
125 return str.substr(found + 1);
128 static std::string getFilePathfromURL(
const std::string& str)
130 return str.substr(0, str.find_last_of(
"/\\"));
Definition: AvalancheTrainingSimulationEngine.h:28