summaryrefslogtreecommitdiffstats
Unidiff
-rw-r--r--AUTHORS1
-rw-r--r--Makefile.am2
-rw-r--r--README24
-rw-r--r--ax/acx_pthread.m4242
-rw-r--r--ax/ax_check_gl.m495
-rw-r--r--ax/ax_check_glu.m471
-rw-r--r--ax/ax_check_glut.m478
-rw-r--r--ax/ax_lang_compiler_ms.m423
-rw-r--r--configure.ac24
-rw-r--r--src/Makefile.am28
-rw-r--r--src/controller/exp004display.c16
-rw-r--r--src/controller/exp004display.h6
-rw-r--r--src/controller/exp004mouse.c90
-rw-r--r--src/controller/exp004mouse.h6
-rw-r--r--src/controller/exp004processhits.c54
-rw-r--r--src/controller/exp004processhits.h8
-rw-r--r--src/controller/exp004reshape.c55
-rw-r--r--src/controller/exp004reshape.h6
-rw-r--r--src/exp004viz.c15
-rw-r--r--src/model/exp004base.c107
-rw-r--r--src/model/exp004base.h9
-rw-r--r--src/model/exp004state.h101
-rw-r--r--src/util/check_error.c17
-rw-r--r--src/util/check_error.h9
-rw-r--r--src/view/exp004geometry.c32
-rw-r--r--src/view/exp004geometry.h8
-rw-r--r--src/view/exp004state0.h8
-rw-r--r--src/view/exp004view.c44
-rw-r--r--src/view/exp004view.h6
29 files changed, 1185 insertions, 0 deletions
diff --git a/src/model/exp004base.c b/src/model/exp004base.c
new file mode 100644
index 0000000..56a20e5
--- a/dev/null
+++ b/src/model/exp004base.c
@@ -0,0 +1,107 @@
1/* I seem to need this for glGenBuffers as per
2 http://www.gamedev.net/community/forums/topic.asp?topic_id=422358 */
3#define GL_GLEXT_PROTOTYPES
4
5#include "exp004base.h"
6#include "../view/exp004state0.h"
7#include <GL/glut.h>
8#include <stdio.h>
9#include <string.h>
10
11void
12exp004base (void)
13{
14 /*
15 * A simple alias to make the code more readable.
16 */
17 EXP004STATE* S = &exp004state0;
18
19 /*
20 * This implementation can be improved by mapping the video memory
21 * directly rather than loading into system memory and then copying
22 * into video memory.
23 */
24
25 FILE* coords =
26 fopen ("/home/don/exp004/test/run20090514/run20090514.coords", "r");
27 int i = 0;
28
29 /*
30 * Initialize the bounding box of the points.
31 */
32 S->bb.min_x = 0.0;
33 S->bb.max_x = 0.0;
34 S->bb.min_y = 0.0;
35 S->bb.max_y = 0.0;
36
37 for (i = 0; i < ROWS; i++)
38 {
39 fscanf (coords, "%s %f %f\n",
40 S->gi_data[i],
41 &S->base_vertices_data[i][0],
42 &S->base_vertices_data[i][1]);
43
44 if (S->base_vertices_data[i][0] < S->bb.min_x)
45 S->bb.min_x = S->base_vertices_data[i][0];
46 if (S->base_vertices_data[i][0] > S->bb.max_x)
47 S->bb.max_x = S->base_vertices_data[i][0];
48 if (S->base_vertices_data[i][1] < S->bb.min_y)
49 S->bb.min_y = S->base_vertices_data[i][1];
50 if (S->base_vertices_data[i][1] > S->bb.max_y)
51 S->bb.max_y = S->base_vertices_data[i][1];
52
53 /*
54 * Deselected by default.
55 */
56 S->selection[i] = false;
57
58 S->base_colors_data[i][0] = DEFAULT_COLOR_R;
59 S->base_colors_data[i][1] = DEFAULT_COLOR_G;
60 S->base_colors_data[i][2] = DEFAULT_COLOR_B;
61 }
62 fclose (coords);
63
64 /*
65 * Find the largest axis and use it to setup the projection. This
66 * is done to preserve the aspect ratio. The aspect ratio should be
67 * preserved since relative distance is a meaningful indicator in
68 * the map.
69 */
70
71 // Min of min x or min y.
72 if (S->bb.min_x <= S->bb.min_y)
73 S->ortho_min = S->bb.min_x;
74 else
75 S->ortho_min = S->bb.min_y;
76 S->ortho_min--;
77
78 // Max of max x or max y.
79 if (S->bb.max_x >= S->bb.max_y)
80 S->ortho_max = S->bb.max_x;
81 else
82 S->ortho_max = S->bb.max_y;
83 S->ortho_max++;
84
85 // Invert the y coordinate to match up with the LGL Java viewer.
86 for (i = 0; i < ROWS; i++)
87 S->base_vertices_data[i][1] =
88 S->ortho_max - S->base_vertices_data[i][1];
89
90 S->points = i;
91
92 glGenBuffers (2, S->buffers);
93
94 glBindBuffer (GL_ARRAY_BUFFER, S->buffers[BASE_VERTICES]);
95 glVertexPointer (2, GL_FLOAT, 0, 0);
96 glBufferData (GL_ARRAY_BUFFER,
97 sizeof (S->base_vertices_data), S->base_vertices_data,
98 GL_STATIC_DRAW);
99
100 glBindBuffer (GL_ARRAY_BUFFER, S->buffers[BASE_COLORS]);
101 glColorPointer (3, GL_FLOAT, 0, 0);
102 glBufferData (GL_ARRAY_BUFFER,
103 sizeof (S->base_colors_data), S->base_colors_data,
104 GL_STATIC_DRAW);
105
106 return;
107}

Valid XHTML 1.0 Strict

Copyright © 2009 Don Pellegrino All Rights Reserved.