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