• Advertisement
Sign in to follow this  
  • entries
    686
  • comments
    1952
  • views
    386590

Strings are pretty cool...

Sign in to follow this  

84 views

I continued my journey to become competent enough to make a game with Glut today. In the last few minutes, I went about creating a string printing function for glut. Glut only seems to have support for drawing one character at a time, which I find quite dumb. Anyway, here is the function that is suggested in the tutorial:



void renderBitmapString(
float x,
float y,
float z,
void *font,
char *string) {
char *c;
glRasterPos3f(x, y,z);
for (c=string; *c != '\0'; c++) {
glutBitmapCharacter(font, *c);
}
}






And here is mine:



void RenderString(float x, float y, float z, void *font, string text)
{

glRasterPos3f(x, y, z);

for(string::iterator c = text.begin(); c != text.end(); c++)
glutBitmapCharacter(font, *c);

}






I'm pretty sure there is nothing wrong with the first one, but I like mine more. [smile]
Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement