From 10608cc2ba31147619340a4ff1c36858878c2d30 Mon Sep 17 00:00:00 2001
From: Don Pellegrino <don@drexel.edu>
Date: Sat, 13 Jun 2009 21:51:30 +0000
Subject: Updated to record the current selection in the database.

---
diff --git a/src/controller/exp004processhits.c b/src/controller/exp004processhits.c
index 29fbbbc..d8ea5b6 100644
--- a/src/controller/exp004processhits.c
+++ b/src/controller/exp004processhits.c
@@ -3,21 +3,22 @@
 #define GL_GLEXT_PROTOTYPES
 
 #include "exp004processhits.h"
+#include "selection_to_db.h"
 #include "../view/exp004state0.h"
 #include <stdio.h>
 
 /*
+ * A simple alias to make the code more readable.
+ */
+#define S exp004state0
+
+/*
  * The implementation of this function is based on
  * [Angel,2008,pp80-81].
  */
 void
 exp004processhits (GLint hits, GLuint buffer[])
 {
-  /*
-   * A simple alias to make the code more readable.
-   */
-  EXP004STATE* S = &exp004state0;
-
   printf ("Hits: %d\n", hits);
 
   GLuint *hitlist = buffer;
@@ -29,23 +30,25 @@ exp004processhits (GLint hits, GLuint buffer[])
       /*
        * Report the hit to the terminal.
        */
-      printf ("Hit %i: %s\n", i + 1, exp004state0.gi_data[*hitlist]);
+      printf ("Hit %i: %s\n", i + 1, S.gi_data[*hitlist]);
 
       /*
        * Add the hits to the selection.
        */
-      exp004state0.selection[*hitlist] = true;
-      exp004state0.base_colors_data[*hitlist][0] = SELECT_COLOR_R;
-      exp004state0.base_colors_data[*hitlist][1] = SELECT_COLOR_G;
-      exp004state0.base_colors_data[*hitlist][2] = SELECT_COLOR_B;
+      S.selection[*hitlist] = true;
+      S.base_colors_data[*hitlist][0] = SELECT_COLOR_R;
+      S.base_colors_data[*hitlist][1] = SELECT_COLOR_G;
+      S.base_colors_data[*hitlist][2] = SELECT_COLOR_B;
 
       hitlist++;
     }
 
-  glBindBuffer (GL_ARRAY_BUFFER, S->buffers[BASE_COLORS]);
+  selection_to_db ();
+
+  glBindBuffer (GL_ARRAY_BUFFER, S.buffers[BASE_COLORS]);
   glColorPointer (3, GL_FLOAT, 0, 0);
   glBufferData (GL_ARRAY_BUFFER,
-		sizeof (S->base_colors_data), S->base_colors_data,
+		sizeof (S.base_colors_data), S.base_colors_data,
 		GL_STATIC_DRAW);
   
   printf ("\n");
--
cgit v0.8.3.1-22-g547a