summaryrefslogtreecommitdiffstats
authorDon Pellegrino <don@drexel.edu>2009-06-13 21:51:30 (GMT)
committer Don Pellegrino <don@drexel.edu>2009-06-13 21:51:30 (GMT)
commit10608cc2ba31147619340a4ff1c36858878c2d30 (patch) (unidiff)
tree54933d500eec0af46a7dc4c2f16f6fbe0e386db7
parentf4abe0abb00210e9ef6b3277060634ba3db4f6d5 (diff)
downloadexp005-10608cc2ba31147619340a4ff1c36858878c2d30.zip
exp005-10608cc2ba31147619340a4ff1c36858878c2d30.tar.gz
exp005-10608cc2ba31147619340a4ff1c36858878c2d30.tar.bz2
Updated to record the current selection in the database.
-rw-r--r--src/controller/exp004processhits.c27
1 files changed, 15 insertions, 12 deletions
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 @@
3#define GL_GLEXT_PROTOTYPES3#define GL_GLEXT_PROTOTYPES
44
5#include "exp004processhits.h"5#include "exp004processhits.h"
6#include "selection_to_db.h"
6#include "../view/exp004state0.h"7#include "../view/exp004state0.h"
7#include <stdio.h>8#include <stdio.h>
89
9/*10/*
11 * A simple alias to make the code more readable.
12 */
13#define S exp004state0
14
15/*
10 * The implementation of this function is based on16 * The implementation of this function is based on
11 * [Angel,2008,pp80-81].17 * [Angel,2008,pp80-81].
12 */18 */
13void19void
14exp004processhits (GLint hits, GLuint buffer[])20exp004processhits (GLint hits, GLuint buffer[])
15{21{
16 /*
17 * A simple alias to make the code more readable.
18 */
19 EXP004STATE* S = &exp004state0;
20
21 printf ("Hits: %d\n", hits);22 printf ("Hits: %d\n", hits);
2223
23 GLuint *hitlist = buffer;24 GLuint *hitlist = buffer;
@@ -29,23 +30,25 @@ exp004processhits (GLint hits, GLuint buffer[])
29 /*30 /*
30 * Report the hit to the terminal.31 * Report the hit to the terminal.
31 */32 */
32 printf ("Hit %i: %s\n", i + 1, exp004state0.gi_data[*hitlist]);33 printf ("Hit %i: %s\n", i + 1, S.gi_data[*hitlist]);
3334
34 /*35 /*
35 * Add the hits to the selection.36 * Add the hits to the selection.
36 */37 */
37 exp004state0.selection[*hitlist] = true;38 S.selection[*hitlist] = true;
38 exp004state0.base_colors_data[*hitlist][0] = SELECT_COLOR_R;39 S.base_colors_data[*hitlist][0] = SELECT_COLOR_R;
39 exp004state0.base_colors_data[*hitlist][1] = SELECT_COLOR_G;40 S.base_colors_data[*hitlist][1] = SELECT_COLOR_G;
40 exp004state0.base_colors_data[*hitlist][2] = SELECT_COLOR_B;41 S.base_colors_data[*hitlist][2] = SELECT_COLOR_B;
4142
42 hitlist++;43 hitlist++;
43 }44 }
4445
45 glBindBuffer (GL_ARRAY_BUFFER, S->buffers[BASE_COLORS]);46 selection_to_db ();
47
48 glBindBuffer (GL_ARRAY_BUFFER, S.buffers[BASE_COLORS]);
46 glColorPointer (3, GL_FLOAT, 0, 0);49 glColorPointer (3, GL_FLOAT, 0, 0);
47 glBufferData (GL_ARRAY_BUFFER,50 glBufferData (GL_ARRAY_BUFFER,
48 sizeof (S->base_colors_data), S->base_colors_data,51 sizeof (S.base_colors_data), S.base_colors_data,
49 GL_STATIC_DRAW);52 GL_STATIC_DRAW);
50 53
51 printf ("\n");54 printf ("\n");

Valid XHTML 1.0 Strict

Copyright © 2009 Don Pellegrino All Rights Reserved.