author | Don Pellegrino <don@drexel.edu> | 2009-06-16 23:26:27 (GMT) |
---|---|---|
committer | Don Pellegrino <don@drexel.edu> | 2009-06-16 23:26:27 (GMT) |
commit | e6656c361af46c47784f234af8289f81f2017c89 (patch) (unidiff) | |
tree | dd0f32006a46ad32c1608a1d0ddbd7323510a20c | |
parent | a3cd765827764ec1f8789cc12946d56b1c52416f (diff) | |
download | exp005-e6656c361af46c47784f234af8289f81f2017c89.zip exp005-e6656c361af46c47784f234af8289f81f2017c89.tar.gz exp005-e6656c361af46c47784f234af8289f81f2017c89.tar.bz2 |
Added loading of a selection from the database.
-rw-r--r-- | src/controller/selection_from_db.sqc | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/src/controller/selection_from_db.sqc b/src/controller/selection_from_db.sqc index 20d277e..9467ab3 100644 --- a/src/controller/selection_from_db.sqc +++ b/src/controller/selection_from_db.sqc | |||
@@ -1,5 +1,7 @@ | |||
1 | #define GL_GLEXT_PROTOTYPES | ||
1 | #include "selection_from_db.h" | 2 | #include "selection_from_db.h" |
2 | #include "../view/exp004state0.h" | 3 | #include "../view/exp004state0.h" |
4 | #include <GL/glut.h> | ||
3 | 5 | ||
4 | EXEC SQL INCLUDE sqlca; | 6 | EXEC SQL INCLUDE sqlca; |
5 | 7 | ||
@@ -11,11 +13,51 @@ EXEC SQL INCLUDE sqlca; | |||
11 | void | 13 | void |
12 | selection_from_db (void) | 14 | selection_from_db (void) |
13 | { | 15 | { |
16 | /* | ||
17 | * db2dclgn -d exp004 -t vis_sel_set | ||
18 | */ | ||
14 | EXEC SQL BEGIN DECLARE SECTION; | 19 | EXEC SQL BEGIN DECLARE SECTION; |
15 | 20 | EXEC SQL INCLUDE 'controller/vis_sel_set.h'; | |
16 | EXEC SQL END DECLARE SECTION; | 21 | EXEC SQL END DECLARE SECTION; |
17 | 22 | ||
23 | EXEC SQL DECLARE c3 CURSOR FOR | ||
24 | SELECT * FROM vis_sel_set | ||
25 | ORDER BY title, id DESC; | ||
26 | |||
27 | EXEC SQL OPEN c3; | ||
18 | 28 | ||
29 | /* | ||
30 | * This loop currently assumes only one set in the table and does | ||
31 | * not use the title assigned to that set. This should be improved | ||
32 | * to allow the user to manage multiple sets by name. | ||
33 | */ | ||
34 | EXEC SQL FETCH c3 INTO :vis_sel_set; | ||
35 | while (sqlca.sqlcode != 100) | ||
36 | { | ||
37 | S.selection[vis_sel_set.id] = true; | ||
38 | S.base_colors_data[vis_sel_set.id][0] = vis_sel_set.r; | ||
39 | S.base_colors_data[vis_sel_set.id][1] = vis_sel_set.g; | ||
40 | S.base_colors_data[vis_sel_set.id][2] = vis_sel_set.b; | ||
41 | S.base_colors_data[vis_sel_set.id][3] = 0.6; | ||
42 | |||
43 | EXEC SQL FETCH c3 INTO :vis_sel_set; | ||
44 | } | ||
45 | |||
46 | EXEC SQL CLOSE c3; | ||
47 | |||
48 | EXEC SQL COMMIT; | ||
49 | |||
50 | /* | ||
51 | * Update the graphics memory. | ||
52 | */ | ||
53 | |||
54 | glBindBuffer (GL_ARRAY_BUFFER, S.buffers[BASE_COLORS]); | ||
55 | glColorPointer (4, GL_FLOAT, 0, 0); | ||
56 | glBufferData (GL_ARRAY_BUFFER, | ||
57 | sizeof (S.base_colors_data), S.base_colors_data, | ||
58 | GL_STATIC_DRAW); | ||
59 | |||
60 | glutPostRedisplay (); | ||
19 | 61 | ||
20 | return; | 62 | return; |
21 | } | 63 | } |