summaryrefslogtreecommitdiffstats
Unidiff
-rw-r--r--src/model/geometry/datarose_geometry.c54
-rw-r--r--src/model/geometry/datarose_geometry.h11
2 files changed, 65 insertions, 0 deletions
diff --git a/src/model/geometry/datarose_geometry.c b/src/model/geometry/datarose_geometry.c
new file mode 100644
index 0000000..dded424
--- a/dev/null
+++ b/src/model/geometry/datarose_geometry.c
@@ -0,0 +1,54 @@
1#include "datarose_geometry.h"
2#include "../../util/check_error.h"
3#include "../../view/state0.h"
4#include <GL/glut.h>
5
6#define S state0
7
8void
9datarose_geometry (void)
10{
11 glNewList (S.list_offset + DATAROSE_GEOMETRY, GL_COMPILE);
12 glPolygonMode (GL_FRONT, GL_FILL);
13 glColor4f (DEFAULT_COLOR_R, DEFAULT_COLOR_G, DEFAULT_COLOR_B,
14 DEFAULT_COLOR_A);
15
16 /*
17 * The size of the rose will be a percentage of the world height so
18 * that it remains a fixed size when the window is resized or
19 * zoomed.
20 */
21 GLint viewport[4];
22 glGetIntegerv (GL_VIEWPORT, viewport);
23 const double *top = &S.ortho.max_y;
24 const double *bottom = &S.ortho.min_y;
25 double rose_radius = (*top - *bottom) / viewport[3] * 110.0;
26
27 /*
28 * Place the rose in the upper right of the display.
29 */
30 glMatrixMode (GL_MODELVIEW);
31 glPushMatrix ();
32 glLoadIdentity ();
33 const double *right = &S.ortho.max_x;
34 glTranslatef (*right - rose_radius - (rose_radius * 0.40),
35 *top - rose_radius - (rose_radius * 0.80),
36 0.0);
37
38 /*
39 * Create a circle.
40 */
41 GLUquadricObj *obj = gluNewQuadric ();
42 gluQuadricDrawStyle (obj, GLU_LINE);
43 gluDisk (obj, rose_radius * 0.999, rose_radius, 60, 60);
44
45 glPopMatrix ();
46
47 glEndList ();
48
49 gluDeleteQuadric (obj);
50
51 check_error (__FILE__, __LINE__);
52
53 return;
54}

Valid XHTML 1.0 Strict

Copyright © 2009 Don Pellegrino All Rights Reserved.