Zath,
You need to split(tokenize) the input string into multiple substrings as glAren mentioned. Then, draw each line and move the raster position down for drawing the next line. It is an off topic, but here is a C++ snippet to tokenize a string:
void tokenizeString(const string& str, const string& delimiter, vector<string>& lines)
{
string subStr;
string::size_type from;
string::size_type to;
// reset container
lines.clear();
from = 0; // start from the first char
// find the delimiter then extract sub-string upto delimiter
while((to = str.find(delimiter, from+1)) != string::npos)
{
subStr = str.substr(from, to-from); // "to" points at the delimiter, ignore delimiter
lines.push_back(subStr);
from = to + 1; // next
}
// don't forget the last token
subStr = str.substr(from, to-from);
lines.push_back(subStr);
}
And your drawing routine probably looks like this:
...
vector<string> lines;
tokenizeString(srcString, "
", lines); // split input string to multiple lines
// draw each line with drawString()
float lineSpace = 0.1f; // adjust it yourself
int lineCount = (int)lines.size();
for(int i = 0; i < lineCount; ++i)
{
glRasterPos3f(posX, posY, posZ);
drawString(lines.at(i).c_str());
posY -= lineSpace; // next line
}
...