PDA

View Full Version : redrawing text after moving window off screen



jsgPhil
12-01-2011, 11:36 AM
Still a newbie... I have openGL code that updates to a window in real time. The bottom two inches of the window is a separate viewport that includes text and a color bar. When I move the window partially off screen and then move it back up, the text (and color bar) overwrite themselves. I've been looking but can't find out how to detect when the window is partially off the screen. I've been looking at glutWindowStatusFunc, but GLUT_PARTIALLY_RETAINED doesn't quite cover what I'm looking for. Any help would be greatly appreciated! Thanks in advance!

jsgPhil
12-05-2011, 09:52 AM
I am sorry if I haven't included enough detail. I have made a little progress, but still seeing a "flash" when I bring the window back fully onto the screen. I am calling:
glutWindowStatusFunc (windowStat);

Then:

void windowStat (int state)
{
if (state == GLUT_FULLY_RETAINED)
refreshTitleWithClear (1);
else if (state == GLUT_HIDDEN)
glutIdleFunc (NULL);
}

jsgPhil
12-05-2011, 10:12 AM
Aaargh! I think when I hit a tab, it does a submit! Yikes! I'll try to keep my finger off the tab key...Here's the rest of the code:

void refreshTitleWithClear (int new)
{
glPushMatrix ();
glMatrixMode (GL_PROJECTION);
glPushMatrix ();

glLoadIdentity [];
gluOrhto2D (0., width, 0., height);
glViewport (0, 0, width, height);

glClear (GL_COLOR_BUFFER_BIT); // this makes it flash

glRasterPos2i (140, 80);
displayText (140, 80, title, black);

newLoadTitleBar (id);

glClear (GL_DEPTH)BUFFER_BIT);

glRasterPos2i (140, 80);
displayText (140, 80, title, white);

glutSwapBuffers ();
glPopMatrix ();
glPopMatrix ();
}


Does that help? If you need displayText or newLoadTItleBar I can send them. Thanks for your time!