View Full Version : numbers to screen

03-19-2006, 09:46 PM
how do you output numbers to the window, I can print text but need numbers for scoring in a game

03-19-2006, 10:54 PM
I think you are asking how to convert a number to ASCII characters(string). It is not OpenGL question, but in C, use sprintf(). And use stringstream for C++. Then get the number as string by stringstream.str().c_str().

int score = 100;
stringstream ss;
ss << score << ends;

// your drawing function look like this
drawMyString(ss.str().c_str(), posX, posY, color, font);