-rw-r--r-- | Makefile.am | 10 | ||||
-rw-r--r-- | r/connect.R | 16 | ||||
-rw-r--r-- | src/controller/exp004mouse.c | 51 | ||||
-rw-r--r-- | src/controller/exp004processhits.c | 16 | ||||
-rw-r--r-- | src/controller/exp004reshape.c | 26 | ||||
-rw-r--r-- | src/controller/keyboard.c | 2 | ||||
-rw-r--r-- | src/controller/selection_from_db.sqc | 9 | ||||
-rw-r--r-- | src/controller/selsave.sqc | 4 | ||||
-rw-r--r-- | src/controller/set_ortho.c | 11 | ||||
-rw-r--r-- | src/controller/vis_sel_set.h | 3 | ||||
-rw-r--r-- | src/model/coordinates.h | 3 | ||||
-rw-r--r-- | src/model/exp004base.sqc | 30 | ||||
-rw-r--r-- | src/model/exp004state.h | 30 | ||||
-rw-r--r-- | src/model/selection_info.h | 11 | ||||
-rw-r--r-- | src/model/selection_info_init.c | 2 | ||||
-rw-r--r-- | src/model/selection_info_init.h | 2 | ||||
-rw-r--r-- | src/model/selection_purposes.h | 22 | ||||
-rw-r--r-- | src/model/zoom_info.h | 5 | ||||
-rw-r--r-- | src/model/zoom_info_init.c | 2 | ||||
-rw-r--r-- | src/model/zoom_info_init.h | 2 | ||||
-rw-r--r-- | src/util/pick_convert.c | 7 | ||||
-rw-r--r-- | src/util/sqlinfoprint.c | 2 | ||||
-rw-r--r-- | src/util/sqlinfoprint.h | 7 | ||||
-rw-r--r-- | src/view/exp004geometry.c | 6 | ||||
-rw-r--r-- | src/view/exp004view.c | 7 |
25 files changed, 140 insertions, 146 deletions
diff --git a/Makefile.am b/Makefile.am index a6d8603..9ac859b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,2 +1,12 @@ ACLOCAL_AMFLAGS = -I ax SUBDIRS = src + +indent : + indent \ + src/*.c \ + src/controller/*.c src/controller/*.sqc src/controller/*.h \ + src/db/*.c src/db/*.sqc src/db/*.h \ + src/model/*.c src/model/*.sqc src/model/*.h \ + src/util/*.c src/util/*.h \ + src/view/*.c src/view/*.h + diff --git a/r/connect.R b/r/connect.R new file mode 100644 index 0000000..b42b8bb --- a/dev/null +++ b/r/connect.R @@ -0,0 +1,16 @@ +require (RJDBC); + +drv <- JDBC ("com.ibm.db2.jcc.DB2Driver"); +conn <- dbConnect (drv, "jdbc:db2:exp004"); + +dbListTables (conn); + +dbGetQuery (conn, "SELECT COUNT(*) FROM vis_collect"); + +d <- dbReadTable (conn, "vis_collect"); + +hist (d$"N_CITES"); + +dbDisconnect (conn); +dbUnloadDriver (drv); + diff --git a/src/controller/exp004mouse.c b/src/controller/exp004mouse.c index fb753d6..9a556ae 100644 --- a/src/controller/exp004mouse.c +++ b/src/controller/exp004mouse.c @@ -37,13 +37,13 @@ exp004mouse (int button, int state, int x, int y) GLdouble model[16]; glGetDoublev (GL_MODELVIEW_MATRIX, model); GLdouble projection[16]; - glGetDoublev (GL_PROJECTION_MATRIX, projection); + glGetDoublev (GL_PROJECTION_MATRIX, projection); GLint viewport[4]; glGetIntegerv (GL_VIEWPORT, viewport); check_error (__FILE__, __LINE__); - GLdouble start_position[3]; + GLdouble start_position[3]; gluUnProject (S.selection.x, viewport[3] - S.selection.y, 0, @@ -51,8 +51,7 @@ exp004mouse (int button, int state, int x, int y) projection, viewport, &start_position[0], - &start_position[1], - &start_position[2]); + &start_position[1], &start_position[2]); check_error (__FILE__, __LINE__); @@ -63,12 +62,10 @@ exp004mouse (int button, int state, int x, int y) model, projection, viewport, - &end_position[0], - &end_position[1], - &end_position[2]); + &end_position[0], &end_position[1], &end_position[2]); + + check_error (__FILE__, __LINE__); - check_error (__FILE__, __LINE__); - S.zoom.active = true; S.zoom.coords[0] = fmin (start_position[0], end_position[0]); S.zoom.coords[1] = fmax (start_position[0], end_position[0]); @@ -76,7 +73,7 @@ exp004mouse (int button, int state, int x, int y) S.zoom.coords[3] = fmax (start_position[1], end_position[1]); exp004reshape (S.viewport.w, S.viewport.h); - + glutPostRedisplay (); } @@ -85,27 +82,27 @@ exp004mouse (int button, int state, int x, int y) */ if (S.selection.active && S.selection.purpose == SET) { - + /* * "Specify the array to be used for the returned hit records * with glSelectBuffer () [Redbook]." */ GLuint select_buf[ROWS]; glSelectBuffer (ROWS, select_buf); - + /* * "Enter selection mode by specifying GL_SELECT with * glRenderMode () [Redbook]." */ glRenderMode (GL_SELECT); - + /* * "Initialize the name stack using glInitNames () and glPush * Names () [Redbook]." */ glInitNames (); glPushName (0); - + /* * "Define the viewing volume you want to use for selection. * Usually this is different from the viewing volume you @@ -116,10 +113,10 @@ exp004mouse (int button, int state, int x, int y) glMatrixMode (GL_PROJECTION); glPushMatrix (); glLoadIdentity (); - + GLint viewport[4]; glGetIntegerv (GL_VIEWPORT, viewport); - + double c_x = 0.0; double c_y = 0.0; double w = 0.0; @@ -127,37 +124,33 @@ exp004mouse (int button, int state, int x, int y) pick_convert (S.selection.x, S.selection.y, x, y, &c_x, &c_y, &w, &h); - gluPickMatrix (c_x, - (GLdouble)viewport[3] - c_y, - w, - h, - viewport); + gluPickMatrix (c_x, (GLdouble) viewport[3] - c_y, w, h, viewport); set_ortho (); - + /* * "Alternately issue primitive drawing commands and commands to * manipulate the name stack so that each primitive of interest * has appropriate names assigned [Redbook]." */ exp004geometry (GL_SELECT); - - glMatrixMode (GL_PROJECTION); + + glMatrixMode (GL_PROJECTION); glPopMatrix (); glutSwapBuffers (); - + /* * "Exit selection mode and process the returned selection data * (the hit records) [Redbook]." */ GLint hits = glRenderMode (GL_RENDER); check_error (__FILE__, __LINE__); - + /* "process hits from selection mode rendering [Angel,2008]." */ exp004processhits (hits, select_buf); - - /* "normal render [Angel,2008]." */ - glutPostRedisplay (); + + /* "normal render [Angel,2008]." */ + glutPostRedisplay (); } } diff --git a/src/controller/exp004processhits.c b/src/controller/exp004processhits.c index 84f8b8d..264bd46 100644 --- a/src/controller/exp004processhits.c +++ b/src/controller/exp004processhits.c @@ -1,10 +1,7 @@ -/* I seem to need this for glGenBuffers as per - http://www.gamedev.net/community/forums/topic.asp?topic_id=422358 */ #define GL_GLEXT_PROTOTYPES - +#include "../view/exp004state0.h" #include "exp004processhits.h" #include "selsave.h" -#include "../view/exp004state0.h" #include <stdio.h> /* @@ -19,20 +16,13 @@ void exp004processhits (GLint hits, GLuint buffer[]) { - printf ("Hits: %d\n", hits); - GLuint *hitlist = buffer; - + for (int i = 0; i < hits; i++) { hitlist += 3; /* - * Report the hit to the terminal. - */ - printf ("Hit %i: %s\n", i + 1, S.gi_data[*hitlist]); - - /* * Add the hits to the selection. */ S.selection.set[*hitlist] = true; @@ -51,8 +41,6 @@ exp004processhits (GLint hits, GLuint buffer[]) glBufferData (GL_ARRAY_BUFFER, sizeof (S.base_colors_data), S.base_colors_data, GL_STATIC_DRAW); - - printf ("\n"); return; } diff --git a/src/controller/exp004reshape.c b/src/controller/exp004reshape.c index 4d46223..82f134d 100644 --- a/src/controller/exp004reshape.c +++ b/src/controller/exp004reshape.c @@ -19,26 +19,18 @@ exp004reshape (int w, int h) */ if (w <= h) - { - S.ortho.min_x = - S.ortho_min; - S.ortho.max_x = - S.ortho_max; - S.ortho.min_y = - S.ortho_min * (GLfloat) h / (GLfloat) w; - S.ortho.max_y = - S.ortho_max * (GLfloat) h / (GLfloat) w; + { + S.ortho.min_x = S.ortho_min; + S.ortho.max_x = S.ortho_max; + S.ortho.min_y = S.ortho_min * (GLfloat) h / (GLfloat) w; + S.ortho.max_y = S.ortho_max * (GLfloat) h / (GLfloat) w; } else { - S.ortho.min_x = - S.ortho_min * (GLfloat) w / (GLfloat) h; - S.ortho.max_x = - S.ortho_max * (GLfloat) w / (GLfloat) h; - S.ortho.min_y = - S.ortho_min; - S.ortho.max_y = - S.ortho_max; + S.ortho.min_x = S.ortho_min * (GLfloat) w / (GLfloat) h; + S.ortho.max_x = S.ortho_max * (GLfloat) w / (GLfloat) h; + S.ortho.min_y = S.ortho_min; + S.ortho.max_y = S.ortho_max; } set_ortho (); diff --git a/src/controller/keyboard.c b/src/controller/keyboard.c index 6b70af2..d817d7c 100644 --- a/src/controller/keyboard.c +++ b/src/controller/keyboard.c @@ -33,7 +33,7 @@ keyboard (unsigned char key, int x, int y) * Reset the view (unzoom). */ S.zoom.active = false; - exp004reshape (S.viewport.w, S.viewport.h); + exp004reshape (S.viewport.w, S.viewport.h); glutPostRedisplay (); break; diff --git a/src/controller/selection_from_db.sqc b/src/controller/selection_from_db.sqc index 8a49510..8c12c79 100644 --- a/src/controller/selection_from_db.sqc +++ b/src/controller/selection_from_db.sqc @@ -22,18 +22,17 @@ selection_from_db (void) EXEC SQL END DECLARE SECTION; EXEC SQL DECLARE c3 CURSOR FOR - SELECT * FROM vis_sel_set - ORDER BY title, id DESC; + SELECT * FROM vis_sel_set ORDER BY title, id DESC; EXEC SQL OPEN c3; check_error (__FILE__, __LINE__); - + /* * This loop currently assumes only one set in the table and does * not use the title assigned to that set. This should be improved * to allow the user to manage multiple sets by name. */ - EXEC SQL FETCH c3 INTO :vis_sel_set; + EXEC SQL FETCH c3 INTO:vis_sel_set; while (sqlca.sqlcode != 100) { int i = vis_sel_set.id - 1; @@ -44,7 +43,7 @@ selection_from_db (void) S.base_colors_data[i][2] = vis_sel_set.b; S.base_colors_data[i][3] = 0.6; - EXEC SQL FETCH c3 INTO :vis_sel_set; + EXEC SQL FETCH c3 INTO:vis_sel_set; } EXEC SQL CLOSE c3; diff --git a/src/controller/selsave.sqc b/src/controller/selsave.sqc index 27734ab..2c6005f 100644 --- a/src/controller/selsave.sqc +++ b/src/controller/selsave.sqc @@ -24,12 +24,12 @@ selsave (void) */ EXEC SQL DELETE FROM vis_selection WHERE gi IS NOT NULL; check_error (__FILE__, __LINE__); - + for (unsigned int i = 0; i < ROWS; i++) { if (S.selection.set[i] == true) { - strncpy (gi, S.gi_data[i] + 3, sizeof(gi)); + strncpy (gi, S.gi_data[i] + 3, sizeof (gi)); EXEC SQL INSERT INTO vis_selection VALUES (:gi); } } diff --git a/src/controller/set_ortho.c b/src/controller/set_ortho.c index 75af6a6..6478d21 100644 --- a/src/controller/set_ortho.c +++ b/src/controller/set_ortho.c @@ -10,17 +10,12 @@ set_ortho (void) if (S.zoom.active) { gluOrtho2D (S.zoom.coords[0], - S.zoom.coords[1], - S.zoom.coords[2], - S.zoom.coords[3]); + S.zoom.coords[1], S.zoom.coords[2], S.zoom.coords[3]); } else { - gluOrtho2D (S.ortho.min_x, - S.ortho.max_x, - S.ortho.min_y, - S.ortho.max_y); - } + gluOrtho2D (S.ortho.min_x, S.ortho.max_x, S.ortho.min_y, S.ortho.max_y); + } return; } diff --git a/src/controller/vis_sel_set.h b/src/controller/vis_sel_set.h index 7c66a93..5df08f1 100644 --- a/src/controller/vis_sel_set.h +++ b/src/controller/vis_sel_set.h @@ -3,11 +3,10 @@ struct struct { short length; - char data[255]; + char data[255]; } title; sqlint32 id; double r; double g; double b; } vis_sel_set; - diff --git a/src/model/coordinates.h b/src/model/coordinates.h index 386f839..7620904 100644 --- a/src/model/coordinates.h +++ b/src/model/coordinates.h @@ -4,9 +4,8 @@ struct struct { short length; - char data[50]; + char data[50]; } gi; double x; double y; } coordinates; - diff --git a/src/model/exp004base.sqc b/src/model/exp004base.sqc index 2742138..a9c94cf 100644 --- a/src/model/exp004base.sqc +++ b/src/model/exp004base.sqc @@ -23,17 +23,16 @@ exp004base (void) * This implementation can be improved by mapping the video memory * directly rather than loading into system memory and then copying * into video memory. - */ + */ /* * db2dclgn -d exp004 -t coordinates */ EXEC SQL BEGIN DECLARE SECTION; - EXEC SQL INCLUDE 'model/coordinates.h'; + EXEC SQL INCLUDE 'model/coordinates.h'; EXEC SQL END DECLARE SECTION; - EXEC SQL DECLARE c2 CURSOR FOR - SELECT * FROM coordinates; + EXEC SQL DECLARE c2 CURSOR FOR SELECT *FROM coordinates; EXEC SQL OPEN c2; @@ -45,14 +44,12 @@ exp004base (void) S.bb.min_y = 0.0; S.bb.max_y = 0.0; - EXEC SQL FETCH c2 INTO :coordinates; + EXEC SQL FETCH c2 INTO:coordinates; while (sqlca.sqlcode != 100) { int i = coordinates.coord_id - 1; - strncpy(S.gi_data[i], - coordinates.gi.data, - sizeof (S.gi_data[i])); + strncpy (S.gi_data[i], coordinates.gi.data, sizeof (S.gi_data[i])); S.base_vertices_data[i][0] = coordinates.x; S.base_vertices_data[i][1] = coordinates.y; @@ -76,7 +73,7 @@ exp004base (void) S.base_colors_data[i][2] = DEFAULT_COLOR_B; S.base_colors_data[i][3] = DEFAULT_COLOR_A; - EXEC SQL FETCH c2 INTO :coordinates; + EXEC SQL FETCH c2 INTO:coordinates; } EXEC SQL CLOSE c2; @@ -106,8 +103,7 @@ exp004base (void) // Invert the y coordinate to match up with the LGL Java viewer. for (int i = 0; i < ROWS; i++) - S.base_vertices_data[i][1] = - S.ortho_max - S.base_vertices_data[i][1]; + S.base_vertices_data[i][1] = S.ortho_max - S.base_vertices_data[i][1]; // Move the origin (0,0) to the center of the data. S.ortho_min = 0.0; @@ -115,9 +111,8 @@ exp004base (void) for (int i = 0; i < ROWS; i++) { - S.base_vertices_data[i][0] = - S.base_vertices_data[i][0] - - (0.5 * (S.bb.max_x - S.bb.min_x)); + S.base_vertices_data[i][0] = + S.base_vertices_data[i][0] - (0.5 * (S.bb.max_x - S.bb.min_x)); if (S.ortho_min > S.base_vertices_data[i][0]) S.ortho_min = S.base_vertices_data[i][0]; @@ -125,9 +120,8 @@ exp004base (void) if (S.ortho_max < S.base_vertices_data[i][0]) S.ortho_max = S.base_vertices_data[i][0]; - S.base_vertices_data[i][1] = - S.base_vertices_data[i][1] - - (0.5 * (S.bb.max_y - S.bb.min_y)); + S.base_vertices_data[i][1] = + S.base_vertices_data[i][1] - (0.5 * (S.bb.max_y - S.bb.min_y)); if (S.ortho_min > S.base_vertices_data[i][1]) S.ortho_min = S.base_vertices_data[i][1]; @@ -140,7 +134,7 @@ exp004base (void) glBindBuffer (GL_ARRAY_BUFFER, S.buffers[BASE_VERTICES]); glVertexPointer (2, GL_FLOAT, 0, 0); - glBufferData (GL_ARRAY_BUFFER, + glBufferData (GL_ARRAY_BUFFER, sizeof (S.base_vertices_data), S.base_vertices_data, GL_STATIC_DRAW); diff --git a/src/model/exp004state.h b/src/model/exp004state.h index 11e9ebd..d151966 100644 --- a/src/model/exp004state.h +++ b/src/model/exp004state.h @@ -10,15 +10,18 @@ #define BASE_VERTICES 0 #define BASE_COLORS 1 -#define DEFAULT_COLOR_R 0.5 -#define DEFAULT_COLOR_G 0.5 -#define DEFAULT_COLOR_B 0.5 -#define DEFAULT_COLOR_A 0.5 +#define CLEAR_COLOR 1.0, 1.0, 1.0, 1.0 +#define DRAW_COLOR 0.0, 0.0, 0.0 -#define SELECT_COLOR_R 1.0 -#define SELECT_COLOR_G 1.0 -#define SELECT_COLOR_B 1.0 -#define SELECT_COLOR_A 0.8 +#define DEFAULT_COLOR_R 0.00 +#define DEFAULT_COLOR_G 0.00 +#define DEFAULT_COLOR_B 0.01 +#define DEFAULT_COLOR_A 0.25 + +#define SELECT_COLOR_R 0.00 +#define SELECT_COLOR_G 0.00 +#define SELECT_COLOR_B 0.00 +#define SELECT_COLOR_A 0.75 /* * Maintain state of the model. @@ -29,7 +32,8 @@ typedef struct /* * Track the bounding box of the points. */ - struct { + struct + { float min_x; float max_x; float min_y; @@ -49,7 +53,8 @@ typedef struct /* * Orthographic coordinates after aspect preserving scaling. */ - struct { + struct + { float min_x; float max_x; float min_y; @@ -59,7 +64,8 @@ typedef struct /* * Viewport size. */ - struct { + struct + { int w; int h; } viewport; @@ -87,7 +93,7 @@ typedef struct SELECTION_INFO selection; ZOOM_INFO zoom; - + } EXP004STATE; #endif // EXP004STATE_H diff --git a/src/model/selection_info.h b/src/model/selection_info.h index 970ecec..ccd3f7a 100644 --- a/src/model/selection_info.h +++ b/src/model/selection_info.h @@ -9,13 +9,14 @@ */ #define ROWS 83905 -typedef struct { +typedef struct +{ /* * Selection list. */ bool set[ROWS]; - + /* * A selection is being performed. */ @@ -25,17 +26,17 @@ typedef struct { * Indicate if the user is currently defining a selection. */ SELECTION_PURPOSES purpose; - + /* * X coordinate of mouse when selection mode initiated. */ int x; - + /* * Y coordinate of mouse when selection mode initiated. */ int y; - + } SELECTION_INFO; #endif // SELECTION_INFO_H diff --git a/src/model/selection_info_init.c b/src/model/selection_info_init.c index e01b2b8..7a98e74 100644 --- a/src/model/selection_info_init.c +++ b/src/model/selection_info_init.c @@ -1,7 +1,7 @@ #include "selection_info_init.h" void -selection_info_init (SELECTION_INFO* s) +selection_info_init (SELECTION_INFO * s) { s->active = false; s->purpose = SET; diff --git a/src/model/selection_info_init.h b/src/model/selection_info_init.h index 8ce56c5..d38b851 100644 --- a/src/model/selection_info_init.h +++ b/src/model/selection_info_init.h @@ -3,6 +3,6 @@ #include "selection_info.h" -void selection_info_init (SELECTION_INFO* s); +void selection_info_init (SELECTION_INFO * s); #endif // SELECTION_INFO_INIT_H diff --git a/src/model/selection_purposes.h b/src/model/selection_purposes.h index 12d6ec7..6c2e651 100644 --- a/src/model/selection_purposes.h +++ b/src/model/selection_purposes.h @@ -1,17 +1,17 @@ #ifndef SELECTION_PURPOSES_H #define SELECTION_PURPOSES_H -typedef enum - { - /* - * The selection will define a new set. - */ - SET, +typedef enum +{ + /* + * The selection will define a new set. + */ + SET, - /* - * The selection will define a zoom region. - */ - ZOOM - } SELECTION_PURPOSES; + /* + * The selection will define a zoom region. + */ + ZOOM +} SELECTION_PURPOSES; #endif // SELECTION_PURPOSES_H diff --git a/src/model/zoom_info.h b/src/model/zoom_info.h index 0b935c8..5916b3c 100644 --- a/src/model/zoom_info.h +++ b/src/model/zoom_info.h @@ -6,12 +6,13 @@ /* * Maintain information for zooming. */ -typedef struct { +typedef struct +{ /* * A zoomed region has been selection. */ bool active; - + /* * Left, right, bottom and top of zoom region in world coordinates. */ diff --git a/src/model/zoom_info_init.c b/src/model/zoom_info_init.c index c5a3b1d..f49dd59 100644 --- a/src/model/zoom_info_init.c +++ b/src/model/zoom_info_init.c @@ -1,7 +1,7 @@ #include "zoom_info_init.h" void -zoom_info_init (ZOOM_INFO* z) +zoom_info_init (ZOOM_INFO * z) { z->active = false; diff --git a/src/model/zoom_info_init.h b/src/model/zoom_info_init.h index 262d408..2cf2ac2 100644 --- a/src/model/zoom_info_init.h +++ b/src/model/zoom_info_init.h @@ -3,6 +3,6 @@ #include "zoom_info.h" -void zoom_info_init (ZOOM_INFO* z); +void zoom_info_init (ZOOM_INFO * z); #endif // ZOOM_INFO_INIT_H diff --git a/src/util/pick_convert.c b/src/util/pick_convert.c index baafcfb..eca819a 100644 --- a/src/util/pick_convert.c +++ b/src/util/pick_convert.c @@ -5,8 +5,9 @@ */ #define N 3.0 -void pick_convert (int select_x, int select_y, int x, int y, - double *c_x, double *c_y, double *w, double *h) +void +pick_convert (int select_x, int select_y, int x, int y, + double *c_x, double *c_y, double *w, double *h) { /* * Calculate X and the width. @@ -14,7 +15,7 @@ void pick_convert (int select_x, int select_y, int x, int y, if (x > select_x) { *c_x = (x - select_x) / 2.0 + select_x; - *w = x - select_x; + *w = x - select_x; } else if (x < select_x) { diff --git a/src/util/sqlinfoprint.c b/src/util/sqlinfoprint.c index 8e0ae07..071b4c9 100644 --- a/src/util/sqlinfoprint.c +++ b/src/util/sqlinfoprint.c @@ -4,7 +4,7 @@ #include <stdio.h> int -sqlinfoprint (char *appMsg, struct sqlca *pSqlca, +sqlinfoprint (char *appMsg, struct sqlca *pSqlca, const char *file, const unsigned int line) { int rc = 0; diff --git a/src/util/sqlinfoprint.h b/src/util/sqlinfoprint.h index 984694b..7df2a09 100644 --- a/src/util/sqlinfoprint.h +++ b/src/util/sqlinfoprint.h @@ -7,9 +7,8 @@ * Report SQL error messages. Based on code from: * http://publib.boulder.ibm.com/infocenter/db2luw/v9r5/topic/com.ibm.db2.luw.apdv.embed.doc/doc/c0005779.html */ -int sqlinfoprint (char *appMsg, - struct sqlca *pSqlca, - const char *file, - const unsigned int line); +int sqlinfoprint (char *appMsg, + struct sqlca *pSqlca, + const char *file, const unsigned int line); #endif // SQLINFOPRINT_H diff --git a/src/view/exp004geometry.c b/src/view/exp004geometry.c index 9ff6475..b34d7f3 100644 --- a/src/view/exp004geometry.c +++ b/src/view/exp004geometry.c @@ -15,18 +15,18 @@ exp004geometry (GLenum mode) glPointSize (0.1); glColor3f (0.2, 0.2, 0.2); - if (mode == GL_SELECT) + if (mode == GL_SELECT) { for (int i = 0; i < ROWS; i++) { glLoadName (i); glDrawArrays (GL_POINTS, i, 1); - } + } } else { glDrawArrays (GL_POINTS, 0, ROWS); } - + return; } diff --git a/src/view/exp004view.c b/src/view/exp004view.c index cc27a93..b7e4367 100644 --- a/src/view/exp004view.c +++ b/src/view/exp004view.c @@ -5,6 +5,7 @@ #include "../db/dbconnect.h" #include "../model/exp004base.h" #include "exp004init.h" +#include "exp004state0.h" #include "exp004view.h" #include <GL/glut.h> @@ -20,8 +21,8 @@ exp004view (void) glutCreateWindow ("Exp004"); // GL Initialization - glClearColor (0.0, 0.0, 0.0, 1.0); - glColor3f (1.0, 1.0, 1.0); + glClearColor (CLEAR_COLOR); + glColor3f (DRAW_COLOR); glEnable (GL_AUTO_NORMAL); glEnable (GL_DEPTH_TEST); glEnable (GL_MAP1_VERTEX_3); @@ -30,7 +31,7 @@ exp004view (void) /* Buffer objects to use. */ glEnableClientState (GL_COLOR_ARRAY); glEnableClientState (GL_VERTEX_ARRAY); - + /* Enable Antialiasing as described in "Antialiasing" [Shreiner,247]. */ glEnable (GL_LINE_SMOOTH); |