summaryrefslogtreecommitdiffstats
Side-by-side diff
-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 @@
+/* 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 "exp004base.h"
+#include "../view/exp004state0.h"
+#include <GL/glut.h>
+#include <stdio.h>
+#include <string.h>
+
+void
+exp004base (void)
+{
+ /*
+ * A simple alias to make the code more readable.
+ */
+ EXP004STATE* S = &exp004state0;
+
+ /*
+ * This implementation can be improved by mapping the video memory
+ * directly rather than loading into system memory and then copying
+ * into video memory.
+ */
+
+ FILE* coords =
+ fopen ("/home/don/exp004/test/run20090514/run20090514.coords", "r");
+ int i = 0;
+
+ /*
+ * Initialize the bounding box of the points.
+ */
+ S->bb.min_x = 0.0;
+ S->bb.max_x = 0.0;
+ S->bb.min_y = 0.0;
+ S->bb.max_y = 0.0;
+
+ for (i = 0; i < ROWS; i++)
+ {
+ fscanf (coords, "%s %f %f\n",
+ S->gi_data[i],
+ &S->base_vertices_data[i][0],
+ &S->base_vertices_data[i][1]);
+
+ if (S->base_vertices_data[i][0] < S->bb.min_x)
+ S->bb.min_x = S->base_vertices_data[i][0];
+ if (S->base_vertices_data[i][0] > S->bb.max_x)
+ S->bb.max_x = S->base_vertices_data[i][0];
+ if (S->base_vertices_data[i][1] < S->bb.min_y)
+ S->bb.min_y = S->base_vertices_data[i][1];
+ if (S->base_vertices_data[i][1] > S->bb.max_y)
+ S->bb.max_y = S->base_vertices_data[i][1];
+
+ /*
+ * Deselected by default.
+ */
+ S->selection[i] = false;
+
+ S->base_colors_data[i][0] = DEFAULT_COLOR_R;
+ S->base_colors_data[i][1] = DEFAULT_COLOR_G;
+ S->base_colors_data[i][2] = DEFAULT_COLOR_B;
+ }
+ fclose (coords);
+
+ /*
+ * Find the largest axis and use it to setup the projection. This
+ * is done to preserve the aspect ratio. The aspect ratio should be
+ * preserved since relative distance is a meaningful indicator in
+ * the map.
+ */
+
+ // Min of min x or min y.
+ if (S->bb.min_x <= S->bb.min_y)
+ S->ortho_min = S->bb.min_x;
+ else
+ S->ortho_min = S->bb.min_y;
+ S->ortho_min--;
+
+ // Max of max x or max y.
+ if (S->bb.max_x >= S->bb.max_y)
+ S->ortho_max = S->bb.max_x;
+ else
+ S->ortho_max = S->bb.max_y;
+ S->ortho_max++;
+
+ // Invert the y coordinate to match up with the LGL Java viewer.
+ for (i = 0; i < ROWS; i++)
+ S->base_vertices_data[i][1] =
+ S->ortho_max - S->base_vertices_data[i][1];
+
+ S->points = i;
+
+ glGenBuffers (2, S->buffers);
+
+ glBindBuffer (GL_ARRAY_BUFFER, S->buffers[BASE_VERTICES]);
+ glVertexPointer (2, GL_FLOAT, 0, 0);
+ glBufferData (GL_ARRAY_BUFFER,
+ sizeof (S->base_vertices_data), S->base_vertices_data,
+ GL_STATIC_DRAW);
+
+ 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,
+ GL_STATIC_DRAW);
+
+ return;
+}

Valid XHTML 1.0 Strict

Copyright © 2009 Don Pellegrino All Rights Reserved.