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/controller/exp004mouse.c b/src/controller/exp004mouse.c
new file mode 100644
index 0000000..11117bf
--- a/dev/null
+++ b/src/controller/exp004mouse.c
@@ -0,0 +1,90 @@
1#include "exp004mouse.h"
2#include "exp004processhits.h"
3#include "../view/exp004geometry.h"
4#include "../view/exp004state0.h"
5#include "../util/check_error.h"
6#include <GL/glut.h>
7#include <stdio.h>
8
9#define SIZE 500
10#define N 3
11
12void
13exp004mouse (int button, int state, int x, int y)
14{
15
16 if (button == GLUT_LEFT_BUTTON && state == GLUT_DOWN)
17 {
18
19 /*
20 * "Specify the array to be used for the returned hit records
21 * with glSelectBuffer () [Redbook]."
22 */
23 GLuint select_buf[SIZE];
24 glSelectBuffer (SIZE, select_buf);
25
26 /*
27 * "Enter selection mode by specifying GL_SELECT with
28 * glRenderMode () [Redbook]."
29 */
30 glRenderMode (GL_SELECT);
31
32 /*
33 * "Initialize the name stack using glInitNames () and glPush
34 * Names () [Redbook]."
35 */
36 glInitNames ();
37 glPushName (0);
38
39 /*
40 * "Define the viewing volume you want to use for selection.
41 * Usually this is different from the viewing volume you
42 * originally used to draw the scene, so you probably want to
43 * save and then restore the current transformation state with
44 * glPushMatrix () and glPopMatrix () [Redbook]."
45 */
46 glMatrixMode (GL_PROJECTION);
47 glPushMatrix ();
48 glLoadIdentity ();
49
50 GLint viewport[4];
51 glGetIntegerv (GL_VIEWPORT, viewport);
52
53 gluPickMatrix ((GLdouble) x,
54 (GLdouble) (viewport[3] - y),
55 N,
56 N,
57 viewport);
58
59 gluOrtho2D(exp004state0.ortho.min_x,
60 exp004state0.ortho.max_x,
61 exp004state0.ortho.min_y,
62 exp004state0.ortho.max_y);
63
64 /*
65 * "Alternately issue primitive drawing commands and commands to
66 * manipulate the name stack so that each primitive of interest
67 * has appropriate names assigned [Redbook]."
68 */
69 exp004geometry (GL_SELECT);
70
71 glMatrixMode (GL_PROJECTION);
72 glPopMatrix ();
73 glutSwapBuffers ();
74
75 /*
76 * "Exit selection mode and process the returned selection data
77 * (the hit records) [Redbook]."
78 */
79 GLint hits = glRenderMode (GL_RENDER);
80 check_error (__FILE__, __LINE__);
81
82 /* "process hits from selection mode rendering [Angel,2008]." */
83 exp004processhits (hits, select_buf);
84
85 /* "normal render [Angel,2008]." */
86 glutPostRedisplay ();
87 }
88
89 return;
90}

Valid XHTML 1.0 Strict

Copyright © 2009 Don Pellegrino All Rights Reserved.