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?

Recommended Answers

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 …

Jump to Post

All 7 Replies

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.

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.

Thanks!
I'm also trying to make moving text and this worked!

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

commented: Didn't bother to read the replies, or perhaps even the manual page. -4

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");

thanks for your reply..

Bump 4 gd ansr. tyty. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.