Sign in to follow this  

stack overflow error from printing text?

This topic is 3855 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

whenever i use this function to draw text on the screen i get a lot of stack overflow errors in the console window. it doesnt crash but i think if i leave it running long enough it does. char pixelstring[30]; void printText(const char* text, int s, float x, float y, float z) { sprintf(pixelstring, text, s); //Print a string to the screen glPushMatrix(); glDisable(GL_LIGHTING); glColor4f(1.0,1.0,0.0,1.0); glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); gluOrtho2D(0, 200, 0, 200); glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity(); // render the string renderBitmapString(x,y,z,GLUT_BITMAP_TIMES_ROMAN_24,pixelstring); glPopMatrix(); glMatrixMode(GL_PROJECTION); glPopMatrix(); glMatrixMode(GL_MODELVIEW); } 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 then i call this inside the display funciton of glut printText("SCORE: %d",score,0,0,0); can anyone see a problem there?

Share this post


Link to post
Share on other sites

This topic is 3855 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.

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

Sign in to follow this