-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug.h
More file actions
31 lines (27 loc) · 1.05 KB
/
debug.h
File metadata and controls
31 lines (27 loc) · 1.05 KB
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
#ifndef DEBUG_H
#define DEBUG_H
#include <stdio.h>
#include <stdlib.h>
#include <GL/gl.h>
#ifdef DEBUG
#define DEB(x) (x)
#define WHERE fprintf(stderr, "FILE: %s\nLINE: %d\n\n", __FILE__, __LINE__)
#define STACK fprintf(stderr, "FUNCTION: %s\n\n", __func__)
#define WHAT_IS(x, f) fprintf(stderr, "%s = "f"\n\n", #x, x)
#define CHECK_GL \
{ \
GLuint err; \
if (err = glGetError()) { \
fprintf(stderr, "FILE: %s, LINE: %d\n", __FILE__, __LINE__); \
fprintf(stderr, "GL Error: %s\n\n", gluErrorString(err)); \
exit(EXIT_FAILURE); \
} \
}
#else
#define DEB(x)
#define WHERE
#define STACK
#define WHAT_IS(x, f)
#define CHECK_GL
#endif
#endif