Go to the documentation of this file.00001
00002 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00003 #pragma implementation
00004 #endif
00005
00006
00007
00008
00009
00010 #include "vgui_macro.h"
00011
00012 #include <vcl_cstdlib.h>
00013 #include <vcl_iostream.h>
00014
00015 #include <vgui/vgui_gl.h>
00016 #include <vgui/vgui_glu.h>
00017
00018 extern bool vgui_glerrors_are_bad;
00019
00020 void vgui_macro_error_reporter(char const *FILE, int LINE)
00021 {
00022 static char const *last_file = 0;
00023 static int last_line = 0;
00024 static int numerrors = 0;
00025
00026 GLenum err = glGetError();
00027 if (err != GL_NO_ERROR) {
00028 if (last_file) {
00029 vcl_cerr << "Between " << last_file << ":" << last_line << '\n'
00030 << " and " << FILE << ":" << LINE << " : \""
00031 << gluErrorString(err) << "\"\n";
00032 }
00033 else
00034 vcl_cerr << "In " << FILE << " before line " << LINE << " : "
00035 << gluErrorString(err) << '\n';
00036
00037 if (++numerrors >= 20 && vgui_glerrors_are_bad) {
00038 vcl_cerr << "too many errors -- calling exit(1);\n";
00039 vcl_exit(1);
00040 }
00041 }
00042
00043
00044 last_file = FILE;
00045 last_line = LINE;
00046 }