openGL display text

In my code below, I want to display the text contained in the variable finalscore. I know how simple it sounds, but I can't figure it out. Thanks!
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#include <glut.h>
#include <cmath>
#include <cstdlib>
#include <time.h>
#include <string>
using namespace std;

GLfloat tplayer;
GLfloat tobject;

time_t Start_t, End_t;
double angle = 0;
double angleadd = 0.2;
int c = 0;
int d = 0;
int e = 10;
int f = 10;
int random, timeelapsed, finalscore;
int score = 0;
int eplus = e + 6;
int eminus = e - 6;
int fplus = f + 6;
int fminus = f - 6;
int mint = 2;

void movecube(){
	e = rand() % 190 - 95;
	f = rand() % 190 - 95;
	End_t = time(NULL);
	timeelapsed = difftime(End_t, Start_t);
	finalscore = score / timeelapsed;
	
}

void display()
{
    glClear(GL_COLOR_BUFFER_BIT);
    glClear(GL_DEPTH_BUFFER_BIT);
    glPushMatrix(); 
	glTranslatef(c, d, 0);
    glRotatef(angle, 0, 0.5, 1);
	glColor3f (0, 0, 1);
    glutWireSphere(5, 10, 10);
    glPopMatrix();
	glPushMatrix();
	glTranslatef(e, f, 0);
    glRotatef(angle, 0, 0.5, 1);
	glColor3f (1, 0, 0);
    glutWireCube(3);
    glPopMatrix();
    glutSwapBuffers();
}

void KeySet() { DWORD old = 0;
SystemParametersInfo(SPI_GETKEYBOARDDELAY, 0, &old, 0);
SystemParametersInfo(SPI_SETKEYBOARDDELAY,0, &old, 0);
}

void keyboard(unsigned char key, int x, int y)
{
	KeySet();
    if(key == 27) exit (0);
	else if( (key == 119) && (95 > d) ){
	d = d + mint;
	eplus = e + 6;
	eminus = e - 6;
	fplus = f + 6;
	fminus = f - 6;
	if( (c < eplus) && (c > eminus) ){
		if( (d < fplus) && (d > fminus) ){
			score = score + 1;
			movecube();
		}
	}
	}
	else if( (key == 115) && (d > -95) ){
	d = d - mint;
	eplus = e + 6;
	eminus = e - 6;
	fplus = f + 6;
	fminus = f - 6;
	if( (c < eplus) && (c > eminus) ){
		if( (d < fplus) && (d > fminus) ){
			score = score + 1;
			movecube();
		}
	}
	}
	else if( (key == 97) && (c > -95) ){
	c = c - mint;
	eplus = e + 6;
	eminus = e - 6;
	fplus = f + 6;
	fminus = f - 6;
	if( (c < eplus) && (c > eminus) ){
		if( (d < fplus) && (d > fminus) ){
			score = score + 1;
			movecube();
		}
	}
	}
	else if( (key == 100) && (95 > c) ){
	c = c + mint;
	eplus = e + 6;
	eminus = e - 6;
	fplus = f + 6;
	fminus = f - 6;
	if( (c < eplus) && (c > eminus) ){
		if( (d < fplus) && (d > fminus) ){
			score = score + 1;
			movecube();
		}
	}
	}
}

void idle()
{
    angle += angleadd;
    glutPostRedisplay();
}
 
int main (int argc, char** argv)
{
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
    glutInitWindowSize (800, 800);
    glutInitWindowPosition (100, 100);
    glutCreateWindow ("Space Journey");
    glClearColor (0, 0, 0, 0);
    glColor3f (1, 1, 1);
    glEnable (GL_DEPTH_TEST);
    glMatrixMode (GL_MODELVIEW);
    glOrtho(-100, 100, -100, 100, -100, 100);
    glutDisplayFunc (display);
	glutKeyboardFunc (keyboard);
	glutIdleFunc (idle);
	glutFullScreen ();
	movecube();
	Start_t = time(NULL);
    glutMainLoop ();
    return 0;
}
Topic archived. No new replies allowed.