#define GL_GLEXT_PROTOTYPES #include "clear_selection.h" #include "../../model/geometry/map_geometry.h" #include "../../view/exp004state0.h" #include #include "sqlca.h" extern struct sqlca sqlca; /* * A simple alias to make the code more readable. */ #define S exp004state0 void clear_selection (void) { /* * WHERE gi IS NOT NULL is added to prevent the PRECOMPILE command * from throwing a warning about modifying an entire table. Since * gi is defined as NOT NULL this will clear the entire table. */ EXEC SQL DELETE FROM vis_selection WHERE gi IS NOT NULL; EXEC SQL COMMIT; for (unsigned int i = 0; i < S.rows; i++) { S.selection.set[i] = false; float *c = S.base_colors_data + (i * 4); *c = DEFAULT_COLOR_R; c++; *c = DEFAULT_COLOR_G; c++; *c = DEFAULT_COLOR_B; c++; *c = DEFAULT_COLOR_A; } glBindBuffer (GL_ARRAY_BUFFER, S.buffers[BASE_COLORS]); glColorPointer (4, GL_FLOAT, 0, 0); glBufferData (GL_ARRAY_BUFFER, sizeof (S.base_colors_data), S.base_colors_data, GL_STATIC_DRAW); /* * Rebuild the display list for the map. */ map_geometry (); glutPostRedisplay (); return; }