#include <stdio.h>
#include <stdlib.h>
+#include <stdarg.h>
+
+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)
{
{
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);
}