Results 1 to 2 of 2

Thread: Gui help

  1. #1
    Junior Member Newbie
    Join Date
    Oct 2009
    Posts
    10

    Gui help

    When i enter text into a text box in GUI, I want to acess it load a 3d object accordingly of tat name from a obj.file can anyone tell me how to synchronize the text i have entered in gui so that i can acess it in my program


    int main(int argc, char **argv)
    {

    // setup glut
    glutInit(&argc, argv);
    glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
    glutInitWindowPosition( 50, 50 );
    glutInitWindowSize( WIN_WIDTH, WIN_HEIGHT);

    //You'll need a handle for your main window for GLUI
    main_window = glutCreateWindow( "OBJ Loader" );
    glutDisplayFunc( myGlutDisplay );
    glutReshapeFunc(myGlutReshape);
    glutMouseFunc( myGlutMouse );

    // Initialize my Scene
    initScene();
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(0,500,0,500,-2,50);
    glMatrixMode(GL_MODELVIEW);




    //Build the GU
    glui = GLUI_Master.create_glui( "OBJ Loader GUI", 0, 600, 50 ); /* name, flags,
    x, and y */

    /* Two ways...new vs. add */

    GLUI_Panel *objPanel = glui->add_panel("Obj Files");
    objFileNameTextField = glui->add_edittext_to_panel(objPanel, "Filename:",GLUI_EDITTEXT_TEXT,0,OBJ_TEXTFIELD,tex tCB);
    glui->add_button_to_panel(objPanel, "Load", LOAD_BUTTON, buttonCB);
    glui->add_separator();

    GLUI_Panel *projPanel = glui->add_panel("Projection");
    GLUI_RadioGroup *projGroup = glui->add_radiogroup_to_panel(projPanel, &projType, -1,projCB);
    glui->add_radiobutton_to_group(projGroup, "Orthographic");
    glui->add_radiobutton_to_group(projGroup, "Perspective");
    GLUI_Spinner *fovSpinner = glui->add_spinner_to_panel(projPanel, "FOV", GLUI_SPINNER_INT, &fov, FOV, projCB);
    fovSpinner->set_int_limits(0, 90);

    GLUI_Panel *colorPanel = glui->add_panel("Color");
    /* These should be done with floats but the speed won't work */
    GLUI_Spinner *redValue = glui->add_spinner_to_panel(colorPanel, "Red", 2, &red, RED, colorCB);
    redValue->set_int_limits(0, 255);
    GLUI_Spinner *greenValue = glui->add_spinner_to_panel(colorPanel, "Green", 2, &green,GREEN, colorCB);
    greenValue->set_int_limits(0,255);
    GLUI_Spinner *blueValue = glui->add_spinner_to_panel(colorPanel, "Blue", 2, &blue, BLUE, colorCB);
    blueValue->set_int_limits(0, 255);
    glui->set_main_gfx_window( main_window );

    // We register the idle callback with GLUI, *not* with GLUT
    //GLUI_Master.set_glutIdleFunc( myGlutIdle );
    GLUI_Master.set_glutIdleFunc( NULL );
    glutMainLoop();
    return EXIT_SUCCESS;
    }

    void textCB(int id)
    {

    glui->sync_live();
    printf("%s",id);

    }
    void buttonCB(int control)
    {
    switch(control)
    case LOAD_BUTTON: printf("loading.....");
    // myLoader.LoadObj("objectFileNameGoesHere");
    //ObjModel myObject = myLoader.ReturnObj();



    }

  2. #2

    Re: Gui help

    u should learn c++ first

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean