From aca6c44aa9dd615d087c8e4a77ea53ff6254ea3c Mon Sep 17 00:00:00 2001 From: fatray Date: Sun, 16 Dec 2007 17:40:43 +0000 Subject: [PATCH] for a Debug build, glerror() prints any gl errors that have occurred git-svn-id: https://projectm.svn.sourceforge.net/svnroot/projectm/trunk@734 6778bc44-b910-0410-a7a0-be141de4315d --- src/projectM-engine/glError.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/projectM-engine/glError.h diff --git a/src/projectM-engine/glError.h b/src/projectM-engine/glError.h new file mode 100644 index 000000000..a6d0940ea --- /dev/null +++ b/src/projectM-engine/glError.h @@ -0,0 +1,31 @@ +// +// File: glError.h +// Author: fatray +// +// Created on 02 December 2007, 16:08 +// + +#ifndef _GLERROR_H +#define _GLERROR_H + +// no need to include GL in here, +// if someone wants GL errors they probably already included it. + + +/* + * if we are debugging, print all glErrors to stderr. + * Remeber that glErrors are buffered, this just prints any in the buffer. + */ +#ifdef NDEBUG +#define glError() +#else +#define glError() { \ + GLenum err; \ + while ((err = glGetError()) != GL_NO_ERROR) \ + fprintf(stderr, "glError: %s at %s:%u\n", \ + (char *)gluErrorString(err), __FILE__, __LINE__); \ +} +#endif /* glError */ + +#endif /* _GLERROR_H */ +