Ubuntu 11.04, G++, freeglut and GLUT.
I don't understand this at all. Here's the error I get:
whatever.cc:315:59: error: cannot convert ‘std::string’ to ‘const unsigned char*’ for argument ‘2’ to ‘void glutStrokeString(void*, const unsigned char*)’
and if I try glutBitmapString:
whatever.cc:315:59: error: cannot convert ‘std::string’ to ‘const unsigned char*’ for argument ‘2’ to ‘void glutBitmapString(void*, const unsigned char*)’
Here's the relevant code (I think).
scoreStream << "Score: " << score << "\0";
scoreString = scoreStream.str();
// ...in another method:
glRasterPos2i(0, 0);
glColor4f(0.0f, 0.0f, 0.0f, 1.0f);
glutBitmapString(GLUT_BITMAP_HELVETICA_18, scoreString);
This answer tells me it should work, but it just doesn't.
Quote for those who don't want to jump:
// Draw blue text at screen coordinates (100, 120), where (0, 0) is the top-left of the
// screen in an 18-point Helvetica font
glRasterPos2i(100, 120);
glColor4f(0.0f, 0.0f, 1.0f, 1.0f);
glutBitmapString(GLUT_BITMAP_HELVETICA_18, "text to render");
(Also, I have tried leaving a direct string like "text to render" in there. No dice.)
whatever.cc:315:64: error: invalid conversion from ‘const char*’ to ‘const unsigned char*’
I am confused. This is my first question on SO, as far as I remember, so apologies if it isn't too well put together. I'll provide any extra information I can.