-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/controller/callbacks/reshape.c | 2 | ||||
-rw-r--r-- | src/db/dbconnect.sqc | 12 | ||||
-rw-r--r-- | src/model/data/base.sqc | 2 | ||||
-rw-r--r-- | src/model/state/state.h | 3 | ||||
-rw-r--r-- | src/util/check_error.c | 6 | ||||
-rw-r--r-- | src/util/check_error_db.c | 13 | ||||
-rw-r--r-- | src/util/check_error_db.h | 9 |
8 files changed, 40 insertions, 9 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index cf16798..de6226d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -39,6 +39,7 @@ libflumap_la_SOURCES = \ model/state/zoom_info_init.c \ util/ati_meminfo.c \ util/check_error.c \ + util/check_error_db.c \ util/pick_convert.c \ util/sqlinfoprint.c \ view/geometry.c \ @@ -78,6 +79,7 @@ noinst_HEADERS = \ plugin/plugin.h \ util/ati_meminfo.h \ util/check_error.h \ + util/check_error_db.h \ util/pick_convert.h \ util/sqlinfoprint.h \ view/geometry.h \ diff --git a/src/controller/callbacks/reshape.c b/src/controller/callbacks/reshape.c index 99557b7..dedce5a 100644 --- a/src/controller/callbacks/reshape.c +++ b/src/controller/callbacks/reshape.c @@ -81,7 +81,7 @@ reshape (int w, int h) glViewport (0, 0, (GLsizei) w, (GLsizei) h); density_legend_geometry (); - datarose_geometry (); + // datarose_geometry (); return; } diff --git a/src/db/dbconnect.sqc b/src/db/dbconnect.sqc index 1e41a12..aab7bcb 100644 --- a/src/db/dbconnect.sqc +++ b/src/db/dbconnect.sqc @@ -1,5 +1,5 @@ #include "dbconnect.h" -#include "../util/check_error.h" +#include "../util/check_error_db.h" EXEC SQL INCLUDE sqlca; @@ -7,5 +7,13 @@ void dbconnect (void) { EXEC SQL CONNECT TO exp004; - check_error (__FILE__, __LINE__); + + /* + * Only check for a database error rather than using check_error to + * test for OpenGL and database errors. OpenGL may not yet be + * prepared and checking it prematurely could cause odd behavior. + */ + check_error_db (__FILE__, __LINE__); + + return; } diff --git a/src/model/data/base.sqc b/src/model/data/base.sqc index 41a651c..4627bea 100644 --- a/src/model/data/base.sqc +++ b/src/model/data/base.sqc @@ -169,7 +169,7 @@ base (void) v++; } - glGenBuffers (2, S.buffers); + glGenBuffers (NUM_BUFFERS, S.buffers); glBindBuffer (GL_ARRAY_BUFFER, S.buffers[BASE_VERTICES]); glVertexPointer (2, GL_FLOAT, 0, 0); diff --git a/src/model/state/state.h b/src/model/state/state.h index 6e4f62e..f432017 100644 --- a/src/model/state/state.h +++ b/src/model/state/state.h @@ -8,6 +8,7 @@ /* * Buffer object identifiers. */ +#define NUM_BUFFERS 2 #define BASE_VERTICES 0 #define BASE_COLORS 1 @@ -80,7 +81,7 @@ typedef struct /* * Buffer objects. */ - unsigned int buffers[1]; + unsigned int buffers[NUM_BUFFERS]; /* * GI Identifiers indexed by row. Storage is [rows][20]. diff --git a/src/util/check_error.c b/src/util/check_error.c index c47ca43..7d116e9 100644 --- a/src/util/check_error.c +++ b/src/util/check_error.c @@ -2,8 +2,7 @@ #include <error.h> #include <errno.h> #include <stdlib.h> -#include "sqlinfoprint.h" -extern struct sqlca sqlca; +#include "check_error_db.h" void check_error (const char *filename, const unsigned int linenum) @@ -23,8 +22,7 @@ check_error (const char *filename, const unsigned int linenum) /* * Check for an error from the Database API. */ - if (sqlinfoprint ("DB Error", &sqlca, filename, linenum) == 1) - exit (EXIT_FAILURE); + check_error_db (filename, linenum); return; } diff --git a/src/util/check_error_db.c b/src/util/check_error_db.c new file mode 100644 index 0000000..a6b7f51 --- a/dev/null +++ b/src/util/check_error_db.c @@ -0,0 +1,13 @@ +#include "check_error_db.h" +#include "sqlinfoprint.h" +#include <stdlib.h> +extern struct sqlca sqlca; + +void +check_error_db (const char *filename, const unsigned int linenum) +{ + if (sqlinfoprint ("DB Error", &sqlca, filename, linenum) == 1) + exit (EXIT_FAILURE); + + return; +} diff --git a/src/util/check_error_db.h b/src/util/check_error_db.h new file mode 100644 index 0000000..cc8467b --- a/dev/null +++ b/src/util/check_error_db.h @@ -0,0 +1,9 @@ +#ifndef CHECK_ERROR_H +#define CHECK_ERROR_H + +/* + * Check the database library to see if an error has occurred. + */ +void check_error_db (const char* filename, unsigned int linenum); + +#endif // CHECK_ERROR_H |