X-Git-Url: https://git.ralfj.de/gltest.git/blobdiff_plain/abe5b74c820514f9f5896309e0e192569db35651..b0ce9e768aed86e894dcffae75e69a80c51e7b5d:/glutil.cpp?ds=inline diff --git a/glutil.cpp b/glutil.cpp index 0da85d5..325c131 100644 --- a/glutil.cpp +++ b/glutil.cpp @@ -20,6 +20,16 @@ #include #include +#include + +void die(const char *msg, ...) +{ + va_list ap; + va_start(ap, msg); + vfprintf(stderr, msg, ap); + va_end(ap); + exit(1); +} static const char *glErrorToString(GLenum e) { @@ -43,6 +53,5 @@ void checkGlError(const char *what) { GLenum e = glGetError(); if (e == GL_NO_ERROR) return; - fprintf(stderr, "GL error %d (%s): %s\n", e, glErrorToString(e), what); - exit(1); + die("GL error %d (%s): %s\n", e, glErrorToString(e), what); }