0

Alright, so im making falling numbers and i need to display points while its running. in the code its keeping track, but i have no way of displaying it. in regular C++ i would just do cout<<score;
but in openGL it doesn't work that way as most of you know. so how do i draw a variable in OpenGL?

6
Contributors
7
Replies
18
Views
12 Years
Discussion Span
Last Post by ####
0

can someone please help me out. i need to know how to make a variable number show up.

at the bare minimum, can someone please tell me how to convert an int into a string so that i can make the points show up in the title of the window. help would be appreciated.

0

Use a tool called GLFont under ortho view you can output text like

glFontBegin(&font);
glScalef(8.0, 8.0, 8.0);
glTranslatef(30, 30, 0);
glFontTextOut("Test", 5, 5, 0);
glFontEnd();
glFlush();

you can find it here http://students.cs.byu.edu/~bfish/glfontdl.php

i remember there is function under opengl who can put text on screen too.
Check this:
http://www.opengl.org/resources/features/fontsurvey/

for int --> string, you can use

int num = 234;
	string data;
	stringstream ss;
	ss << num;
	data=ss.str();

can someone please help me out. i need to know how to make a variable number show up.

at the bare minimum, can someone please tell me how to convert an int into a string so that i can make the points show up in the title of the window. help would be appreciated.

-2

hey can any1 help me how 2 draw text at variable locations in openGL???

Votes + Comments
Didn't bother to read the replies, or perhaps even the manual page.
0

You can use the printw function. Check out this post.

Usage is as simple as calling printf:

printf(         "char: %c, decimal: %d, float: %f, string: %s", 'X', 1618, 1.618, "text");
printw(x, y, z, "char: %c, decimal: %d, float: %f, string: %s", 'X', 1618, 1.618, "text");
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.