From ea76b6988ccafaa6a4d4ed90f2489d0e49e1f180 Mon Sep 17 00:00:00 2001 From: Benjamin Barenblat Date: Sat, 5 Sep 2015 09:32:30 -0400 Subject: Imported Upstream version 0.40.24 --- g_src/g_basics.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100755 g_src/g_basics.h (limited to 'g_src/g_basics.h') diff --git a/g_src/g_basics.h b/g_src/g_basics.h new file mode 100755 index 0000000..eca424c --- /dev/null +++ b/g_src/g_basics.h @@ -0,0 +1,33 @@ +#ifndef G_BASICS_H +#define G_BASICS_H + +#define MAX_GRID_X 256 +#define MAX_GRID_Y 256 +#define MIN_GRID_X 80 +#define MIN_GRID_Y 25 + +#ifndef MAX +# define MAX(a, b) (((a) > (b)) ? (a) : (b)) +#endif +#ifndef MIN +# define MIN(a, b) (((a) < (b)) ? (a) : (b)) +#endif +#ifndef ARRSZ +# define ARRSZ(arr) (sizeof (arr) / sizeof ((arr)[0])) +#endif +#ifndef CLAMP +#define CLAMP(x,a,b) MIN(MAX((x),(a)),(b)) +#endif + +// GL error macro +extern int glerrorcount; + +#ifdef DEBUG +# define printGLError() do { GLenum err; do { err = glGetError(); if (err && glerrorcount < 40) { printf("GL error: 0x%x in %s:%d\n", err, __FILE__ , __LINE__); glerrorcount++; } } while(err); } while(0); +# define deputs(str) puts(str) +#else +# define printGLError() +# define deputs(str) +#endif + +#endif -- cgit v1.2.3