Line | |
---|
1 | #ifdef HAVE_CONFIG_H |
---|
2 | # include "config.h" |
---|
3 | #endif |
---|
4 | |
---|
5 | #ifdef HAVE_GL_GLU_H |
---|
6 | # include <GL/glu.h> |
---|
7 | #elif HAVE_OPENGL_GLU_H |
---|
8 | # include <OpenGL/glu.h> |
---|
9 | #endif |
---|
10 | #include <stdarg.h> |
---|
11 | #include <netcdf.h> |
---|
12 | #include <SDL.h> |
---|
13 | #include "error.h" |
---|
14 | |
---|
15 | #define MAX_ERROR_LEN 200 |
---|
16 | |
---|
17 | static char error[MAX_ERROR_LEN]; |
---|
18 | |
---|
19 | char* AnugaVis_GetError(void){ |
---|
20 | return error; |
---|
21 | } |
---|
22 | |
---|
23 | void AnugaVis_SetError(const char *format, ...){ |
---|
24 | va_list args; |
---|
25 | va_start(args, format); |
---|
26 | vsnprintf(error, MAX_ERROR_LEN, format, args); |
---|
27 | va_end(args); |
---|
28 | } |
---|
29 | |
---|
30 | void AnugaVis_SDLError(void){ |
---|
31 | AnugaVis_SetError("SDL Error: %s", SDL_GetError()); |
---|
32 | SDL_ClearError(); |
---|
33 | } |
---|
34 | |
---|
35 | void AnugaVis_NetCDFError(int ncerr){ |
---|
36 | AnugaVis_SetError("NetCDF Error: %s", nc_strerror(ncerr)); |
---|
37 | } |
---|
38 | |
---|
39 | void AnugaVis_OpenGLError(GLenum errorCode){ |
---|
40 | AnugaVis_SetError("OpenGL Error: %s", gluErrorString(errorCode)); |
---|
41 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.