forked from QianMo/GPU-Gems-Book-Source-Code
-
Notifications
You must be signed in to change notification settings - Fork 0
/
defines.h
76 lines (64 loc) · 2.58 KB
/
defines.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
/*----------------------------------------------------------------------
|
| $Id$
|
+---------------------------------------------------------------------*/
#ifndef GBDEFINES_HH
#define GBDEFINES_HH
#ifdef WIN32 // WIN32
#include "_windows.h"
// C4786: identifier was truncated to '255' characters in the debug information
// C4251: foo 'needs to have dll-interface to be used by clients of class' bar
// C4275: non dll-interface class 'foo' used as base for dll-interface class 'bar'
// C4231: nonstandard extension used : 'extern' before template explicit instantiation
// C4291: new with no matching operator delete
# pragma warning( 4 : 4786 4251 4275 4231 4291)
# pragma warning( disable : 4786 4251 4275 4231 4291)
#endif
#include <typeinfo>
#include <iostream>
#include <iomanip>
#include <limits>
#ifdef IRIX
#include <assert.h>
#else
#include <cassert>
#endif
#ifdef DEBUG
#define infomsg(s) std::cout<<typeid(*this).name()<<": \033[32mINFO:\033[0m "<<s<<std::endl
#define staticinfomsg(n,s) std::cout<<n<<": \033[32mINFO:\033[0m "<<s<<std::endl
#else
#define infomsg(s) std::cout<<s<<std::endl
#define staticinfomsg(n,s) std::cout<<s<<std::endl
#endif
#ifdef DEBUG
#define debugmsg(s) std::cerr<<typeid(*this).name()<<": \033[36mDEBUG:\033[0m "<<s<<std::endl
#define staticdebugmsg(n,s) std::cerr<<n<<": \033[36mDEBUG:\033[0m "<<s<<std::endl
#else
#define debugmsg(s)
#define staticdebugmsg(n,s)
#endif
#ifdef DEBUG
#define warningmsg(s) std::cerr<<typeid(*this).name()<<": \033[33mWARNING:\033[0m "<<s<<std::endl
#define staticwarningmsg(n,s) std::cerr<<n<<": \033[33mWARNING:\033[0m "<<s<<std::endl
#else
#define warningmsg(s) std::cerr<<"\033[33mWARNING:\033[0m "<<s<<std::endl
#define staticwarningmsg(n,s) std::cerr<<"\033[33mWARNING:\033[0m "<<s<<std::endl
#endif
#ifdef DEBUG
#define errormsg(s) std::cerr<<typeid(*this).name()<<": \033[31mERROR:\033[0m "<<s<<std::endl
#define staticerrormsg(n,s) std::cerr<<n<<": \033[31mERROR:\033[0m "<<s<<std::endl
#else
#define errormsg(s) std::cerr<<"\033[31mERROR:\033[0m "<<s<<std::endl
#define staticerrormsg(n,s) std::cerr<<"\033[31mERROR:\033[0m "<<s<<std::endl
#endif
// check for OpenGL-Errors
#define checkGLError(msg) {const GLenum e = glGetError(); if ((e != 0) && (e != GL_NO_ERROR)) {staticerrormsg(\
"OpenGL-ERROR <0x" << std::setfill('0') << std::hex << std::setw(4) << e << std::dec << ">",\
msg <<" in " __FILE__ "(" << __LINE__ << "): " << gluErrorString(e));}}
#endif // GBDEFINES_HH
/*----------------------------------------------------------------------
|
| $Log$
|
+---------------------------------------------------------------------*/