Sign in to follow this  

Text Rendering and char *

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

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