Domanda

I'm doing an uni project with initially one main GLUT window and will have some sort of "login" GLUI window that, if succeed Draws the glut window. However I want to be able to close the login window after it succeeds.

I've been struggling with this for quite some time, and I've only managed to get it working with glui->hide. However I'm pretty sure the process/thread whatever keeps running on background decreasing the program's performance.

I want to be able to have that similar behavior thats in hide() method, but instead of hiding , deleting/closing it.

I tried glui->close(), but it doesn't disappear. Also tried to glui->unlink() before closing and still doesn't do the desired behavior.

Is there any way I can close only the GLUI window without closing the whole program nor any GLUT window?

This is a bit of my main function:

    glui = GLUI_Master.create_glui( "GLUI", 0, 400, 150 );
    glui->add_statictext( "Login" );
    glui->add_separator();

    edittext = glui->add_edittext( "Username:", GLUI_EDITTEXT_TEXT);
    edittext->set_w(200);
    edittext1 = glui->add_edittext( "Password:", GLUI_EDITTEXT_TEXT);
    edittext1->set_w(200);

    glui->add_button( "OK", 303,validateLogIn ); 

    glui->set_main_gfx_window( main_window );

    GLUI_Master.set_glutIdleFunc( myGlutIdle );
È stato utile?

Soluzione

If you remove GLUI_Master.set_glutIdleFunc( myGlutIdle ); then glui->close() should work.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top