• Advertisement
Sign in to follow this  

glCallLists questions

This topic is 4066 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi ! Im trying to render the FPS in my viewport, I can do strings but since FPS are floats Im kinda stuck. Here is the function that renders the font
void BitMapFont::RenderFontF(int xPos, int yPos, unsigned int base, const GLfloat str)
	if ((base == 0) || (!str))

	glRasterPos2i(xPos, yPos);
	glListBase(base - 32);
	glCallLists((int)strlen(str), GL_UNSIGNED_BYTE, str);

The thing is that I know I cant use strlen for the float, wich alternative can I use? and the other thing is that I get this error "lCallLists' : cannot convert parameter 3 from 'const float' to 'const void *'" and Im not sure how to solve it

Share this post

Link to post
Share on other sites
glCallLists expects a pointer to a continous block of memory containing chars, you are trying to give it a float. You need to first parse the float as a string.

std::stringstream ss();

ss << myFloat;

std::string myString = ss.str();

//myString.c_str(); returns const char array to use with glCallLists

glCallLists(myString.size(), GL_UNSIGNED_BYTE, myString.c_str());

I recommend that you go back and review your C++ book to get a better understanding of types.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement