summaryrefslogtreecommitdiffstats
path: root/progs/util/errcheck.c
diff options
context:
space:
mode:
authorjtg <jtg>1999-08-19 00:55:39 +0000
committerjtg <jtg>1999-08-19 00:55:39 +0000
commitafb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1c (patch)
tree59d65b4da12fb5379224cf5f6b808fde91523c7f /progs/util/errcheck.c
parentf2544d4920ce168bec9cd94d774b7ea5103a3d74 (diff)
Initial revision
Diffstat (limited to 'progs/util/errcheck.c')
-rw-r--r--progs/util/errcheck.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/progs/util/errcheck.c b/progs/util/errcheck.c
new file mode 100644
index 00000000000..fe9c2973c33
--- /dev/null
+++ b/progs/util/errcheck.c
@@ -0,0 +1,27 @@
+/* errcheck.c */
+
+
+/*
+ * Call this function in your rendering loop to check for GL errors
+ * during development. Remove from release code.
+ *
+ * Written by Brian Paul and in the public domain.
+ */
+
+
+#include <GL/gl.h>
+#include <GL/glu.h>
+#incldue <stdio.h>
+
+
+
+GLboolean CheckError( const char *message )
+{
+ GLenum error = glGetError();
+ if (error) {
+ char *err = (char *) gluErrorString( error );
+ fprintf( stderr, "GL Error: %s at %s\n", err, message );
+ return GL_TRUE;
+ }
+ return GL_FALSE;
+}