I like to track state machine on window.
There must be a simple way to clear the previous text, but this test code does not do it. It just "writes over " - even tried empty text.
( maybe OpenGL is smart and won’t bother outputting empty string )
Any hint woudl be appreciated.
PS I cannot just clear the entire buffer, I need to do this selectively.
{ // print system_state code block
glPushMatrix();
//change matrix relative to "current matrix"
glTranslatef(0.1f, 0.1f, 0.0f);
//glRotated(rotVar, 20.0, 20.0, 10.0);
//drawRGBCube();
//glPopMatrix();
char *message = "system_state ZOOM_IDLE ";
// output message relative to "push" matrix
OpenGL_text(message, 0, 0.5, 0); //"FAILED bad file descriptor ");
glPopMatrix();
glutSwapBuffers();
sleep(5);
// test "erase "
glPushMatrix();
//change matrix relative to "current matrix"
glTranslatef(0.1f, 0.1f, 0.0f);
//glRotated(rotVar, 20.0, 20.0, 10.0);
//drawRGBCube();
//glPopMatrix();
message = "test erase ";
"";
// output message relative to "push" matrix
OpenGL_text(message, 0, 0.5, 0); //"FAILED bad file descriptor ");
glPopMatrix();
glutSwapBuffers();
sleep(5);
glPushMatrix();
//change matrix relative to "current matrix"
glTranslatef(0.1f, 0.1f, 0.0f);
//glRotated(rotVar, 20.0, 20.0, 10.0);
//drawRGBCube();
//glPopMatrix();
message = "system_state ZOOM_IDLE ";
// output message ralative to "push" matrix
OpenGL_text(message, 0, 0.5, 0); //"FAILED bad file descriptor ");
glPopMatrix();
glutSwapBuffers();
// no need glFlush(); // ??
}
Addendum / debugging
putting glLoadIdentity() after push matrix
did not work