Jump to content
  • Advertisement
Sign in to follow this  
me_here_me

Text Rendering and char *

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

I have two character arrays. Based on wheather a flag is true or false I want to display first or the second array. For the first time, correct array is displayed using glutBitmapCharater, but the redrawing at the same position does not happen when I update the flag, with other value. any ideas.

Share this post


Link to post
Share on other sites
Advertisement
look at my code:

char *Cent = "abcdefg";
char *Sob = "klmnopq";


void TBDrawText(){ // this funciton is called from within the display function

glRasterPos2f((GLfloat)-1, (GLfloat)-1);
if (ab == 1) // ab is a flag set at another place in program
while (*Cent) {
gutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, *Cent);
glutStrokeCharacter(GLUT_STROKE_ROMAN,*Cent++);
}
}
else{
while (*Sob) {
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, *Sob);
glutStrokeCharacter(GLUT_STROKE_ROMAN,*Sob++);
}
}
}

correct string is displayed the first time the window is drawn. in case of change in window size or change in the vales of "ab", all text vanishes and there is nothing on the screen

??

thanks in advance

Share this post


Link to post
Share on other sites
Also remember glRasterPos coords are transformed by your modelview and perspective matrices so be careful that they are setup correctly (probably for an ortho projection). You could try using glWindoPos instead (GL ver 1.4 needed for this).

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!